[ros-diffs] [tkreuzer] 37370: RtlCaptureContext can throw an exception. As we need to push the flags on the stack, we need to create unwind info to make sure we can properly unwind. So instead of pushing the flags and then popping them back, push them on the stack at the beginning of the function, reference the location later, clean up the stack at the function end. Also add .cif_adjust_cfa_offset unwind op.
tkreuzer at svn.reactos.org
tkreuzer at svn.reactos.org
Sat Nov 15 02:21:50 CET 2008
Author: tkreuzer
Date: Fri Nov 14 19:21:50 2008
New Revision: 37370
URL: http://svn.reactos.org/svn/reactos?rev=37370&view=rev
Log:
RtlCaptureContext can throw an exception. As we need to push the flags on the stack, we need to create unwind info to make sure we can properly unwind. So instead of pushing the flags and then popping them back, push them on the stack at the beginning of the function, reference the location later, clean up the stack at the function end. Also add .cif_adjust_cfa_offset unwind op.
Modified:
branches/ros-amd64-bringup/reactos/lib/rtl/amd64/except_asm.S
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/amd64/except_asm.S
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/rtl/amd64/except_asm.S?rev=37370&r1=37369&r2=37370&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/amd64/except_asm.S [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/amd64/except_asm.S [iso-8859-1] Fri Nov 14 19:21:50 2008
@@ -23,40 +23,45 @@
_RtlCaptureContext:
.cfi_startproc
- /* Push eflags */
+ /* Push rflags */
pushfq
+ .cfi_adjust_cfa_offset 8
/* Save the basic register context */
mov [rcx + CONTEXT_Rax], rax
mov [rcx + CONTEXT_Rcx], rcx
mov [rcx + CONTEXT_Rdx], rdx
+
+ /* Load rflags into rax */
+ mov rax, [rsp]
+
mov [rcx + CONTEXT_Rbx], rbx
-
- /* pop eflags */
- pop [rcx + CONTEXT_EFlags]
-
mov [rcx + CONTEXT_Rsi], rsi
mov [rcx + CONTEXT_Rdi], rdi
+
+ /* Store rflags */
+ mov [rcx + CONTEXT_EFlags], rax
+
mov [rcx + CONTEXT_Rbp], rbp
+ mov [rcx + CONTEXT_R8], r8
+ mov [rcx + CONTEXT_R9], r9
/* Load former stack pointer in rax */
- lea rax, [rsp + 8]
+ lea rax, [rsp + 0x10]
- mov [rcx + CONTEXT_R8], r8
- mov [rcx + CONTEXT_R9], r9
mov [rcx + CONTEXT_R10], r10
mov [rcx + CONTEXT_R11], r11
+ mov [rcx + CONTEXT_R12], r12
/* Store stack pointer */
mov [rcx + CONTEXT_Rsp], rax
- mov [rcx + CONTEXT_R12], r12
mov [rcx + CONTEXT_R13], r13
mov [rcx + CONTEXT_R14], r14
mov [rcx + CONTEXT_R15], r15
/* Load return address in rax */
- mov rax, [rsp]
+ mov rax, [rsp + 8]
/* Safe segment selectors */
mov [rcx + CONTEXT_SegCs], cs
@@ -87,6 +92,8 @@
movdqa [rcx + CONTEXT_Xmm14], xmm14
movdqa [rcx + CONTEXT_Xmm15], xmm15
*/
+ /* Cleanup stack and return */
+ add rsp, 8
ret
.cfi_endproc
.endfunc
More information about the Ros-diffs
mailing list