mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-29 15:51:02 +00:00
Implement some syscalls
This commit is contained in:
@@ -42,6 +42,34 @@ public:
|
||||
return this->uc_;
|
||||
}
|
||||
|
||||
template <typename T = uint64_t>
|
||||
T reg(const int regid) const
|
||||
{
|
||||
T value{};
|
||||
e(uc_reg_read(this->uc_, regid, &value));
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T = uint64_t>
|
||||
void reg(const int regid, const T& value) const
|
||||
{
|
||||
e(uc_reg_write(this->uc_, regid, &value));
|
||||
}
|
||||
|
||||
void stop() const
|
||||
{
|
||||
e(uc_emu_stop(this->uc_));
|
||||
}
|
||||
|
||||
uint64_t read_stack(const size_t index) const
|
||||
{
|
||||
uint64_t result{};
|
||||
const auto rsp = this->reg(UC_X86_REG_RSP);
|
||||
|
||||
e(uc_mem_read(this->uc_, rsp + (index * sizeof(result)), &result, sizeof(result)));
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
uc_engine* uc_{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user