From eed3bb6dfd52a4e520bd9e2d86ed186b9f3cc688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Mon, 12 Jun 2017 20:30:43 +0200 Subject: [PATCH] winebuild: Emit relay debugging thunks for ARM64. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Hentschel Signed-off-by: Alexandre Julliard --- tools/winebuild/spec32.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index f3feb0f3300..39733b2b0b5 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -84,7 +84,9 @@ static int has_relays( DLLSPEC *spec ) { int i; - if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64 && target_cpu != CPU_ARM) return 0; + if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64 && + target_cpu != CPU_ARM && target_cpu != CPU_ARM64) + return 0; for (i = spec->base; i <= spec->limit; i++) { @@ -242,6 +244,41 @@ static void output_relay_debug( DLLSPEC *spec ) break; } + case CPU_ARM64: + switch (args) + { + default: + case 8: + case 7: output( "\tstp x6, x7, [SP,#-16]!\n" ); + /* fall through */ + case 6: + case 5: output( "\tstp x4, x5, [SP,#-16]!\n" ); + /* fall through */ + case 4: + case 3: output( "\tstp x2, x3, [SP,#-16]!\n" ); + /* fall through */ + case 2: + case 1: output( "\tstp x0, x1, [SP,#-16]!\n" ); + /* fall through */ + case 0: break; + } + output( "\tstp x29, x30, [SP,#-16]!\n" ); + output( "\tstp x8, x9, [SP,#-16]!\n" ); + output( "\tmov x2, SP\n"); + if (odp->flags & FLAG_RET64) flags |= 1; + output( "\tmov w1, #%u\n", (flags << 24) ); + if (args) output( "\tadd w1, w1, #%u\n", (args << 16) ); + if (i - spec->base) output( "\tadd w1, w1, #%u\n", i - spec->base ); + output( "\tldr x0, 1f\n"); + output( "\tldr x3, [x0, #8]\n"); + output( "\tblr x3\n"); + output( "\tadd SP, SP, #16\n" ); + output( "\tldp x29, x30, [SP], #16\n" ); + if (args) output( "\tadd SP, SP, #%u\n", 8 * ((min(args, 8) + 1) & 0xe) ); + output( "\tret\n"); + output( "\t1: .quad .L__wine_spec_relay_descr\n"); + break; + case CPU_x86_64: output( "\tsubq $40,%%rsp\n" ); output_cfi( ".cfi_adjust_cfa_offset 40" );