ntdll: Save the context from the caller stack frame in RtlCaptureContext() on ARM64.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-08-13 14:52:23 +02:00
parent 84783ed74f
commit 1c9fdaab0f
1 changed files with 23 additions and 44 deletions

View File

@ -219,52 +219,31 @@ static void restore_fpu( CONTEXT *context, ucontext_t *sigcontext )
/***********************************************************************
* RtlCaptureContext (NTDLL.@)
*/
/* FIXME: Use the Stack instead of the actual register values? */
__ASM_STDCALL_FUNC( RtlCaptureContext, 8,
"stp x0, x1, [sp, #-32]!\n\t"
"mov w1, #0x400000\n\t" /* CONTEXT_ARM64 */
"add w1, w1, #0x3\n\t" /* CONTEXT_FULL */
"str w1, [x0]\n\t" /* context->ContextFlags */ /* 32-bit, look at cpsr */
"stp x1, x2, [x0, #0x10]\n\t" /* context->X1,X2 */
"stp x3, x4, [x0, #0x20]\n\t" /* context->X3,X4 */
"stp x5, x6, [x0, #0x30]\n\t" /* context->X5,X6 */
"stp x7, x8, [x0, #0x40]\n\t" /* context->X7,X8 */
"stp x9, x10, [x0, #0x50]\n\t" /* context->X9,X10 */
"stp x11, x12, [x0, #0x60]\n\t" /* context->X11,X12 */
"stp x13, x14, [x0, #0x70]\n\t" /* context->X13,X14 */
"stp x15, x16, [x0, #0x80]\n\t" /* context->X15,X16 */
"stp x17, x18, [x0, #0x90]\n\t" /* context->X17,X18 */
"stp x19, x20, [x0, #0xa0]\n\t" /* context->X19,X20 */
"stp x21, x22, [x0, #0xb0]\n\t" /* context->X21,X22 */
"stp x23, x24, [x0, #0xc0]\n\t" /* context->X23,X24 */
"stp x25, x26, [x0, #0xd0]\n\t" /* context->X25,X26 */
"stp x27, x28, [x0, #0xe0]\n\t" /* context->X27,X28 */
"ldp x1, x2, [x29]\n\t"
"stp x1, x2, [x0, #0xf0]\n\t" /* context->Fp,Lr */
"add x1, x29, #0x10\n\t"
"stp x1, x30, [x0, #0x100]\n\t" /* context->Sp,Pc */
"mov w1, #0x400000\n\t" /* CONTEXT_ARM64 */
"add w1, w1, #0x3\n\t" /* CONTEXT_FULL */
"str w1, [x0]\n\t" /* context->ContextFlags */
"mrs x1, NZCV\n\t"
"str w1, [x0, #0x4]\n\t" /* context->Cpsr */
"ldp x0, x1, [sp], #32\n\t"
"str x0, [x0, #0x8]\n\t" /* context->X0 */
"str x1, [x0, #0x10]\n\t" /* context->X1 */
"str x2, [x0, #0x18]\n\t" /* context->X2 */
"str x3, [x0, #0x20]\n\t" /* context->X3 */
"str x4, [x0, #0x28]\n\t" /* context->X4 */
"str x5, [x0, #0x30]\n\t" /* context->X5 */
"str x6, [x0, #0x38]\n\t" /* context->X6 */
"str x7, [x0, #0x40]\n\t" /* context->X7 */
"str x8, [x0, #0x48]\n\t" /* context->X8 */
"str x9, [x0, #0x50]\n\t" /* context->X9 */
"str x10, [x0, #0x58]\n\t" /* context->X10 */
"str x11, [x0, #0x60]\n\t" /* context->X11 */
"str x12, [x0, #0x68]\n\t" /* context->X12 */
"str x13, [x0, #0x70]\n\t" /* context->X13 */
"str x14, [x0, #0x78]\n\t" /* context->X14 */
"str x15, [x0, #0x80]\n\t" /* context->X15 */
"str x16, [x0, #0x88]\n\t" /* context->X16 */
"str x17, [x0, #0x90]\n\t" /* context->X17 */
"str x18, [x0, #0x98]\n\t" /* context->X18 */
"str x19, [x0, #0xa0]\n\t" /* context->X19 */
"str x20, [x0, #0xa8]\n\t" /* context->X20 */
"str x21, [x0, #0xb0]\n\t" /* context->X21 */
"str x22, [x0, #0xb8]\n\t" /* context->X22 */
"str x23, [x0, #0xc0]\n\t" /* context->X23 */
"str x24, [x0, #0xc8]\n\t" /* context->X24 */
"str x25, [x0, #0xd0]\n\t" /* context->X25 */
"str x26, [x0, #0xd8]\n\t" /* context->X26 */
"str x27, [x0, #0xe0]\n\t" /* context->X27 */
"str x28, [x0, #0xe8]\n\t" /* context->X28 */
"str x29, [x0, #0xf0]\n\t" /* context->Fp */
"str x30, [x0, #0xf8]\n\t" /* context->Lr */
"mov x1, sp\n\t"
"str x1, [x0, #0x100]\n\t" /* context->Sp */
"adr x1, 1f\n\t"
"1: str x1, [x0, #0x108]\n\t" /* context->Pc */
"ret"
)
"str w1, [x0, #0x4]\n\t" /* context->Cpsr */
"ret" )
/***********************************************************************
* set_cpu_context