thermosphere: fix software breakpoints

This commit is contained in:
TuxSH committed 2020-02-04 19:12:24 +00:00
1 parent 307d2361ff
commit 84ee01797a
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -58,7 +58,7 @@ static size_t findClosestSoftwareBreakpointSlot(uintptr_t address)
static inline bool doApplySoftwareBreakpoint(size_t id)
{
SoftwareBreakpoint *bp = &g_softwareBreakpointManager.breakpoints[id];
u32 brkInst = 0xF2000000 | bp->uid;
u32 brkInst = 0xD4200000 | (bp->uid << 5);
size_t sz = guestReadWriteMemory(bp->address, 4, &bp->savedInstruction, &brkInst);
bp->applied = sz == 4;
@@ -181,7 +181,7 @@ int addSoftwareBreakpoint(uintptr_t addr, bool persistent)
bp->address = addr;
bp->persistent = persistent;
bp->applied = false;
bp->uid = 0x2000 + g_softwareBreakpointManager.bpUniqueCounter++;
bp->uid = (u16)(0x2000 + g_softwareBreakpointManager.bpUniqueCounter++);
int rc = applySoftwareBreakpoint(id) ? 0 : -EFAULT;
recursiveSpinlockUnlock(&g_softwareBreakpointManager.lock);
+1 -1
View File
@@ -27,7 +27,7 @@
typedef struct SoftwareBreakpoint {
uintptr_t address; // VA
u32 savedInstruction;
u32 uid;
u16 uid;
bool persistent;
bool applied;
atomic_bool triedToApplyOrRevert;