mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Fix QEMU context switch bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3361 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -61,14 +61,24 @@
|
|||||||
|
|
||||||
/* Trace macros, use like trace 'i' to print char to serial port. */
|
/* Trace macros, use like trace 'i' to print char to serial port. */
|
||||||
|
|
||||||
.macro trace, ch
|
.macro chout, addr, ch
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
mov $0x3f8, %dx
|
mov $\addr, %dx
|
||||||
mov $\ch, %al
|
mov $\ch, %al
|
||||||
out %al, %dx
|
out %al, %dx
|
||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro trace, ch
|
||||||
|
#ifdef CONFIG_DEBUG
|
||||||
|
push %eax
|
||||||
|
push %edx
|
||||||
|
chout 0x3f8, \ch
|
||||||
|
pop %edx
|
||||||
|
pop %eax
|
||||||
|
#endif
|
||||||
|
.endm
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -151,5 +161,5 @@ up_fullcontextrestore:
|
|||||||
popl %eax
|
popl %eax
|
||||||
iret
|
iret
|
||||||
.size up_fullcontextrestore, . - up_fullcontextrestore
|
.size up_fullcontextrestore, . - up_fullcontextrestore
|
||||||
.end
|
.end
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,24 @@
|
|||||||
|
|
||||||
/* Trace macros, use like trace 'i' to print char to serial port. */
|
/* Trace macros, use like trace 'i' to print char to serial port. */
|
||||||
|
|
||||||
.macro trace, ch
|
.macro chout, addr, ch
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
mov $0x3f8, %dx
|
mov $\addr, %dx
|
||||||
mov $\ch, %al
|
mov $\ch, %al
|
||||||
out %al, %dx
|
out %al, %dx
|
||||||
#endif
|
#endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro trace, ch
|
||||||
|
#ifdef CONFIG_DEBUG
|
||||||
|
push %eax
|
||||||
|
push %edx
|
||||||
|
chout 0x3f8, \ch
|
||||||
|
pop %edx
|
||||||
|
pop %eax
|
||||||
|
#endif
|
||||||
|
.endm
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* .text
|
* .text
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -132,15 +142,26 @@ up_saveusercontext:
|
|||||||
|
|
||||||
movl %ebp, (4*REG_EBP)(%eax)
|
movl %ebp, (4*REG_EBP)(%eax)
|
||||||
|
|
||||||
/* Get and save the interrupt state */
|
/* Save EAX=1. This will be the "apparent" return value from this
|
||||||
|
* function when context is switch back to this thread. The non-zero
|
||||||
pushf
|
* return value is the indication that we have been resumed.
|
||||||
pop %ecx
|
*/
|
||||||
movl %ecx, (4*REG_EFLAGS)(%eax)
|
|
||||||
|
|
||||||
/* And return 0. 'ret' will remove the EIP from the top of the stack. */
|
movl $1, (4*REG_EAX)(%eax)
|
||||||
|
|
||||||
xorl %eax, %eax
|
/* Get and save the interrupt state */
|
||||||
|
|
||||||
|
pushf
|
||||||
|
pop %ecx
|
||||||
|
movl %ecx, (4*REG_EFLAGS)(%eax)
|
||||||
|
|
||||||
|
/* And return 0 -- The zero return value is the indication that that
|
||||||
|
* this is the original, "true" return from the function.
|
||||||
|
*
|
||||||
|
* 'ret' will remove the EIP from the top of the stack.
|
||||||
|
*/
|
||||||
|
|
||||||
|
xorl %eax, %eax
|
||||||
ret
|
ret
|
||||||
.size up_saveusercontext, . - up_saveusercontext
|
.size up_saveusercontext, . - up_saveusercontext
|
||||||
.end
|
.end
|
||||||
|
|||||||
Reference in New Issue
Block a user