WindCore/emubase.cpp
WindCore/decoder.c
WindCore/decoder-arm.c
+ WindCore/logger.cpp
WindCore/osaris/clps7111.cpp
WindCore/osaris/clps7600.cpp
WindCore/series5mx/etna.cpp
#include "arm710.h"
#include "common.h"
+#include "logger.h"
// this will need changing if this code ever compiles on big-endian procs
inline uint32_t read32LE(uint8_t* p) { return *((uint32_t*)p); }
}
uint32_t ARM710::tick() {
+ uint32_t pc = getGPR(15) - 0x8;
+ setPC(pc);
+
// pop an instruction off the end of the pipeline
bool haveInsn = false;
uint32_t insn;
--- /dev/null
+#include "logger.h"
+
+static uint64_t sEventNumber = 0;
+
+uint64_t getNextEventNumber() {
+ return sEventNumber++;
+}
+
+uint64_t getEventNumber() {
+ return sEventNumber;
+}
+
+static uint32_t sCurrentPC = 0;
+
+void setPC(uint32_t pc) {
+ sCurrentPC = pc;
+}
+uint32_t getPC() {
+ return sCurrentPC;
+}
--- /dev/null
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include <stdint.h>
+#include <stdio.h>
+
+uint64_t getNextEventNumber();
+uint64_t getEventNumber();
+
+void setPC(uint32_t);
+uint32_t getPC();
+
+#define LOGGING_ENABLE 0
+
+#if LOGGING_ENABLE
+#define LOG_REG_W(name, addr, value) \
+ printf("%llu: (%08x) [W] %s [%08x] <= %08x\n", getNextEventNumber(), \
+ getPC(), name, addr, value)
+
+#define LOG_REG_R(name, addr, value) \
+ printf("%llu: (%08x) [R] %s [%08x] => %08x\n", getNextEventNumber(), \
+ getPC(), name, addr, value)
+
+#define LOG(...) printf(__VA_ARGS__)
+#else
+#define LOG_REG_W(name, addr, value) \
+ do { \
+ { \
+ } \
+ } while (0)
+#define LOG_REG_R(name, addr, value) \
+ do { \
+ { \
+ } \
+ } while (0)
+#define LOG(...)
+#endif
+
+#endif // LOGGER_H