mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Kernel: Push ARCH specific ifdef's down into RegisterState functions
The non CPU specific code of the kernel shouldn't need to deal with architecture specific registers, and should instead deal with an abstract view of the machine. This allows us to remove a variety of architecture specific ifdefs and helps keep the code slightly more portable. We do this by exposing the abstract representation of instruction pointer, stack pointer, base pointer, return register, etc on the RegisterState struct.
This commit is contained in:
parent
ff8429a749
commit
1cffecbe8d
Notes:
sideshowbarker
2024-07-18 08:46:10 +09:00
Author: https://github.com/bgianfo
Commit: 1cffecbe8d
Pull-request: https://github.com/SerenityOS/serenity/pull/8874
9 changed files with 119 additions and 97 deletions
|
@ -1028,16 +1028,12 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
|||
auto& regs = get_register_dump_from_stack();
|
||||
setup_stack(regs);
|
||||
auto signal_trampoline_addr = process.signal_trampoline().get();
|
||||
#if ARCH(I386)
|
||||
regs.eip = signal_trampoline_addr;
|
||||
#else
|
||||
regs.rip = signal_trampoline_addr;
|
||||
#endif
|
||||
regs.set_ip_reg(signal_trampoline_addr);
|
||||
|
||||
#if ARCH(I386)
|
||||
dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:08x} to deliver {}", state_string(), m_regs.cs, m_regs.eip, signal);
|
||||
dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:08x} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
|
||||
#else
|
||||
dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:16x} to deliver {}", state_string(), m_regs.cs, m_regs.rip, signal);
|
||||
dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:16x} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
|
||||
#endif
|
||||
|
||||
return DispatchSignalResult::Continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue