MacroAssemblerARMv7.cpp [plain text]
#include "config.h"
#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
#include "MacroAssemblerARMv7.h"
namespace JSC {
#if ENABLE(MASM_PROBE)
#define INDENT printIndent(indentation)
void MacroAssemblerARMv7::printCPURegisters(CPUState& cpu, int indentation)
{
#define PRINT_GPREGISTER(_type, _regName) { \
int32_t value = reinterpret_cast<int32_t>(cpu._regName); \
INDENT, dataLogF("%5s: 0x%08x %d\n", #_regName, value, value) ; \
}
FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
#undef PRINT_GPREGISTER
#define PRINT_FPREGISTER(_type, _regName) { \
uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \
double* d = reinterpret_cast<double*>(&cpu._regName); \
INDENT, dataLogF("%5s: 0x%016llx %.13g\n", #_regName, *u, *d); \
}
FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
#undef PRINT_FPREGISTER
}
#undef INDENT
void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState& cpu, RegisterID regID)
{
const char* name = CPUState::registerName(regID);
union {
void* voidPtr;
intptr_t intptrValue;
} u;
u.voidPtr = cpu.registerValue(regID);
dataLogF("%s:<%p %ld>", name, u.voidPtr, u.intptrValue);
}
void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState& cpu, FPRegisterID regID)
{
const char* name = CPUState::registerName(regID);
union {
double doubleValue;
uint64_t uint64Value;
} u;
u.doubleValue = cpu.registerValue(regID);
dataLogF("%s:<0x%016llx %.13g>", name, u.uint64Value, u.doubleValue);
}
extern "C" void ctiMasmProbeTrampoline();
void MacroAssemblerARMv7::probe(MacroAssemblerARMv7::ProbeFunction function, void* arg1, void* arg2)
{
push(RegisterID::lr);
push(RegisterID::lr);
add32(TrustedImm32(8), RegisterID::sp, RegisterID::lr);
store32(RegisterID::lr, ArmAddress(RegisterID::sp, 4));
push(RegisterID::ip);
push(RegisterID::r0);
push(trustedImm32FromPtr(arg2));
push(trustedImm32FromPtr(arg1));
push(trustedImm32FromPtr(function));
move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::ip);
m_assembler.blx(RegisterID::ip);
}
#endif // ENABLE(MASM_PROBE)
}
#endif // ENABLE(ASSEMBLER)