From: Kevin O'Connor Date: Sun, 20 Dec 2009 18:11:17 +0000 (-0500) Subject: Fix yield() so it works from boot code. X-Git-Tag: rel-0.5.1~31 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fb214dc70aaeb7b4bbaf270bb9566843a0606933;p=seabios.git Fix yield() so it works from boot code. In boot code, the f-segment is read-only, so make sure yield() doesn't rely on writes. Easiest way to do this is to avoid stack switches when not needed. --- diff --git a/src/stacks.c b/src/stacks.c index d237864..56d17a1 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -50,7 +50,7 @@ call32(void *func) " addl %0, %%esp\n" " movl %%ss, %0\n" - // Transition to 32bit mode, call yield_preempt, return to 16bit + // Transition to 32bit mode, call func, return to 16bit " pushl $(" __stringify(BUILD_BIOS_ADDR) " + 1f)\n" " jmp transition32\n" " .code32\n" @@ -148,6 +148,9 @@ static void switch_next(struct thread_info *cur) { struct thread_info *next = cur->next; + if (cur == next) + // Nothing to do. + return; asm volatile( " pushl $1f\n" // store return pc " pushl %%ebp\n" // backup %ebp