aboutsummaryrefslogtreecommitdiff
path: root/src/stacks.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-12-20 13:11:17 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-12-20 13:11:17 -0500
commitfb214dc70aaeb7b4bbaf270bb9566843a0606933 (patch)
tree8b80f069fbc3da4ba37cdb3aa02b831c5bb883af /src/stacks.c
parent2ceeec9d56ffc93b12cbd01b7e303251b1c0361a (diff)
downloadseabios-hppa-fb214dc70aaeb7b4bbaf270bb9566843a0606933.zip
seabios-hppa-fb214dc70aaeb7b4bbaf270bb9566843a0606933.tar.gz
seabios-hppa-fb214dc70aaeb7b4bbaf270bb9566843a0606933.tar.bz2
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.
Diffstat (limited to 'src/stacks.c')
-rw-r--r--src/stacks.c5
1 files changed, 4 insertions, 1 deletions
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