src/cpu/x86/vm/relocInfo_x86.cpp

Print this page
rev 4739 : Remove breakpoint_Relocation.


 160   // All embedded Intel addresses are stored in 32-bit words.
 161   // Since the addr points at the start of the instruction,
 162   // we must parse the instruction a bit to find the embedded word.
 163   assert(is_data(), "must be a DataRelocation");
 164   typedef Assembler::WhichOperand WhichOperand;
 165   WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
 166   assert(which == Assembler::disp32_operand ||
 167          which == Assembler::call32_operand ||
 168          which == Assembler::imm_operand, "format unpacks ok");
 169   if (which != Assembler::imm_operand) {
 170     address ip = addr();
 171     address disp = Assembler::locate_operand(ip, which);
 172     address next_ip = Assembler::locate_next_instruction(ip);
 173     address a = next_ip + *(int32_t*) disp;
 174     return a;
 175   }
 176 #endif // AMD64
 177   return *pd_address_in_code();
 178 }
 179 
 180 int Relocation::pd_breakpoint_size() {
 181   // minimum breakpoint size, in short words
 182   return NativeIllegalInstruction::instruction_size / sizeof(short);
 183 }
 184 
 185 void Relocation::pd_swap_in_breakpoint(address x, short* instrs, int instrlen) {
 186   Untested("pd_swap_in_breakpoint");
 187   if (instrs != NULL) {
 188     assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data");
 189     for (int i = 0; i < instrlen; i++) {
 190       instrs[i] = ((short*)x)[i];
 191     }
 192   }
 193   NativeIllegalInstruction::insert(x);
 194 }
 195 
 196 
 197 void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) {
 198   Untested("pd_swap_out_breakpoint");
 199   assert(NativeIllegalInstruction::instruction_size == sizeof(short), "right address unit for update");
 200   NativeInstruction* ni = nativeInstruction_at(x);
 201   *(short*)ni->addr_at(0) = instrs[0];
 202 }
 203 
 204 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 205 #ifdef _LP64
 206   if (!Assembler::is_polling_page_far()) {
 207     typedef Assembler::WhichOperand WhichOperand;
 208     WhichOperand which = (WhichOperand) format();
 209     // This format is imm but it is really disp32
 210     which = Assembler::disp32_operand;
 211     address orig_addr = old_addr_for(addr(), src, dest);
 212     NativeInstruction* oni = nativeInstruction_at(orig_addr);
 213     int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
 214     // This poll_addr is incorrect by the size of the instruction it is irrelevant
 215     intptr_t poll_addr = (intptr_t)oni + *orig_disp;
 216 
 217     NativeInstruction* ni = nativeInstruction_at(addr());
 218     intptr_t new_disp = poll_addr - (intptr_t) ni;
 219 
 220     int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
 221     * disp = (int32_t)new_disp;
 222   }
 223 #endif // _LP64




 160   // All embedded Intel addresses are stored in 32-bit words.
 161   // Since the addr points at the start of the instruction,
 162   // we must parse the instruction a bit to find the embedded word.
 163   assert(is_data(), "must be a DataRelocation");
 164   typedef Assembler::WhichOperand WhichOperand;
 165   WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
 166   assert(which == Assembler::disp32_operand ||
 167          which == Assembler::call32_operand ||
 168          which == Assembler::imm_operand, "format unpacks ok");
 169   if (which != Assembler::imm_operand) {
 170     address ip = addr();
 171     address disp = Assembler::locate_operand(ip, which);
 172     address next_ip = Assembler::locate_next_instruction(ip);
 173     address a = next_ip + *(int32_t*) disp;
 174     return a;
 175   }
 176 #endif // AMD64
 177   return *pd_address_in_code();
 178 }
 179 
























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