ntdll: Respect the 8-bit part in the ARM relocation

André Hentschel nerv at dawncrow.de
Fri Apr 12 16:19:46 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33359
---
 dlls/ntdll/loader.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 271907f..9642f62 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2180,7 +2180,7 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count
         {
             DWORD inst = *(INT_PTR *)((char *)page + offset);
             DWORD imm16 = ((inst << 1) & 0x0800) + ((inst << 12) & 0xf000) +
-                          ((inst >> 20) & 0x0700) + ((inst >> 16) & 0x000f);
+                          ((inst >> 20) & 0x0700) + ((inst >> 16) & 0x00ff);
 
             if ((inst & 0x8000fbf0) != 0x0000f240)
                 ERR("wrong Thumb2 instruction %08x, expected MOVW\n", inst);
@@ -2191,13 +2191,13 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count
             *(INT_PTR *)((char *)page + offset) = (inst & 0x8f00fbf0) + ((imm16 >> 1) & 0x0400) +
                                                   ((imm16 >> 12) & 0x000f) +
                                                   ((imm16 << 20) & 0x70000000) +
-                                                  ((imm16 << 16) & 0x0f0000);
+                                                  ((imm16 << 16) & 0xff0000);
 
             if (delta > 0xffff)
             {
                 inst = *(INT_PTR *)((char *)page + offset + 4);
                 imm16 = ((inst << 1) & 0x0800) + ((inst << 12) & 0xf000) +
-                        ((inst >> 20) & 0x0700) + ((inst >> 16) & 0x000f);
+                        ((inst >> 20) & 0x0700) + ((inst >> 16) & 0x00ff);
 
                 if ((inst & 0x8000fbf0) != 0x0000f2c0)
                     ERR("wrong Thumb2 instruction %08x, expected MOVT\n", inst);
@@ -2209,7 +2209,7 @@ IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock( void *page, UINT count
                                                           ((imm16 >> 1) & 0x0400) +
                                                           ((imm16 >> 12) & 0x000f) +
                                                           ((imm16 << 20) & 0x70000000) +
-                                                          ((imm16 << 16) & 0x0f0000);
+                                                          ((imm16 << 16) & 0xff0000);
             }
         }
             break;
-- 
1.7.10.4



More information about the wine-patches mailing list