Bug 679397 - X64 branch patch code seems to be wrong for jmp 64bit, but is actually fine: comment needed. (r=edwsmith)
authorEdwin Smith <edwsmith@adobe.com>
Wed, 17 Aug 2011 16:11:36 -0400
changeset 6523 ecc1ce2a93efcd9e5753f7d2bd4e14bd4c946b18
parent 6522 d64e8c9b073101fb87bc929f0652f2fca20f679f
child 6524 3fd02dc07a270e4af669c1b6e37b1ab14a0da41a
push id3851
push userwmaddox@adobe.com
push dateThu, 18 Aug 2011 00:16:02 +0000
reviewersedwsmith
bugs679397
Bug 679397 - X64 branch patch code seems to be wrong for jmp 64bit, but is actually fine: comment needed. (r=edwsmith)
nanojit/NativeX64.cpp
--- a/nanojit/NativeX64.cpp
+++ b/nanojit/NativeX64.cpp
@@ -2020,16 +2020,17 @@ namespace nanojit
         if (patch[0] == 0xE9) {
             // jmp disp32
             next = patch+5;
         } else if (patch[0] == 0x0F && (patch[1] & 0xF0) == 0x80) {
             // jcc disp32
             next = patch+6;
         } else if ((patch[0] == 0xFF) && (patch[1] == 0x25)) {
             // jmp 64bit target
+            // This uses RIP-relative addressing, the 4 bytes after FF 25 is an offset of 0.
             next = patch+6;
             ((int64_t*)next)[0] = int64_t(target);
             return;
         } else {
             next = 0;
             TODO(unknown_patch);
         }
         // Guards can result in a valid branch being patched again later, so don't assert