diff --git a/armProc/machine.cc b/armProc/machine.cc index d0940f2..4ab52c3 100644 --- a/armProc/machine.cc +++ b/armProc/machine.cc @@ -187,12 +187,22 @@ void machine::toggleBP(bool status){ breakpointStatus = status; } +void machine::toggleTLBPause(bool status){ + stopOnTLB = status; + MC_Holder::getInstance()->getConfig()->setStopOnTLBChange(status); + MC_Holder::getInstance()->getConfig()->Save(); +} + void machine::clearCause(){ stopCause = 0; } void machine::updateTLB(unsigned int index){ emit tlbChanged(index); + if(stopOnTLB){ + stopCause |= SC_UTLB_KERNEL; + stopRequested = true; + } } #endif //UARM_MACHINE_CC diff --git a/armProc/machine.h b/armProc/machine.h index 9757c3e..6edbdff 100644 --- a/armProc/machine.h +++ b/armProc/machine.h @@ -81,9 +81,11 @@ private slots: void run(); void reset(); void toggleBP(bool status); + void toggleTLBPause(bool status); private: bool breakpointStatus = true; + bool stopOnTLB = false; bool fullUIupdate = true; unsigned int refreshRate = 1; unsigned int ticksFromUpdate = 0; diff --git a/armProc/machine_config.cc b/armProc/machine_config.cc index e2e0e45..1ffe7b1 100644 --- a/armProc/machine_config.cc +++ b/armProc/machine_config.cc @@ -99,6 +99,8 @@ MachineConfig* MachineConfig::LoadFromFile(const std::string& fileName, std::str config->setRamSize(root->Get("num-ram-frames")->AsNumber()); if (root->HasMember("pause-on-exc")) config->setStopOnException(root->Get("pause-on-exc")->AsBool()); + if (root->HasMember("pause-on-tlb")) + config->setStopOnTLBChange(root->Get("pause-on-tlb")->AsBool()); if (root->HasMember("boot")) { JsonObject* bootOpt = root->Get("boot")->AsObject(); @@ -166,6 +168,7 @@ void MachineConfig::Save() root->Set("tlb-size", (int) getTLBSize()); root->Set("num-ram-frames", (int) getRamSize()); root->Set("pause-on-exc", getStopOnException()); + root->Set("pause-on-tlb", getStopOnTLBChange()); JsonObject* bootOpt = new JsonObject; bootOpt->Set("load-core-file", isLoadCoreEnabled()); @@ -267,6 +270,11 @@ void MachineConfig::setSymbolTableASID(Word asid) symbolTableASID = bumpProperty(MIN_ASID, asid, MAX_ASID); } +void MachineConfig::setStopOnTLBChange(bool value) +{ + stopOnTLBChange = value; +} + unsigned int MachineConfig::getDeviceType(unsigned int il, unsigned int devNo) const { assert(il < N_EXT_IL && devNo < N_DEV_PER_IL); @@ -331,6 +339,7 @@ void MachineConfig::resetToFactorySettings() setRamSize(DEFAULT_RAM_SIZE); setTLBSize(DEFAULT_TLB_SIZE); setStopOnException(DEFAULT_STOP_ON_EXCEPTION); + setStopOnTLBChange(DEFAULT_STOP_ON_TLB_CHANGE); // STATIC: this is a temp bios, there needs to be a more complete one.. setROM(ROM_TYPE_BIOS, "/usr/include/uarm/BIOS.rom.uarm"); diff --git a/armProc/machine_config.h b/armProc/machine_config.h index e5bb747..3aa2999 100644 --- a/armProc/machine_config.h +++ b/armProc/machine_config.h @@ -70,6 +70,7 @@ class MachineConfig { static const unsigned int DEFAULT_REFRESH_RATE = 70; static const bool DEFAULT_STOP_ON_EXCEPTION = false; + static const bool DEFAULT_STOP_ON_TLB_CHANGE = false; static const Word MIN_ASID = 0; static const Word MAX_ASID = MAXASID-1; @@ -106,6 +107,9 @@ class MachineConfig { void setTLBSize(Word size); Word getTLBSize() const { return tlbSize; } + void setStopOnTLBChange(bool value); + bool getStopOnTLBChange() const { return stopOnTLBChange; } + void setROM(ROMType type, const std::string& fileName); const std::string& getROM(ROMType type) const; @@ -133,6 +137,7 @@ class MachineConfig { bool loadCoreFile; bool stopOnException; + bool stopOnTLBChange; Word ramSize; unsigned int cpus; diff --git a/qarm/breakpoint_window.cc b/qarm/breakpoint_window.cc index 85e9baf..b60b4d8 100644 --- a/qarm/breakpoint_window.cc +++ b/qarm/breakpoint_window.cc @@ -40,6 +40,9 @@ breakpoint_window::breakpoint_window(machine *mac, QWidget * parent, Qt::WindowF QWidget *buttonsLeftW = new QWidget(buttonsW); QGridLayout *buttonsLeftL = new QGridLayout(buttonsLeftW); + QWidget *buttonsCenterW = new QWidget(buttonsW); + QGridLayout *buttonsCenterL = new QGridLayout(buttonsCenterW); + QWidget *buttonsRightW = new QWidget(buttonsW); QGridLayout *buttonsRightL = new QGridLayout(buttonsRightW); @@ -59,6 +62,13 @@ breakpoint_window::breakpoint_window(machine *mac, QWidget * parent, Qt::WindowF breakpointsActive = new QCheckBox("Stop on Breakpoint", buttonsW); connect(breakpointsActive, SIGNAL(toggled(bool)), mac, SLOT(toggleBP(bool))); breakpointsActive->setChecked(true); + buttonsCenterL->addWidget(breakpointsActive); + + breakOnTLB = new QCheckBox("Stop on TLB change", buttonsW); + connect(breakOnTLB, SIGNAL(toggled(bool)), mac, SLOT(toggleTLBPause(bool))); + breakOnTLB->setChecked(MC_Holder::getInstance()->getConfig()->getStopOnTLBChange()); + buttonsCenterL->addWidget(breakOnTLB); + buttonsCenterW->setLayout(buttonsCenterL); buttonsLeftL->addWidget(add, 0, 0); buttonsLeftL->addWidget(new QFLine(false), 1, 0); @@ -69,13 +79,11 @@ breakpoint_window::breakpoint_window(machine *mac, QWidget * parent, Qt::WindowF buttonsRightW->setLayout(buttonsRightL); buttonsL->addWidget(buttonsLeftW); - buttonsL->addWidget(breakpointsActive); + buttonsL->addWidget(buttonsCenterW); buttonsL->addWidget(buttonsRightW); buttonsW->setLayout(buttonsL); - //EDIT: setup buttons - breakpointView = new QTreeView; breakpointView->setRootIsDecorated(false); breakpointView->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/qarm/breakpoint_window.h b/qarm/breakpoint_window.h index 69ef177..75eaf6a 100644 --- a/qarm/breakpoint_window.h +++ b/qarm/breakpoint_window.h @@ -64,7 +64,7 @@ private slots: QToolButton *add, *remove; StoppointListModel *stoppointList; QTreeView *breakpointView; - QCheckBox *breakpointsActive; + QCheckBox *breakpointsActive, *breakOnTLB; SymbolTable *activeStab;