mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel: Add stubs for missing x86_64 functionality
This adds just enough stubs to make the kernel compile on x86_64. Obviously it won't do anything useful - in fact it won't even attempt to boot because Multiboot doesn't support ELF64 binaries - but it gets those compiler errors out of the way so more progress can be made getting all the missing functionality in place.
This commit is contained in:
parent
f2eb759901
commit
38fca26f54
Notes:
sideshowbarker
2024-07-18 11:35:51 +09:00
Author: https://github.com/gunnarbeutner
Commit: 38fca26f54
Pull-request: https://github.com/SerenityOS/serenity/pull/8225
21 changed files with 295 additions and 40 deletions
|
@ -86,6 +86,7 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
|
|||
reset_fpu_state();
|
||||
m_tss.iomapbase = sizeof(TSS32);
|
||||
|
||||
#if ARCH(I386)
|
||||
// Only IF is set when a process boots.
|
||||
m_tss.eflags = 0x0202;
|
||||
|
||||
|
@ -106,10 +107,14 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
|
|||
}
|
||||
|
||||
m_tss.cr3 = m_process->space().page_directory().cr3();
|
||||
#else
|
||||
PANIC("Thread::Thread() not implemented");
|
||||
#endif
|
||||
|
||||
m_kernel_stack_base = m_kernel_stack_region->vaddr().get();
|
||||
m_kernel_stack_top = m_kernel_stack_region->vaddr().offset(default_kernel_stack_size).get() & 0xfffffff8u;
|
||||
|
||||
#if ARCH(I386)
|
||||
if (m_process->is_kernel_process()) {
|
||||
m_tss.esp = m_tss.esp0 = m_kernel_stack_top;
|
||||
} else {
|
||||
|
@ -118,6 +123,9 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
|
|||
m_tss.ss0 = GDT_SELECTOR_DATA0;
|
||||
m_tss.esp0 = m_kernel_stack_top;
|
||||
}
|
||||
#else
|
||||
PANIC("Thread::Thread() not implemented");
|
||||
#endif
|
||||
|
||||
// We need to add another reference if we could successfully create
|
||||
// all the resources needed for this thread. The reason for this is that
|
||||
|
@ -801,12 +809,12 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
|||
FlatPtr old_esp = *stack;
|
||||
FlatPtr ret_eip = state.eip;
|
||||
FlatPtr ret_eflags = state.eflags;
|
||||
|
||||
dbgln_if(SIGNAL_DEBUG, "Setting up user stack to return to EIP {:p}, ESP {:p}", ret_eip, old_esp);
|
||||
#elif ARCH(X86_64)
|
||||
FlatPtr* stack = &state.userspace_esp;
|
||||
#endif
|
||||
|
||||
dbgln_if(SIGNAL_DEBUG, "Setting up user stack to return to EIP {:p}, ESP {:p}", ret_eip, old_esp);
|
||||
|
||||
#if ARCH(I386)
|
||||
// Align the stack to 16 bytes.
|
||||
// Note that we push 56 bytes (4 * 14) on to the stack,
|
||||
|
@ -826,8 +834,9 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
|||
push_value_on_user_stack(stack, state.esi);
|
||||
push_value_on_user_stack(stack, state.edi);
|
||||
|
||||
#elif ARCH(X86_64)
|
||||
#else
|
||||
// FIXME
|
||||
PANIC("Thread:dispatch_signal() not implemented");
|
||||
#endif
|
||||
|
||||
// PUSH old_signal_mask
|
||||
|
@ -848,7 +857,12 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
|||
setup_stack(regs);
|
||||
regs.eip = process.signal_trampoline().get();
|
||||
|
||||
#if ARCH(I386)
|
||||
dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:08x} to deliver {}", state_string(), m_tss.cs, m_tss.eip, signal);
|
||||
#else
|
||||
PANIC("Thread:dispatch_signal() not implemented");
|
||||
#endif
|
||||
|
||||
return DispatchSignalResult::Continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue