Skip to content

Commit

Permalink
+ stop on tlb change implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
mellotanica committed Dec 1, 2014
1 parent ec46c02 commit ae1815a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
10 changes: 10 additions & 0 deletions armProc/machine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions armProc/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions armProc/machine_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions armProc/machine_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -133,6 +137,7 @@ class MachineConfig {

bool loadCoreFile;
bool stopOnException;
bool stopOnTLBChange;

Word ramSize;
unsigned int cpus;
Expand Down
14 changes: 11 additions & 3 deletions qarm/breakpoint_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion qarm/breakpoint_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private slots:
QToolButton *add, *remove;
StoppointListModel *stoppointList;
QTreeView *breakpointView;
QCheckBox *breakpointsActive;
QCheckBox *breakpointsActive, *breakOnTLB;

SymbolTable *activeStab;

Expand Down

0 comments on commit ae1815a

Please sign in to comment.