diff --git a/src/arch/x86_64/isr.asm b/src/arch/x86_64/isr.asm index 1013985d..4b9ab85b 100644 --- a/src/arch/x86_64/isr.asm +++ b/src/arch/x86_64/isr.asm @@ -58,11 +58,6 @@ section .text %macro popregs 0 add rsp, 24 ; cr2 gs fs - - cmp rbp,0x3b - jne .noswapgspop - swapgs - .noswapgspop: pop rax mov es,rax @@ -85,6 +80,13 @@ section .text pop rbp add rsp,8 ; remove error code + cmp qword [rsp+8], 0x3b ; user cs + jne .noswap + + swapgs + + .noswap: + %endmacro %macro isr 2