From: Damjan Jovanovic Subject: [PATCH] ntdll: use the correct amd64 trap codes on *BSD Message-Id: Date: Tue, 25 Jan 2022 17:37:12 +0200 Fix the *BSD trap codes on amd64 like 148120f21ecf7ad30aaa2136f8d9f00f2f241231 did on i386. Signed-off-by: Damjan Jovanovic --- dlls/ntdll/unix/signal_x86_64.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 68e0c7ce66e..68855dccacf 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -144,6 +144,8 @@ __ASM_GLOBAL_FUNC( alloc_fs_sel, #elif defined(__FreeBSD__) || defined (__FreeBSD_kernel__) +#include + #define RAX_sig(context) ((context)->uc_mcontext.mc_rax) #define RBX_sig(context) ((context)->uc_mcontext.mc_rbx) #define RCX_sig(context) ((context)->uc_mcontext.mc_rcx) @@ -238,6 +240,27 @@ __ASM_GLOBAL_FUNC( alloc_fs_sel, enum i386_trap_code { +#if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) + TRAP_x86_DIVIDE = T_DIVIDE, /* Division by zero exception */ + TRAP_x86_TRCTRAP = T_TRCTRAP, /* Single-step exception */ + TRAP_x86_NMI = T_NMI, /* NMI interrupt */ + TRAP_x86_BPTFLT = T_BPTFLT, /* Breakpoint exception */ + TRAP_x86_OFLOW = T_OFLOW, /* Overflow exception */ + TRAP_x86_BOUND = T_BOUND, /* Bound range exception */ + TRAP_x86_PRIVINFLT = T_PRIVINFLT, /* Invalid opcode exception */ + TRAP_x86_DNA = T_DNA, /* Device not available exception */ + TRAP_x86_DOUBLEFLT = T_DOUBLEFLT, /* Double fault exception */ + TRAP_x86_FPOPFLT = T_FPOPFLT, /* Coprocessor segment overrun */ + TRAP_x86_TSSFLT = T_TSSFLT, /* Invalid TSS exception */ + TRAP_x86_SEGNPFLT = T_SEGNPFLT, /* Segment not present exception */ + TRAP_x86_STKFLT = T_STKFLT, /* Stack fault */ + TRAP_x86_PROTFLT = T_PROTFLT, /* General protection fault */ + TRAP_x86_PAGEFLT = T_PAGEFLT, /* Page fault */ + TRAP_x86_ARITHTRAP = T_ARITHTRAP, /* Floating point exception */ + TRAP_x86_ALIGNFLT = T_ALIGNFLT, /* Alignment check exception */ + TRAP_x86_MCHK = T_MCHK, /* Machine check exception */ + TRAP_x86_CACHEFLT = T_XMMFLT /* Cache flush exception */ +#else TRAP_x86_DIVIDE = 0, /* Division by zero exception */ TRAP_x86_TRCTRAP = 1, /* Single-step exception */ TRAP_x86_NMI = 2, /* NMI interrupt */ @@ -257,6 +280,7 @@ enum i386_trap_code TRAP_x86_ALIGNFLT = 17, /* Alignment check exception */ TRAP_x86_MCHK = 18, /* Machine check exception */ TRAP_x86_CACHEFLT = 19 /* Cache flush exception */ +#endif }; /* stack layout when calling an exception raise function */