extern seh_handler : proc extern nmi_handler : proc extern seh_handler_ecode : proc .code __nmi_handler proc push rax push rbx push rcx push rdx push rsi push rdi push rbp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 sub rsp, 20h call nmi_handler add rsp, 20h pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax iretq __nmi_handler endp ; #DE has no error code... __de_handler proc push rax push rbx push rcx push rdx push rsi push rdi push rbp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rcx, rsp sub rsp, 20h call seh_handler add rsp, 20h pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax iretq __de_handler endp ; PF and GP have error code... __pf_handler proc __gp_handler proc push rax push rbx push rcx push rdx push rsi push rdi push rbp push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rcx, rsp sub rsp, 20h call seh_handler_ecode add rsp, 20h pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rbp pop rdi pop rsi pop rdx pop rcx pop rbx pop rax add rsp, 8 ; remove error code on the stack... iretq __gp_handler endp __pf_handler endp end