diff --git a/Makefile.example b/Makefile.example index a346f6e8..b3f2a448 100644 --- a/Makefile.example +++ b/Makefile.example @@ -24,7 +24,10 @@ NASM = nasm MAKE = make NASMFLAGS = -felf32 -g INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/lwip/src/include/ipv4 -I$(TOPDIR)/drivers +# Compiler options for final code CFLAGS = -g -m32 -march=i586 -Wall -O2 -fno-zero-initialized-in-bss -fno-builtin -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc $(INCLUDE) -fno-stack-protector +# Compiler options for debuuging +#CFLAGS = -g -O -m32 -march=i586 -Wall -fno-zero-initialized-in-bss -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) -fno-stack-protector ARFLAGS = rsv RM = rm -rf LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(shell date +'%Y%m%d') --defsym __BUILD_TIME=$(shell date +'%H%M%S') diff --git a/arch/x86/kernel/gdt.c b/arch/x86/kernel/gdt.c index 4556711a..084f071c 100644 --- a/arch/x86/kernel/gdt.c +++ b/arch/x86/kernel/gdt.c @@ -79,6 +79,10 @@ int arch_fork(task_t* task) asm volatile ("pop %%eax" : "=a"(task_state_segments[id].edi)); asm volatile ("pop %%eax" : "=a"(task_state_segments[id].esi)); asm volatile ("pop %%eax" : "=a"(task_state_segments[id].ebp)); +#ifdef WITH_FRAME_POINTER + task_state_segments[id].ebp -= (uint32_t) kstacks[curr_task->id]; + task_state_segments[id].ebp += (uint32_t) kstacks[id]; +#endif asm volatile ("add $4, %%esp" ::: "%esp"); asm volatile ("pop %%eax" : "=a"(task_state_segments[id].ebx)); asm volatile ("pop %%eax" : "=a"(task_state_segments[id].edx));