diff --git a/.gitignore b/.gitignore index 2ecbcd97..cae77b40 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ tags Makefile include/metalsvm/config.h +include/metalsvm/config.inc tools/make_initrd newlib/examples/hello newlib/examples/jacobi diff --git a/Makefile.example b/Makefile.example index 1487bfb3..db58a6cc 100644 --- a/Makefile.example +++ b/Makefile.example @@ -113,8 +113,12 @@ veryclean: clean @echo [DEP] $*.dep $Q$(CPP_FOR_TARGET) -MF $*.dep -MT $*.o -MM -D__KERNEL__ $(CFLAGS) $< +include/metalsvm/config.inc: include/metalsvm/config.h + @echo "; This file is generated automatically from the config.h file." > include/metalsvm/config.inc + @echo "; Before editing this, you should consider editing config.h." >> include/metalsvm/config.inc + @awk '/^#define MAX_CORES/{ print "%define MAX_CORES", $$3 }' include/metalsvm/config.h >> include/metalsvm/config.inc -%.o : %.asm +%.o : %.asm include/metalsvm/config.inc @echo [ASM] $@ $Q$(NASM) $(NASMFLAGS) -o $@ $< diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index f3c6a6d4..c9c0f4dc 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -799,15 +799,14 @@ common_switch: ; determine TSS %if MAX_CORES > 1 call apic_cpu_id + mov ecx, DWORD 0x68 + mul ecx %else xor eax, eax %endif - mov ecx, DWORD 0x68 - mul ecx add eax, task_state_segments - add eax, DWORD 4 ; set esp0 in TSS - mov [eax], esp + mov [eax+4], esp ; call cleanup code call finish_task_switch diff --git a/include/metalsvm/config.inc.example b/include/metalsvm/config.inc.example deleted file mode 100644 index 2b919abc..00000000 --- a/include/metalsvm/config.inc.example +++ /dev/null @@ -1,4 +0,0 @@ -; config macros for the assembler code - -; define the maximum number of core -%define MAX_CORES 1 diff --git a/kernel/tasks.c b/kernel/tasks.c index 2dfb2d25..d283e55d 100644 --- a/kernel/tasks.c +++ b/kernel/tasks.c @@ -190,7 +190,7 @@ static void NORETURN do_exit(int arg) { //remove fildes_table if(!curr_task->fildes_table) - kfree(curr_task->fildes_table, sizeof(fildes_t)*NR_OPEN); + kfree(curr_task->fildes_table, sizeof(filp_t)*NR_OPEN); spinlock_unlock(&curr_task->vma_lock);