[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Runtime Library (RTL)
|
|
|
|
* FILE: lib/rtl/amd64/except_asm.S
|
|
|
|
* PURPOSE: Exception support for AMD64
|
|
|
|
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2010-11-27 22:12:15 +00:00
|
|
|
#include <asm.inc>
|
|
|
|
#include <ksamd64.inc>
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2010-07-19 21:18:33 +00:00
|
|
|
.code64
|
|
|
|
|
2011-10-14 08:33:22 +00:00
|
|
|
/*
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
* VOID NTAPI
|
|
|
|
* RtlCaptureContext(
|
|
|
|
* PCONTEXT ContextRecord); <rcx>
|
|
|
|
*/
|
2010-07-19 21:18:33 +00:00
|
|
|
PUBLIC RtlCaptureContext
|
|
|
|
.PROC RtlCaptureContext
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|
|
|
|
/* Push rflags */
|
|
|
|
pushfq
|
2010-07-19 21:18:33 +00:00
|
|
|
.ALLOCSTACK 8
|
|
|
|
.ENDPROLOG
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
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 */
|
2010-07-19 21:18:33 +00:00
|
|
|
lea rax, [rsp + 16]
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|
|
|
|
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_R13], r13
|
|
|
|
mov [rcx + CONTEXT_R14], r14
|
|
|
|
mov [rcx + CONTEXT_R15], r15
|
|
|
|
|
|
|
|
/* Load return address in rax */
|
|
|
|
mov rax, [rsp + 8]
|
|
|
|
|
|
|
|
/* Safe segment selectors */
|
|
|
|
mov [rcx + CONTEXT_SegCs], cs
|
|
|
|
mov [rcx + CONTEXT_SegDs], ds
|
|
|
|
mov [rcx + CONTEXT_SegEs], es
|
|
|
|
mov [rcx + CONTEXT_SegFs], fs
|
|
|
|
mov [rcx + CONTEXT_SegGs], gs
|
|
|
|
mov [rcx + CONTEXT_SegSs], ss
|
|
|
|
|
|
|
|
/* Store return address */
|
|
|
|
mov [rcx + CONTEXT_Rip], rax
|
|
|
|
|
|
|
|
/* Safe xmm registers */
|
|
|
|
movdqa [rcx + CONTEXT_Xmm0], xmm0
|
|
|
|
movdqa [rcx + CONTEXT_Xmm1], xmm1
|
|
|
|
movdqa [rcx + CONTEXT_Xmm2], xmm2
|
|
|
|
movdqa [rcx + CONTEXT_Xmm3], xmm3
|
|
|
|
movdqa [rcx + CONTEXT_Xmm4], xmm4
|
|
|
|
movdqa [rcx + CONTEXT_Xmm5], xmm5
|
|
|
|
movdqa [rcx + CONTEXT_Xmm6], xmm6
|
|
|
|
movdqa [rcx + CONTEXT_Xmm7], xmm7
|
|
|
|
movdqa [rcx + CONTEXT_Xmm8], xmm8
|
|
|
|
movdqa [rcx + CONTEXT_Xmm9], xmm9
|
|
|
|
movdqa [rcx + CONTEXT_Xmm10], xmm10
|
|
|
|
movdqa [rcx + CONTEXT_Xmm11], xmm11
|
|
|
|
movdqa [rcx + CONTEXT_Xmm12], xmm12
|
|
|
|
movdqa [rcx + CONTEXT_Xmm13], xmm13
|
|
|
|
movdqa [rcx + CONTEXT_Xmm14], xmm14
|
|
|
|
movdqa [rcx + CONTEXT_Xmm15], xmm15
|
|
|
|
|
|
|
|
/* Cleanup stack and return */
|
|
|
|
add rsp, 8
|
|
|
|
ret
|
2011-10-14 08:33:22 +00:00
|
|
|
.ENDP
|
2010-07-19 21:18:33 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
[RTL]
Merge from amd64 branch
35738,37004,37308,37324,37330,37331,37332,37370,37419,37424,37425,37428,37473,37492,37844,37911,37987,40604,41006,43686,43951,43953,43980,43993,44001,44289,44295,44296,44428,44966,44967,44968
- Implement amd64 specific RTL functions: RtlLookupFunctionTable, RtlLookupFunctionEntry, RtlCaptureContext, RtlVirtualUnwind, RtlWalkFrameChain, RtlGetCallersAddress, RtlRaiseException (Timo Kreuzer)
- Implement amd64 asm functions: RtlCompareMemory, DebugService, RtlInterlockedPopEntrySList, RtlInterlockedPushEntrySList and RtlInterlockedFlushSList (Timo Kreuzer)
- Don't use double in rtl's sprintf / swprintf, use double_t union instead. (Stefan Ginsberg)
svn path=/trunk/; revision=44970
2010-01-06 00:39:07 +00:00
|
|
|
|