CPUDyntransComponent.cc Source File
Back to the index.
Go to the documentation of this file.
43 void CPUDyntransComponent::DyntransInit()
54 while (pageShift < 32 && (1 << pageShift) !=
m_pageSize)
57 if (pageShift >= 32) {
58 std::cerr <<
"Non-power-of-2 page size?\n";
59 throw std::exception();
97 std::cerr <<
"Internal error: m_nextIC or m_firstIConPage is NULL.\n";
98 throw std::exception();
102 if (nrOfCycles != 1) {
103 std::cerr <<
"Internal error: Single stepping,"
104 " but nrOfCycles = " << nrOfCycles <<
".\n";
105 throw std::exception();
120 #define IC ic = m_nextIC ++; ic->f(this, ic);
141 const int ICsPerLoop = 60;
142 const int maxICcycles = 2;
143 if (nrOfCycles > ICsPerLoop * maxICcycles) {
144 int hazard = nrOfCycles - ICsPerLoop * maxICcycles;
175 if (m_executedCycles<nrOfCycles && m_nextIC->
f != instr_abort) {
192 void CPUDyntransComponent::DyntransClearICPage(
struct DyntransIC* icpage)
210 struct DyntransIC *CPUDyntransComponent::DyntransGetICPage(uint64_t
addr)
226 DyntransClearICPage(icpage);
237 std::cerr <<
"TODO: Already aborted, let's not update m_nextIC."
238 " Is this correct behavior?\n";
288 std::cerr <<
"TODO: DyntransResyncPC: Second end-of-page slot.\n";
290 throw std::exception();
293 std::cerr <<
"TODO: DyntransResyncPC: next ic outside of page?!\n";
294 throw std::exception();
324 ss.flags(std::ios::hex);
326 <<
" could not be read!";
348 ss.flags(std::ios::hex);
350 <<
" could not be read!";
364 if (
ic->f == NULL ||
ic->f == instr_abort) {
378 ss.flags(std::ios::hex);
379 ss <<
"instruction translation failed";
385 if (!isSingleStepping) {
416 if (singleInstructionLeft && !abort) {
420 if (ds && !dsExceptionOrAbort) {
453 -- cpubase->m_executedCycles;
456 if (cpubase->m_inDelaySlot)
457 cpubase->m_exceptionOrAbortInDelaySlot =
true;
459 cpubase->m_nextIC =
ic;
465 std::cerr <<
"TODO: endOfPage\n";
466 throw std::exception();
472 std::cerr <<
"TODO: endOfPage2\n";
473 throw std::exception();
496 REG64(
ic->arg[0]) = (int32_t)
ic->arg[1].u32;
548 REG64(
ic->arg[0]) = (int32_t) (
REG64(
ic->arg[1]) + (int32_t)
ic->arg[2].u32);
762 REG64(
ic->arg[0]) = (int32_t)(
REG64(
ic->arg[1]) << (
ic->arg[2].u32 & 0x1f));
777 REG64(
ic->arg[0]) = (int32_t)(((uint32_t)
REG64(
ic->arg[1])) >> (
ic->arg[2].u32 & 0x1f));
788 static void Test_CPUDyntransComponent_Dyntrans_PreReq()
795 UNITTEST(Test_CPUDyntransComponent_Dyntrans_PreReq);
virtual int Execute(GXemul *gxemul, int nrOfCycles)
Execute one or more cycles.
void f(int s, int func, int only_name)
SymbolRegistry & GetSymbolRegistry()
Gets a reference to the CPU's symbol registry.
#define N_DYNTRANS_IC_ARGS
uint64_t Unassemble(int nRows, bool indicatePC, uint64_t vaddr, ostream &output)
struct DyntransIC * m_firstIConPage
#define UNITTESTS(class)
Helper for unit test case execution.
struct DyntransIC * m_nextIC
UI * GetUI()
Gets an UI reference for outputting debug messages during runtime.
A base-class for processors Component implementations that use dynamic translation.
#define UNITTEST(functionname)
Helper for unit test case execution.
Base class for a User Interface.
DyntransTranslationCache m_translationCache
static void Assert(const string &strFailMessage, bool condition)
Asserts that a boolean condition is correct.
void DyntransResyncPC()
Calculate m_pc based on m_nextIC and m_firstIConPage.
virtual void ShowDebugMessage(const string &msg)=0
Shows a debug message.
struct arm_instr_call * ic
void DyntransPCtoPointers()
Calculate m_nextIC and m_firstIConPage, based on m_pc.
string LookupAddress(uint64_t vaddr, bool allowOffset) const
Looks up an address.
struct DyntransIC m_abortIC
virtual DyntransIC_t GetDyntransToBeTranslated()=0
RunState GetRunState() const
Gets the current RunState.
DYNTRANS_INSTR(CPUDyntransComponent, nop)
void COMBINE() nop(struct cpu *cpu, struct mips_instr_call *ic, int low_addr)
void SetQuietMode(bool quietMode)
Sets whether or not to run in quiet mode.
UI * GetUI()
Gets a pointer to the GXemul instance' active UI.
bool DyntransReadInstruction(uint16_t &iword, int offset=0)
virtual bool ReadData(uint8_t &data, Endianness endianness)
Reads 8-bit data from the currently selected address.
virtual int GetDyntransICshift() const =0
#define DYNTRANS_PAGE_NSPECIALENTRIES
void DyntransToBeTranslatedDone(struct DyntransIC *)
CPUDyntransComponent(const string &className, const string &cpuKind)
Constructs a CPUDyntransComponent.
void(* DyntransIC_t)(class CPUDyntransComponent *, struct DyntransIC *)
virtual uint64_t PCtoInstructionAddress(uint64_t pc)
Convert PC value to instuction address.
bool m_showFunctionTraceCall
int m_nrOfCyclesToExecute
int m_dyntransICentriesPerPage
uint64_t m_delaySlotTarget
bool m_exceptionOrAbortInDelaySlot
virtual void AddressSelect(uint64_t address)
Place an address on the bus.
GXemul * GetRunningGXemulInstance()
Returns a reference to the current GXemul instance.
A base-class for processors Component implementations.
void DyntransToBeTranslatedBegin(struct DyntransIC *)
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18