diff options
author | davidxu <davidxu@FreeBSD.org> | 2002-11-22 03:01:55 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2002-11-22 03:01:55 +0000 |
commit | f89233ef8d826c7b28410899f4d41e455fd50311 (patch) | |
tree | c654cefc322cb9f4fa1ea68dc5f71a2edf82d429 /tools | |
parent | 1f29413454b208e8695bb5791f383247d8906303 (diff) | |
download | FreeBSD-src-f89233ef8d826c7b28410899f4d41e455fd50311.zip FreeBSD-src-f89233ef8d826c7b28410899f4d41e455fd50311.tar.gz |
Fix context restore bug.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/KSE/ksetest/kse_asm.S | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/KSE/ksetest/kse_asm.S b/tools/KSE/ksetest/kse_asm.S index 79859d8..517eb0d 100644 --- a/tools/KSE/ksetest/kse_asm.S +++ b/tools/KSE/ksetest/kse_asm.S @@ -61,7 +61,7 @@ ENTRY(uts_to_thread) je 2f movl $-1, %eax /* bzzzt, invalid context */ jmp 5f -2: movl 8(%esp), %eax /* get address of curthreadp */ +2: movl 8(%esp), %ecx /* get address of curthreadp */ movl %edx, %ebx /* save the pointer for later */ /* * From here on, we don't touch the old stack. @@ -85,15 +85,21 @@ ENTRY(uts_to_thread) jmp 4f 3: fninit fldcw MC_FP_CW_OFFSET(%edx) -4: pushl 68(%edx) /* flags */ - pushl 48(%edx) /* eax */ - pushl 36(%edx) /* ebx */ - movl 40(%edx), %edx /* edx */ - movl %ebx, (%eax) /* <---- set new mailbox pointer */ - popl %ebx - popl %eax - popf -5: ret +4: movl 48(%edx), %eax /* restore ax, bx, cx, dx */ + pushl 68(%edx) /* flags on stack */ + pushl 36(%edx) /* %ebx on stack */ + pushl 44(%edx) /* %ecx on stack */ + pushl 40(%edx) /* %edx on stack */ + /* + * all registers are now moved out of mailbox + * it's now safe to set current thread pointer + */ + movl %ebx,(%ecx) + popl %edx /* %edx off stack */ + popl %ecx /* %ecx off stack */ + pop %ebx /* %ebx off stack */ + popf /* flags off stack */ +5: ret /* %eip off stack */ /* * int thread_to_uts(struct kse_thr_mailbox *tm, struct kse_mailbox *km); |