ntdll: Use DWORDs for ARM assembly instructions.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-01-18 19:20:10 +01:00
parent 7bcb214158
commit 8a62752fe9
1 changed files with 24 additions and 51 deletions

View File

@ -230,10 +230,10 @@ struct stub
#elif defined(__arm__)
struct stub
{
BYTE ldr_r0[4]; /* ldr r0, $dll */
BYTE ldr_r1[4]; /* ldr r1, $name */
BYTE mov_r2_lr[4]; /* mov r2, lr */
BYTE ldr_pc_pc[4]; /* ldr pc, [pc, #4] */
DWORD ldr_r0; /* ldr r0, $dll */
DWORD ldr_r1; /* ldr r1, $name */
DWORD mov_r2_lr; /* mov r2, lr */
DWORD ldr_pc_pc; /* ldr pc, [pc, #4] */
const char *dll;
const char *name;
const void* entry;
@ -241,11 +241,11 @@ struct stub
#elif defined(__aarch64__)
struct stub
{
BYTE ldr_x0[4]; /* ldr x0, $dll */
BYTE ldr_x1[4]; /* ldr x1, $name */
BYTE mov_x2_lr[4]; /* mov x2, lr */
BYTE ldr_x16[4]; /* ldr x16, $entry */
BYTE br_x16[4]; /* br x16 */
DWORD ldr_x0; /* ldr x0, $dll */
DWORD ldr_x1; /* ldr x1, $name */
DWORD mov_x2_lr; /* mov x2, lr */
DWORD ldr_x16; /* ldr x16, $entry */
DWORD br_x16; /* br x16 */
const char *dll;
const char *name;
const void *entry;
@ -295,49 +295,22 @@ static ULONG_PTR allocate_stub( const char *dll, const char *name )
stub->call = 0xe8; /* call stub_entry_point */
stub->entry = (BYTE *)stub_entry_point - (BYTE *)(&stub->entry + 1);
#elif defined(__arm__)
stub->ldr_r0[0] = 0x08; /* ldr r0, [pc, #8] ($dll) */
stub->ldr_r0[1] = 0x00;
stub->ldr_r0[2] = 0x9f;
stub->ldr_r0[3] = 0xe5;
stub->ldr_r1[0] = 0x08; /* ldr r1, [pc, #8] ($name) */
stub->ldr_r1[1] = 0x10;
stub->ldr_r1[2] = 0x9f;
stub->ldr_r1[3] = 0xe5;
stub->mov_r2_lr[0] = 0x0e; /* mov r2, lr */
stub->mov_r2_lr[1] = 0x20;
stub->mov_r2_lr[2] = 0xa0;
stub->mov_r2_lr[3] = 0xe1;
stub->ldr_pc_pc[0] = 0x04; /* ldr pc, [pc, #4] */
stub->ldr_pc_pc[1] = 0xf0;
stub->ldr_pc_pc[2] = 0x9f;
stub->ldr_pc_pc[3] = 0xe5;
stub->dll = dll;
stub->name = name;
stub->entry = stub_entry_point;
stub->ldr_r0 = 0xe59f0008; /* ldr r0, [pc, #8] ($dll) */
stub->ldr_r1 = 0xe59f1008; /* ldr r1, [pc, #8] ($name) */
stub->mov_r2_lr = 0xe1a0200e; /* mov r2, lr */
stub->ldr_pc_pc = 0xe59ff004; /* ldr pc, [pc, #4] */
stub->dll = dll;
stub->name = name;
stub->entry = stub_entry_point;
#elif defined(__aarch64__)
stub->ldr_x0[0] = 0xa0; /* ldr x0, #20 ($dll) */
stub->ldr_x0[1] = 0x00;
stub->ldr_x0[2] = 0x00;
stub->ldr_x0[3] = 0x58;
stub->ldr_x1[0] = 0xc1; /* ldr x1, #24 ($name) */
stub->ldr_x1[1] = 0x00;
stub->ldr_x1[2] = 0x00;
stub->ldr_x1[3] = 0x58;
stub->mov_x2_lr[0] = 0xe2; /* mov x2, lr */
stub->mov_x2_lr[1] = 0x03;
stub->mov_x2_lr[2] = 0x1e;
stub->mov_x2_lr[3] = 0xaa;
stub->ldr_x16[0] = 0xd0; /* ldr x16, #24 ($entry) */
stub->ldr_x16[1] = 0x00;
stub->ldr_x16[2] = 0x00;
stub->ldr_x16[3] = 0x58;
stub->br_x16[0] = 0x00; /* br x16 */
stub->br_x16[1] = 0x02;
stub->br_x16[2] = 0x1f;
stub->br_x16[3] = 0xd6;
stub->dll = dll;
stub->name = name;
stub->entry = stub_entry_point;
stub->ldr_x0 = 0x580000a0; /* ldr x0, #20 ($dll) */
stub->ldr_x1 = 0x580000c1; /* ldr x1, #24 ($name) */
stub->mov_x2_lr = 0xaa1e03e2; /* mov x2, lr */
stub->ldr_x16 = 0x580000d0; /* ldr x16, #24 ($entry) */
stub->br_x16 = 0xd61f0200; /* br x16 */
stub->dll = dll;
stub->name = name;
stub->entry = stub_entry_point;
#else
stub->movq_rdi[0] = 0x48; /* movq $dll,%rdi */
stub->movq_rdi[1] = 0xbf;