1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:05:07 +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:
Gunnar Beutner 2021-06-23 21:54:41 +02:00 committed by Andreas Kling
parent f2eb759901
commit 38fca26f54
21 changed files with 295 additions and 40 deletions

View file

@ -20,6 +20,7 @@
#include <Kernel/KBufferBuilder.h>
#include <Kernel/KSyms.h>
#include <Kernel/Module.h>
#include <Kernel/Panic.h>
#include <Kernel/PerformanceEventBuffer.h>
#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
@ -179,8 +180,14 @@ RefPtr<Process> Process::create_kernel_process(RefPtr<Thread>& first_thread, Str
auto process = Process::create(first_thread, move(name), (uid_t)0, (gid_t)0, ProcessID(0), true);
if (!first_thread || !process)
return {};
#if ARCH(I386)
first_thread->tss().eip = (FlatPtr)entry;
first_thread->tss().esp = FlatPtr(entry_data); // entry function argument is expected to be in tss.esp
#else
(void)entry;
(void)entry_data;
PANIC("Process::create_kernel_process() not implemented");
#endif
if (process->pid() != 0) {
process->ref();
@ -640,9 +647,15 @@ RefPtr<Thread> Process::create_kernel_thread(void (*entry)(void*), void* entry_d
if (!joinable)
thread->detach();
#if ARCH(I386)
auto& tss = thread->tss();
tss.eip = (FlatPtr)entry;
tss.esp = FlatPtr(entry_data); // entry function argument is expected to be in tss.esp
#else
(void)entry;
(void)entry_data;
PANIC("Process::create_kernel_thread() not implemented");
#endif
ScopedSpinLock lock(g_scheduler_lock);
thread->set_state(Thread::State::Runnable);