Add register column to syscall help window
MODIFY
src/isa/isainfo.h
src/isa/isainfo.h
@@ -52,6 +52,8 @@ public:
virtual int spReg() const { return -1; } // Stack pointer
virtual int gpReg() const { return -1; } // Global pointer
virtual int syscallReg() const { return -1; } // Syscall function register
+ // Mapping between syscall argument # and the corresponding register # wherein that argument is passed.
+ virtual int syscallArgReg(unsigned argIdx) const { return -1; }
// GCC Compile command architecture and ABI specification strings
virtual QString CCmarch() const = 0;

MODIFY
src/isa/rvisainfo_common.h
src/isa/rvisainfo_common.h
@@ -99,6 +99,10 @@ public:
success = false;
return 0;
}
+ virtual int syscallArgReg(unsigned argIdx) const {
+ assert(argIdx < 8 && "RISC-V only implements argument registers a0-a7");
+ return argIdx + 10;
+ }
QString elfSupportsFlags(unsigned flags) const override {
/** We expect no flags for RV32IM compiled RISC-V executables.

MODIFY
src/syscall/file.h
src/syscall/file.h
@@ -132,7 +132,7 @@ class GetCWDSyscall : public BaseSyscall {
public:
GetCWDSyscall()
: BaseSyscall("GetCWD", "Writes the path of the current working directory into a buffer",
- {{0, "the buffer to write into"}, {1, "the length of the buffer"}},
+ {{0, "address of the buffer to write into"}, {1, "the length of the buffer"}},
{{0, "-1 if the path is longer than the buffer"}}) {}
void execute() {
const int byteAddress =

MODIFY
src/syscall/syscallviewer.cpp
src/syscall/syscallviewer.cpp
@@ -37,17 +37,17 @@ SyscallViewer::SyscallViewer(QWidget* parent) : QDialog(parent), m_ui(new Ui::Sy
connect(m_ui->syscallList, &QTableWidget::currentItemChanged, this, &SyscallViewer::handleItemChanged);
// Setup syscall argument styling
- m_ui->syscallArguments->setColumnCount(2);
+ m_ui->syscallArguments->setColumnCount(3);
m_ui->syscallArguments->setSelectionBehavior(QAbstractItemView::SelectRows);
m_ui->syscallArguments->horizontalHeader()->setStretchLastSection(true);
- m_ui->syscallArguments->setHorizontalHeaderLabels({"Arg. #", "Description"});
+ m_ui->syscallArguments->setHorizontalHeaderLabels({"Arg. #", "Reg.", "Description"});
m_ui->syscallArguments->verticalHeader()->hide();
// Setup syscall returns styling
- m_ui->syscallReturns->setColumnCount(2);
+ m_ui->syscallReturns->setColumnCount(3);
m_ui->syscallReturns->setSelectionBehavior(QAbstractItemView::SelectRows);
m_ui->syscallReturns->horizontalHeader()->setStretchLastSection(true);
- m_ui->syscallReturns->setHorizontalHeaderLabels({"Ret. #", "Description"});
+ m_ui->syscallReturns->setHorizontalHeaderLabels({"Ret. #", "Reg.", "Description"});
m_ui->syscallReturns->verticalHeader()->hide();
// Select first row to set the initial state
@@ -78,22 +78,32 @@ void SyscallViewer::setCurrentSyscall(const Syscall* syscall) {
for (const auto& iter : syscall->returnDescriptions()) {
addItemToTable(m_ui->syscallReturns, iter.first, iter.second);
}
+ m_ui->syscallArguments->resizeColumnToContents(0);
+ m_ui->syscallArguments->resizeColumnToContents(1);
+ m_ui->syscallReturns->resizeColumnToContents(0);
+ m_ui->syscallReturns->resizeColumnToContents(1);
}
void SyscallViewer::addItemToTable(QTableWidget* table, unsigned int idx, const QString& description) {
table->setRowCount(table->rowCount() + 1);
QTableWidgetItem* idxItem = new QTableWidgetItem();
+ QTableWidgetItem* regItem = new QTableWidgetItem();
QTableWidgetItem* textItem = new QTableWidgetItem();
+ auto* isa = ProcessorHandler::currentISA();
+
idxItem->setData(Qt::EditRole, QString::number(idx));
+ regItem->setData(Qt::EditRole, isa->regAlias(isa->syscallArgReg(idx)));
textItem->setData(Qt::DisplayRole, description);
idxItem->setFlags(idxItem->flags() ^ Qt::ItemIsEditable);
+ regItem->setFlags(idxItem->flags() ^ Qt::ItemIsEditable);
textItem->setFlags(textItem->flags() ^ Qt::ItemIsEditable);
const int row = table->rowCount() - 1;
table->setItem(row, 0, idxItem);
- table->setItem(row, 1, textItem);
+ table->setItem(row, 1, regItem);
+ table->setItem(row, 2, textItem);
}
void SyscallViewer::addSyscall(unsigned id, const Syscall* syscall) {

Add register column to syscall help window