summaryrefslogtreecommitdiff
path: root/sys/include/arch/amd64
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-05-16 22:43:08 -0400
committerIan Moffett <ian@osmora.org>2025-05-16 22:43:08 -0400
commitab83b94756aece29f23f27a4d0eabf2418955e01 (patch)
tree8e8881a5e5964a16d57811a4f8a1a5f1547e580b /sys/include/arch/amd64
parentfb4002d54b25ab70d46649a76bf536c67cb92bf4 (diff)
kernel/amd64: trap: Clear interrupts on trap entry
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/arch/amd64')
-rw-r--r--sys/include/arch/amd64/frameasm.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/include/arch/amd64/frameasm.h b/sys/include/arch/amd64/frameasm.h
index 22217eb..c6316a5 100644
--- a/sys/include/arch/amd64/frameasm.h
+++ b/sys/include/arch/amd64/frameasm.h
@@ -121,6 +121,7 @@
*/
#define TRAPENTRY_EC(ENTLABEL, TRAPNO) \
ENTLABEL: ; \
+ cli ; \
testq $0x3, 16(%rsp) ; \
jz 1f ; \
lfence ; \
@@ -133,7 +134,8 @@
jz 2f ; \
lfence ; \
swapgs ; \
- 2: iretq
+ 2: sti ; \
+ iretq
/*
* Trap entry where no error code is on
@@ -141,6 +143,7 @@
*/
#define TRAPENTRY(ENTLABEL, TRAPNO) \
ENTLABEL: ; \
+ cli ; \
testq $0x3, 8(%rsp) ; \
jz 1f ; \
lfence ; \
@@ -153,6 +156,7 @@
jz 2f ; \
lfence ; \
swapgs ; \
- 2: iretq
+ 2: sti ; \
+ iretq
#endif /* !_MACHINE_FRAMEASM_H_ */