00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 # include "incls/_precompiled.incl"
00025 # include "incls/_nativeInstruction.cpp.incl"
00026
00027
00028
00029
00030 void NativeCall::verify() {
00031
00032 if (*(u_char*)instruction_address() != instruction_code) fatal("not a call imm32");
00033 }
00034
00035
00036 void NativeCall::print() {
00037 std->print_cr("0x%x: call 0x%x", instruction_address(), destination());
00038 }
00039
00040 NativeCall* nativeCall_at(char* address) {
00041 NativeCall* call = (NativeCall*)(address - NativeCall::instruction_offset);
00042 #ifdef ASSERT
00043 call->verify();
00044 #endif
00045 return call;
00046 }
00047
00048 NativeCall* nativeCall_from_return_address(char* return_address) {
00049 NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
00050 #ifdef ASSERT
00051 call->verify();
00052 #endif
00053 return call;
00054 }
00055
00056 NativeCall* nativeCall_from_relocInfo(char* displacement_address) {
00057 NativeCall* call = (NativeCall*)(displacement_address - NativeCall::displacement_offset);
00058 #ifdef ASSERT
00059 call->verify();
00060 #endif
00061 return call;
00062 }
00063
00064
00065 void NativeMov::verify() {
00066
00067 if (*(u_char*)instruction_address() & !register_mask != instruction_code) fatal("not a mov reg, imm32");
00068 }
00069
00070
00071 void NativeMov::print() {
00072 std->print_cr("0x%x: mov reg, 0x%x", instruction_address(), data());
00073 }
00074
00075 NativeMov* nativeMov_at(char* address) {
00076 NativeMov* test = (NativeMov*)(address - NativeMov::instruction_offset);
00077 #ifdef ASSERT
00078 test->verify();
00079 #endif
00080 return test;
00081 }
00082
00083
00084
00085
00086 void NativeTest::verify() {
00087
00088 if (*(u_char*)instruction_address() != instruction_code) fatal("not a test eax, imm32");
00089 }
00090
00091
00092 void NativeTest::print() {
00093 std->print_cr("0x%x: test eax, 0x%x", instruction_address(), data());
00094 }
00095
00096 NativeTest* nativeTest_at(char* address)
00097 {
00098 NativeTest* test = (NativeTest*)(address - NativeTest::instruction_offset);
00099 #ifdef ASSERT
00100 test->verify();
00101 #endif
00102 return test;
00103 }
00104
00105 IC_Info* ic_info_at(char* address)
00106 {
00107 return (IC_Info*)nativeTest_at(address);
00108 }