summaryrefslogtreecommitdiff
path: root/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S')
-rw-r--r--nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S34
1 files changed, 25 insertions, 9 deletions
diff --git a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
index 9a1e1e64e..ded55a147 100644
--- a/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
+++ b/nuttx/arch/x86/src/qemu/qemu_fullcontextrestore.S
@@ -106,26 +106,43 @@ up_fullcontextrestore:
cli
- /* We now have everything we need from the old stack. Now get the new
- * stack pointer.
+ /* Get the value of the stack pointer as it was when the pusha was
+ * executed the interrupt handler.
*/
movl (4*REG_SP)(%eax), %esp
/* Create an interrupt stack frame for the final iret.
*
- * SP Before ->
- * SS
- * ESP
- * EFLAGS
- * CS
- * SP After -> EIP
+ *
+ * IRET STACK
+ * PRIO CHANGE No PRIO CHANGE
+ * --------------- -----------------
+ * SP Before ->
+ * SS EFLAGS
+ * ESP CS
+ * EFLAGS -> EIP
+ * CS ...
+ * SP After -> EIP
+ *
+ * So, first check for a priority change.
*/
+ movl (4*REG_CS)(%eax), %edx
+ andl $3, %edx
+ mov %cs, %ebx
+ andl $3, %ebx
+ cmpb %bl, %dl
+ je .Lnopriochange
+
+ /* The priority will change... put SS and ESP on the stack */
+
mov (4*REG_SS)(%eax), %ebx
push %ebx
movl (4*REG_SP)(%eax), %ebx
push %ebx
+
+.Lnopriochange:
movl (4*REG_EFLAGS)(%eax), %ebx
push %ebx
mov (4*REG_CS)(%eax), %ebx
@@ -162,4 +179,3 @@ up_fullcontextrestore:
iret
.size up_fullcontextrestore, . - up_fullcontextrestore
.end
-