LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File hotspot-aarch64-fix-48bit-va.patch of Package jdk-bootstrap (Project home:nirdosh:jdk8)

# HG changeset patch
# User enevill
# Date 1454603068 0
#      Thu Feb 04 16:24:28 2016 +0000
# Node ID ded2073b67bdd9c9f2ae924397341b762329aaef
# Parent  f918c20107d9acb189498095308c2f49c8dbc84e
8148783: aarch64: SEGV running SpecJBB2013
Summary: Fix calculation of offset for adrp
Reviewed-by: aph

diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
--- a/openjdk/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp
+++ b/openjdk/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp
@@ -1632,7 +1632,10 @@ int MacroAssembler::pd_patch_instruction_size(address branch, address target) {
                      Instruction_aarch64::extract(insn2, 4, 0)) {
         // movk #imm16<<32
         Instruction_aarch64::patch(branch + 4, 20, 5, (uint64_t)target >> 32);
-        offset &= (1<<20)-1;
+        long dest = ((long)target & 0xffffffffL) | ((long)branch & 0xffff00000000L);
+        long pc_page = (long)branch >> 12;
+        long adr_page = (long)dest >> 12;
+        offset = adr_page - pc_page;
         instructions = 2;
       }
     }
@@ -4920,11 +4923,12 @@ void MacroAssembler::adrp(Register reg1, const Address &dest, unsigned long &byt
   if (offset_high >= -(1<<20) && offset_low < (1<<20)) {
     _adrp(reg1, dest.target());
   } else {
-    unsigned long pc_page = (unsigned long)pc() >> 12;
-    long offset = dest_page - pc_page;
-    offset = (offset & ((1<<20)-1)) << 12;
-    _adrp(reg1, pc()+offset);
-    movk(reg1, ((unsigned long)dest.target() >> 32), 32);
+    unsigned long source = (unsigned long)pc();
+    unsigned long target = (unsigned long)dest.target();
+    unsigned long adrp_target = (target & 0xffffffffUL) | (source & 0xffff00000000UL);
+
+    _adrp(reg1, (address)adrp_target);
+    movk(reg1, target >> 32, 32);
   }
   byte_offset = (unsigned long)dest.target() & 0xfff;
 }