diff options
author | Damien Zammit <damien@zamaudio.com> | 2023-10-28 00:13:54 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-28 12:12:13 +0200 |
commit | 11f470d2203e2bd0362657e46f8b5c78d1ec9e55 (patch) | |
tree | eab4dbe936a14ee1841e3bb405c186e837e706d9 /x86_64 | |
parent | 40a922ff1571ea12f74953d5c6de2fe675b12288 (diff) | |
download | gnumach-11f470d2203e2bd0362657e46f8b5c78d1ec9e55.tar.gz gnumach-11f470d2203e2bd0362657e46f8b5c78d1ec9e55.tar.bz2 gnumach-11f470d2203e2bd0362657e46f8b5c78d1ec9e55.zip |
x86_64/locore.S: Fix int stack checks when NCPUS > 1
Message-ID: <20231028001347.448826-1-damien@zamaudio.com>
Diffstat (limited to 'x86_64')
-rw-r--r-- | x86_64/locore.S | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/x86_64/locore.S b/x86_64/locore.S index f0d1298d..2db0d49b 100644 --- a/x86_64/locore.S +++ b/x86_64/locore.S @@ -692,13 +692,14 @@ _kret_iret: trap_from_kernel: #if MACH_KDB || MACH_TTD movq %rsp,%rbx /* save current stack */ - movq %rsp,%rdx /* on an interrupt stack? */ + + CPU_NUMBER(%ecx) and $(~(INTSTACK_SIZE-1)),%rdx - cmpq EXT(int_stack_base),%rdx + cmpq CX(EXT(int_stack_base),%ecx),%rdx je 1f /* OK if so */ - CPU_NUMBER(%edx) /* get CPU number */ + movl %ecx,%edx cmpq CX(EXT(kernel_stack),%rdx),%rsp /* already on kernel stack? */ ja 0f @@ -824,9 +825,10 @@ ENTRY(all_intrs) PUSH_SEGMENTS_ISR(%rdx) /* save segment registers */ + CPU_NUMBER_NO_GS(%ecx) movq %rsp,%rdx /* on an interrupt stack? */ and $(~(INTSTACK_SIZE-1)),%rdx - cmpq %ss:EXT(int_stack_base),%rdx + cmpq %ss:CX(EXT(int_stack_base),%ecx),%rdx je int_from_intstack /* if not: */ SET_KERNEL_SEGMENTS(%rdx) /* switch to kernel segments */ @@ -885,7 +887,8 @@ LEXT(return_to_iret) /* to find the return from calling interrupt) */ iretq /* return to caller */ int_from_intstack: - cmpq EXT(int_stack_base),%rsp /* seemingly looping? */ + CPU_NUMBER_NO_GS(%edx) + cmpq CX(EXT(int_stack_base),%edx),%rsp /* seemingly looping? */ jb stack_overflowed /* if not: */ call EXT(interrupt) /* call interrupt routine */ _return_to_iret_i: /* ( label for kdb_kintr) */ |