Module: wine Branch: master Commit: 4eb2c5532d1225fce581ccd905e6e92c7752f9c9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4eb2c5532d1225fce581ccd905...
Author: Martin Storsjo martin@martin.st Date: Tue Aug 1 11:52:43 2017 +0300
ntdll: Simplify the arm version of a stub function.
Signed-off-by: Martin Storsjo martin@martin.st Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/loader.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 55470e6..76edd2a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -237,13 +237,11 @@ struct stub struct stub { BYTE ldr_r0[4]; /* ldr r0, $dll */ - BYTE mov_pc_pc1[4]; /* mov pc,pc */ - const char *dll; BYTE ldr_r1[4]; /* ldr r1, $name */ - BYTE mov_pc_pc2[4]; /* mov pc,pc */ - const char *name; BYTE mov_r2_lr[4]; /* mov r2, lr */ - BYTE ldr_pc_pc[4]; /* ldr pc, [pc, #-4] */ + BYTE ldr_pc_pc[4]; /* ldr pc, [pc, #4] */ + const char *dll; + const char *name; const void* entry; }; #elif defined(__aarch64__) @@ -303,32 +301,24 @@ 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] = 0x00; /* ldr r0, $dll */ + 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->mov_pc_pc1[0] = 0x0f; /* mov pc,pc */ - stub->mov_pc_pc1[1] = 0xf0; - stub->mov_pc_pc1[2] = 0xa0; - stub->mov_pc_pc1[3] = 0xe1; - stub->dll = dll; - stub->ldr_r1[0] = 0x00; /* ldr r1, $name */ + 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_pc_pc2[0] = 0x0f; /* mov pc,pc */ - stub->mov_pc_pc2[1] = 0xf0; - stub->mov_pc_pc2[2] = 0xa0; - stub->mov_pc_pc2[3] = 0xe1; - stub->name = name; 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[0] = 0x04; /* ldr pc, [pc, #4] */ stub->ldr_pc_pc[1] = 0xf0; - stub->ldr_pc_pc[2] = 0x1f; + stub->ldr_pc_pc[2] = 0x9f; stub->ldr_pc_pc[3] = 0xe5; + stub->dll = dll; + stub->name = name; stub->entry = stub_entry_point; #elif defined(__aarch64__) stub->ldr_x0[0] = 0xa0; /* ldr x0, #20 ($dll) */