mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
Everywhere: Make the codebase more architecture aware
This commit is contained in:
parent
6c4b5775e1
commit
97cc33ca47
22 changed files with 108 additions and 36 deletions
|
@ -169,8 +169,10 @@ NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current
|
|||
FlatPtr ip;
|
||||
#if ARCH(I386)
|
||||
ip = regs.eip;
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
ip = regs.rip;
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
if (ip - m_base_address < scope.address_low || ip - m_base_address >= scope.address_high)
|
||||
continue;
|
||||
|
|
|
@ -346,8 +346,10 @@ FlatPtr DebugSession::single_step()
|
|||
constexpr u32 TRAP_FLAG = 0x100;
|
||||
#if ARCH(I386)
|
||||
regs.eflags |= TRAP_FLAG;
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
regs.rflags |= TRAP_FLAG;
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
set_registers(regs);
|
||||
|
||||
|
@ -361,8 +363,10 @@ FlatPtr DebugSession::single_step()
|
|||
regs = get_registers();
|
||||
#if ARCH(I386)
|
||||
regs.eflags &= ~(TRAP_FLAG);
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
regs.rflags &= ~(TRAP_FLAG);
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
set_registers(regs);
|
||||
return regs.ip();
|
||||
|
|
|
@ -186,8 +186,10 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac
|
|||
|
||||
#if ARCH(I386)
|
||||
FlatPtr current_instruction = regs.eip;
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
FlatPtr current_instruction = regs.rip;
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
|
||||
auto debug_status = peek_debug(DEBUG_STATUS_REGISTER);
|
||||
|
@ -207,8 +209,10 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac
|
|||
|
||||
#if ARCH(I386)
|
||||
FlatPtr current_ebp = regs.ebp;
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
FlatPtr current_ebp = regs.rbp;
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
|
||||
do {
|
||||
|
@ -253,8 +257,10 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac
|
|||
auto breakpoint_addr = bit_cast<FlatPtr>(current_breakpoint.value().address);
|
||||
#if ARCH(I386)
|
||||
regs.eip = breakpoint_addr;
|
||||
#else
|
||||
#elif ARCH(X86_64)
|
||||
regs.rip = breakpoint_addr;
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
set_registers(regs);
|
||||
disable_breakpoint(current_breakpoint.value().address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue