src/cpu/x86/vm/relocInfo_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot-comp Sdiff src/cpu/x86/vm

src/cpu/x86/vm/relocInfo_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 165   Untested("pd_swap_in_breakpoint");
 166   if (instrs != NULL) {
 167     assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data");
 168     for (int i = 0; i < instrlen; i++) {
 169       instrs[i] = ((short*)x)[i];
 170     }
 171   }
 172   NativeIllegalInstruction::insert(x);
 173 }
 174 
 175 
 176 void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) {
 177   Untested("pd_swap_out_breakpoint");
 178   assert(NativeIllegalInstruction::instruction_size == sizeof(short), "right address unit for update");
 179   NativeInstruction* ni = nativeInstruction_at(x);
 180   *(short*)ni->addr_at(0) = instrs[0];
 181 }
 182 
 183 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 184 #ifdef _LP64

 185   typedef Assembler::WhichOperand WhichOperand;
 186   WhichOperand which = (WhichOperand) format();
 187   // This format is imm but it is really disp32
 188   which = Assembler::disp32_operand;
 189   address orig_addr = old_addr_for(addr(), src, dest);
 190   NativeInstruction* oni = nativeInstruction_at(orig_addr);
 191   int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
 192   // This poll_addr is incorrect by the size of the instruction it is irrelevant
 193   intptr_t poll_addr = (intptr_t)oni + *orig_disp;
 194 
 195   NativeInstruction* ni = nativeInstruction_at(addr());
 196   intptr_t new_disp = poll_addr - (intptr_t) ni;
 197 
 198   int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
 199   * disp = (int32_t)new_disp;
 200 
 201 #endif // _LP64
 202 }
 203 
 204 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 205 #ifdef _LP64

 206   typedef Assembler::WhichOperand WhichOperand;
 207   WhichOperand which = (WhichOperand) format();
 208   // This format is imm but it is really disp32
 209   which = Assembler::disp32_operand;
 210   address orig_addr = old_addr_for(addr(), src, dest);
 211   NativeInstruction* oni = nativeInstruction_at(orig_addr);
 212   int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
 213   // This poll_addr is incorrect by the size of the instruction it is irrelevant
 214   intptr_t poll_addr = (intptr_t)oni + *orig_disp;
 215 
 216   NativeInstruction* ni = nativeInstruction_at(addr());
 217   intptr_t new_disp = poll_addr - (intptr_t) ni;
 218 
 219   int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
 220   * disp = (int32_t)new_disp;

 221 #endif // _LP64
 222 }
   1 /*
   2  * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 165   Untested("pd_swap_in_breakpoint");
 166   if (instrs != NULL) {
 167     assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data");
 168     for (int i = 0; i < instrlen; i++) {
 169       instrs[i] = ((short*)x)[i];
 170     }
 171   }
 172   NativeIllegalInstruction::insert(x);
 173 }
 174 
 175 
 176 void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) {
 177   Untested("pd_swap_out_breakpoint");
 178   assert(NativeIllegalInstruction::instruction_size == sizeof(short), "right address unit for update");
 179   NativeInstruction* ni = nativeInstruction_at(x);
 180   *(short*)ni->addr_at(0) = instrs[0];
 181 }
 182 
 183 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 184 #ifdef _LP64
 185   if (!Assembler::is_polling_page_far()) {
 186     typedef Assembler::WhichOperand WhichOperand;
 187     WhichOperand which = (WhichOperand) format();
 188     // This format is imm but it is really disp32
 189     which = Assembler::disp32_operand;
 190     address orig_addr = old_addr_for(addr(), src, dest);
 191     NativeInstruction* oni = nativeInstruction_at(orig_addr);
 192     int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
 193     // This poll_addr is incorrect by the size of the instruction it is irrelevant
 194     intptr_t poll_addr = (intptr_t)oni + *orig_disp;
 195 
 196     NativeInstruction* ni = nativeInstruction_at(addr());
 197     intptr_t new_disp = poll_addr - (intptr_t) ni;
 198 
 199     int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
 200     * disp = (int32_t)new_disp;
 201   }
 202 #endif // _LP64
 203 }
 204 
 205 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 206 #ifdef _LP64
 207   if (!Assembler::is_polling_page_far()) {
 208     typedef Assembler::WhichOperand WhichOperand;
 209     WhichOperand which = (WhichOperand) format();
 210     // This format is imm but it is really disp32
 211     which = Assembler::disp32_operand;
 212     address orig_addr = old_addr_for(addr(), src, dest);
 213     NativeInstruction* oni = nativeInstruction_at(orig_addr);
 214     int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
 215     // This poll_addr is incorrect by the size of the instruction it is irrelevant
 216     intptr_t poll_addr = (intptr_t)oni + *orig_disp;
 217 
 218     NativeInstruction* ni = nativeInstruction_at(addr());
 219     intptr_t new_disp = poll_addr - (intptr_t) ni;
 220 
 221     int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
 222     * disp = (int32_t)new_disp;
 223   }
 224 #endif // _LP64
 225 }
src/cpu/x86/vm/relocInfo_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File