fix bug in inline assembler

This commit is contained in:
Stefan Lankes 2012-05-21 12:16:19 -07:00
parent b9b962ea73
commit 50b8068a78

View file

@ -89,23 +89,23 @@ int arch_fork(task_t* task)
esp += (uint32_t) kstacks[id];
state = (struct state*) (esp - sizeof(struct state) + 2*sizeof(size_t));
memset(state, 0x00, sizeof(struct state) - 2*sizeof(size_t));
asm volatile ("pusha");
asm volatile ("pop %0" : "=r"(state->edi));
asm volatile ("pusha; pop %0" : "=r"(state->edi));
asm volatile ("pop %0" : "=r"(state->esi));
asm volatile ("pop %0" : "=r"(state->ebp));
#ifdef WITH_FRAME_POINTER
state->ebp -= (uint32_t) kstacks[curr_task->id];
state->ebp += (uint32_t) kstacks[id];
#endif
asm volatile ("add $4, %%esp" ::: "%esp");
state->esp = (uint32_t) state;
task->stack = (size_t*) state;
asm volatile ("pop %0" : "=r"(state->ebx));
asm volatile ("pop %0" : "=r"(state->edx));
asm volatile ("pop %0" : "=r"(state->ecx));
asm volatile ("pop %0" : "=r"(state->eax));
#ifdef WITH_FRAME_POINTER
state->ebp -= (uint32_t) kstacks[curr_task->id];
state->ebp += (uint32_t) kstacks[id];
#endif
state->esp = (uint32_t) state;
task->stack = (size_t*) state;
state->int_no = 0xB16B00B5;
state->error = 0xC03DB4B3;
state->cs = cs;