From 9e5075dab7c42182b164a433daa8ea6c7ff38bbc Mon Sep 17 00:00:00 2001 From: Ruize Tang <1466040111@qq.com> Date: Sun, 24 Nov 2024 22:46:52 +0800 Subject: [PATCH] Clear `DF` flag during trap handling to conform to x86-64 calling convention --- ostd/src/arch/x86/trap/trap.S | 1 + 1 file changed, 1 insertion(+) diff --git a/ostd/src/arch/x86/trap/trap.S b/ostd/src/arch/x86/trap/trap.S index 7ab5ede49..3a3086432 100644 --- a/ostd/src/arch/x86/trap/trap.S +++ b/ostd/src/arch/x86/trap/trap.S @@ -57,6 +57,7 @@ trap_handler_table: .section .text .global trap_common trap_common: + cld # clear DF before calling/returning to any C function to conform to x86-64 calling convention push rax mov ax, [rsp + 4*8] # load cs and ax, 0x3 # test