Another minor code clean up, because I'm dumb

This commit is contained in:
Starlet Leonhart 2019-07-02 17:51:34 -04:00
parent f10e4463fe
commit be79abd213
2 changed files with 4 additions and 3 deletions

View File

@ -26,14 +26,14 @@ namespace core::memory {
// TODO: Boundary checks // TODO: Boundary checks
void Write(void* data, uint64_t offset, size_t size) { std::memcpy((void*)(offset), data, size); } void Write(void* data, uint64_t offset, size_t size) { std::memcpy((void*)(offset), data, size); }
void WriteU8 (uint8_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 1); } void WriteU8(uint8_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 1); }
void WriteU16(uint16_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 2); } void WriteU16(uint16_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 2); }
void WriteU32(uint32_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 4); } void WriteU32(uint32_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 4); }
void WriteU64(uint64_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 8); } void WriteU64(uint64_t value, uint64_t offset) { Write(reinterpret_cast<void*>(&value), offset, 8); }
void Read(void* destination, uint64_t offset, size_t size) { std::memcpy(destination, (void*)(offset), size); } void Read(void* destination, uint64_t offset, size_t size) { std::memcpy(destination, (void*)(offset), size); }
uint8_t ReadU8 (uint64_t offset) { uint8_t value; Read(reinterpret_cast<void*>(&value), offset, 1); return value; } uint8_t ReadU8(uint64_t offset) { uint8_t value; Read(reinterpret_cast<void*>(&value), offset, 1); return value; }
uint16_t ReadU16(uint64_t offset) { uint16_t value; Read(reinterpret_cast<void*>(&value), offset, 2); return value; } uint16_t ReadU16(uint64_t offset) { uint16_t value; Read(reinterpret_cast<void*>(&value), offset, 2); return value; }
uint32_t ReadU32(uint64_t offset) { uint32_t value; Read(reinterpret_cast<void*>(&value), offset, 4); return value; } uint32_t ReadU32(uint64_t offset) { uint32_t value; Read(reinterpret_cast<void*>(&value), offset, 4); return value; }
uint64_t ReadU64(uint64_t offset) { uint64_t value; Read(reinterpret_cast<void*>(&value), offset, 8); return value; } uint64_t ReadU64(uint64_t offset) { uint64_t value; Read(reinterpret_cast<void*>(&value), offset, 8); return value; }

View File

@ -168,7 +168,8 @@ namespace core::kernel {
{ {
std::pair<int, uint32_t(*)()>* result = &(svcTable[svc]); std::pair<int, uint32_t(*)()>* result = &(svcTable[svc]);
if (result->second) { if (result->second)
{
uint32_t returnCode = result->second(); uint32_t returnCode = result->second();
SetRegister(UC_ARM64_REG_W0, returnCode); SetRegister(UC_ARM64_REG_W0, returnCode);
return returnCode; return returnCode;