From 83b60a7b0d592850c4d6b5cf3a43e71dd5cbdba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Sun, 15 Jul 2012 16:41:56 +0200 Subject: [PATCH] winebuild: Generate relay debugging thunks for ARM. --- tools/winebuild/spec32.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 3dff304a5d2..7892f222f79 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -83,7 +83,7 @@ int has_relays( DLLSPEC *spec ) { int i; - if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64) return 0; + if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64 && target_cpu != CPU_ARM) return 0; for (i = spec->base; i <= spec->limit; i++) { @@ -210,6 +210,34 @@ static void output_relay_debug( DLLSPEC *spec ) } break; + case CPU_ARM: + switch (args) + { + default: output( "\tpush {r0-r3}\n" ); break; + case 3: output( "\tpush {r0-r2}\n" ); break; + case 2: output( "\tpush {r0-r1}\n" ); break; + case 1: output( "\tpush {r0}\n" ); break; + case 0: break; + } + output( "\tpush {LR}\n" ); + output( "\tmov r2, SP\n"); + if (odp->flags & FLAG_RET64) flags |= 1; + output( "\tmov r1, #%u\n", (flags << 24) ); + if (args) output( "\tadd r1, #%u\n", (args << 16) ); + if ((i - spec->base) & 0xf000) output( "\tadd r1, #%u\n", (i - spec->base) & 0xf000 ); + if ((i - spec->base) & 0x0f00) output( "\tadd r1, #%u\n", (i - spec->base) & 0x0f00 ); + if ((i - spec->base) & 0x00f0) output( "\tadd r1, #%u\n", (i - spec->base) & 0x00f0 ); + if ((i - spec->base) & 0x000f) output( "\tadd r1, #%u\n", (i - spec->base) & 0x000f ); + output( "\tldr r0, [PC, #0]\n"); + output( "\tmov PC, PC\n"); + output( "\t.long .L__wine_spec_relay_descr\n" ); + output( "\tldr r3, [r0, #4]\n"); + output( "\tblx r3\n"); + output( "\tpop {r3}\n" ); + if (args) output( "\tadd SP, SP, #%u\n", min(args*4, 16) ); + output( "\tbx r3\n"); + break; + case CPU_x86_64: output( "\tsubq $40,%%rsp\n" ); output_cfi( ".cfi_adjust_cfa_offset 40" );