1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

add option to disable restoring of FPU registers

This commit is contained in:
Stefan Lankes 2016-02-15 11:29:40 +01:00
parent c577d5bebb
commit 3c573e5401
4 changed files with 13 additions and 1 deletions

View file

@ -120,6 +120,7 @@ include/hermit/config.inc: include/hermit/config.h
@awk '/^#define KERNEL_STACK_SIZE/{ print "%define KERNEL_STACK_SIZE", $$3 }' include/hermit/config.h >> include/hermit/config.inc
@awk '/^#define VIDEO_MEM_ADDR/{ print "%define VIDEO_MEM_ADDR", $$3 }' include/hermit/config.h >> include/hermit/config.inc
@awk '/^#define DYNAMIC_TICKS/{ print "%define DYNAMIC_TICKS", $$3 }' include/hermit/config.h >> include/hermit/config.inc
@awk '/^#define SAVE_FPU/{ print "%define SAVE_FPU", $$3 }' include/hermit/config.h >> include/hermit/config.inc
%.o : %.asm include/hermit/config.inc
@echo [ASM] $@

View file

@ -574,10 +574,12 @@ common_switch:
call get_current_stack ; get new rsp
mov rsp, rax
%ifdef SAVE_FPU
; set task switched flag
mov rax, cr0
or rax, 8
mov cr0, rax
%endif
; call cleanup code
call finish_task_switch

View file

@ -97,6 +97,14 @@ static int thread_entry(void* arg, size_t ep)
if (init_tls())
return -ENOMEM;
#ifndef SAVE_FPU
// set task switched flag for the first FPU access
// => initialize the FPU
size_t cr0 = read_cr0();
cr0 |= CR0_TS;
write_cr0(cr0);
#endif
//vma_dump();
// set first argument

View file

@ -41,11 +41,12 @@ extern "C" {
#define VIDEO_MEM_ADDR 0xB8000 /* the video memory address */
#define CACHE_LINE 64
#define KERNEL_STACK_SIZE (8*1024)
#define DEFAULT_STACK_SIZE (128*1024)
#define DEFAULT_STACK_SIZE (64*1024*1024)
#define KMSG_SIZE (4*1024)
#define INT_SYSCALL 0x80
#define MAILBOX_SIZE 32
//#define WITH_PCI_IDS
#define SAVE_FPU
#define BYTE_ORDER LITTLE_ENDIAN