summaryrefslogtreecommitdiff
path: root/x86_64
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2023-07-29 19:47:49 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-04 23:35:06 +0200
commite2e78b6c461543e1d057a63eaa3d43d71ba0f3f8 (patch)
tree9d55f1925b3746055c0195104204114146dea0be /x86_64
parent8b29b18fda413928c32473475ca51aa05c52db18 (diff)
x86_64: fix stack handling on recursive interrupts for USER32
* x86_64/locore.S: ensure the thread state is filled completely even on recursive interrups. The value of the segment selectors is not very important in this case, but we still need to align the stack to the bottom of i386_interrupt_state. Message-Id: <20230729174753.1145878-1-luca@orpolo.org>
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/locore.S16
1 files changed, 11 insertions, 5 deletions
diff --git a/x86_64/locore.S b/x86_64/locore.S
index 16b0dde5..ac7138b7 100644
--- a/x86_64/locore.S
+++ b/x86_64/locore.S
@@ -752,17 +752,17 @@ ENTRY(all_intrs)
pushq %r11
cld /* clear direction flag */
- movq %rsp,%rdx /* on an interrupt stack? */
- and $(~(INTSTACK_SIZE-1)),%rdx
- cmpq %ss:EXT(int_stack_base),%rdx
- je int_from_intstack /* if not: */
-
movq %ds,%rdx /* save segment registers */
pushq %rdx
movq %es,%rdx
pushq %rdx
PUSH_FSGS_ISR
+ movq %rsp,%rdx /* on an interrupt stack? */
+ and $(~(INTSTACK_SIZE-1)),%rdx
+ cmpq %ss:EXT(int_stack_base),%rdx
+ je int_from_intstack /* if not: */
+
mov %ss,%dx /* switch to kernel segments */
mov %dx,%ds
mov %dx,%es
@@ -830,6 +830,12 @@ int_from_intstack:
jb stack_overflowed /* if not: */
call EXT(interrupt) /* call interrupt routine */
_return_to_iret_i: /* ( label for kdb_kintr) */
+ POP_FSGS_ISR
+ pop %rdx
+ mov %rdx,%es
+ pop %rdx
+ mov %rdx,%ds
+
pop %r11
pop %r10
pop %r9