/*
- * Copyright (C) 2013 Apple Inc.
+ * Copyright (C) 2013, 2014 Apple Inc.
* Copyright (C) 2009 University of Szeged
* All rights reserved.
*
#include "MacroAssemblerARM.h"
-#if USE(MASM_PROBE)
-#include <wtf/StdLibExtras.h>
-#endif
-
#if OS(LINUX)
#include <sys/types.h>
#include <sys/stat.h>
{
#if OS(LINUX)
int fd = open("/proc/self/auxv", O_RDONLY);
- if (fd > 0) {
+ if (fd != -1) {
Elf32_auxv_t aux;
while (read(fd, &aux, sizeof(Elf32_auxv_t))) {
if (aux.a_type == AT_HWCAP) {
}
#endif // CPU(ARMV5_OR_LOWER)
-#if USE(MASM_PROBE)
+#if ENABLE(MASM_PROBE)
+
+#define INDENT printIndent(indentation)
-void MacroAssemblerARM::ProbeContext::dumpCPURegisters(const char* indentation)
+void MacroAssemblerARM::printCPURegisters(CPUState& cpu, int indentation)
{
- #define DUMP_GPREGISTER(_type, _regName) { \
+ #define PRINT_GPREGISTER(_type, _regName) { \
int32_t value = reinterpret_cast<int32_t>(cpu._regName); \
- dataLogF("%s %5s: 0x%08x %d\n", indentation, #_regName, value, value) ; \
+ INDENT, dataLogF("%5s: 0x%08x %d\n", #_regName, value, value) ; \
}
- FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER)
- FOR_EACH_CPU_SPECIAL_REGISTER(DUMP_GPREGISTER)
- #undef DUMP_GPREGISTER
+ FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
+ FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
+ #undef PRINT_GPREGISTER
- #define DUMP_FPREGISTER(_type, _regName) { \
- uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \
+ #define PRINT_FPREGISTER(_type, _regName) { \
+ uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \
double* d = reinterpret_cast<double*>(&cpu._regName); \
- dataLogF("%s %5s: 0x %08x %08x %12g\n", \
- indentation, #_regName, u[1], u[0], d[0]); \
+ INDENT, dataLogF("%5s: 0x%016llx %.13g\n", #_regName, *u, *d); \
}
- FOR_EACH_CPU_FPREGISTER(DUMP_FPREGISTER)
- #undef DUMP_FPREGISTER
+ FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
+ #undef PRINT_FPREGISTER
}
-void MacroAssemblerARM::ProbeContext::dump(const char* indentation)
-{
- if (!indentation)
- indentation = "";
-
- dataLogF("%sProbeContext %p {\n", indentation, this);
- dataLogF("%s probeFunction: %p\n", indentation, probeFunction);
- dataLogF("%s arg1: %p %llu\n", indentation, arg1, reinterpret_cast<int64_t>(arg1));
- dataLogF("%s arg2: %p %llu\n", indentation, arg2, reinterpret_cast<int64_t>(arg2));
- dataLogF("%s cpu: {\n", indentation);
+#undef INDENT
- dumpCPURegisters(indentation);
-
- dataLogF("%s }\n", indentation);
- dataLogF("%s}\n", indentation);
+void MacroAssemblerARM::printRegister(MacroAssemblerARM::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 MacroAssemblerARM::printRegister(MacroAssemblerARM::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();
// For details on "What code is emitted for the probe?" and "What values are in
-// the saved registers?", see comment for MacroAssemblerX86::probe() in
-// MacroAssemblerX86_64.h.
+// the saved registers?", see comment for MacroAssemblerX86Common::probe() in
+// MacroAssemblerX86Common.cpp.
void MacroAssemblerARM::probe(MacroAssemblerARM::ProbeFunction function, void* arg1, void* arg2)
{
m_assembler.blx(RegisterID::S0);
}
-#endif // USE(MASM_PROBE)
+#endif // ENABLE(MASM_PROBE)
} // namespace JSC