Kernel: Fix get_register_dump_from_stack() after IRQ entry changes

I had to change the layout of RegisterDump a little bit to make the new
IRQ entry points work. This broke get_register_dump_from_stack() which
was expecting the RegisterDump to be badly aligned due to a goofy extra
16 bits which are no longer there.
This commit is contained in:
Andreas Kling 2019-12-15 17:58:53 +01:00
parent 063fef312e
commit 7a64f55c0f
Notes: sideshowbarker 2024-07-19 10:51:07 +09:00
2 changed files with 4 additions and 4 deletions

View File

@ -544,7 +544,7 @@ ShouldUnblockThread Thread::dispatch_signal(u8 signal)
// FIXME: This state is such a hack. It avoids trouble if 'current' is the process receiving a signal.
set_state(Skip1SchedulerPass);
} else {
auto& regs = get_RegisterDump_from_stack();
auto& regs = get_register_dump_from_stack();
u32* stack = &regs.esp_if_crossRing;
setup_stack(regs, stack);
regs.eip = g_return_to_ring3_from_signal_trampoline.get();
@ -571,12 +571,12 @@ void Thread::push_value_on_stack(u32 value)
*stack_ptr = value;
}
RegisterDump& Thread::get_RegisterDump_from_stack()
RegisterDump& Thread::get_register_dump_from_stack()
{
// The userspace registers should be stored at the top of the stack
// We have to subtract 2 because the processor decrements the kernel
// stack before pushing the args.
return *(RegisterDump*)(kernel_stack_top() - sizeof(RegisterDump) - 2);
return *(RegisterDump*)(kernel_stack_top() - sizeof(RegisterDump));
}
void Thread::make_userspace_stack_for_main_thread(Vector<String> arguments, Vector<String> environment)

View File

@ -241,7 +241,7 @@ public:
u32 frame_ptr() const { return m_tss.ebp; }
u32 stack_ptr() const { return m_tss.esp; }
RegisterDump& get_RegisterDump_from_stack();
RegisterDump& get_register_dump_from_stack();
u16 selector() const { return m_far_ptr.selector; }
TSS32& tss() { return m_tss; }