* 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. --- x86_64/locore.S | 16 +++++++++++----- 1 file 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 -- 2.39.2