mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
Kernel: Factor out setting Thread entry function
This adds ThreadRegisters::set_entry_function, and also implements it for aarch64.
This commit is contained in:
parent
a6f78b895f
commit
1da84c2a2c
Notes:
sideshowbarker
2024-07-17 02:28:02 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/1da84c2a2c Pull-request: https://github.com/SerenityOS/serenity/pull/16690 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/nico ✅
3 changed files with 13 additions and 9 deletions
|
@ -25,6 +25,12 @@ struct ThreadRegisters {
|
|||
{
|
||||
set_sp(kernel_stack_top);
|
||||
}
|
||||
|
||||
void set_entry_function(FlatPtr entry_ip, FlatPtr entry_data)
|
||||
{
|
||||
set_ip(entry_ip);
|
||||
x[0] = entry_data;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -73,6 +73,12 @@ struct ThreadRegisters {
|
|||
set_sp0(kernel_stack_top);
|
||||
}
|
||||
}
|
||||
|
||||
void set_entry_function(FlatPtr entry_ip, FlatPtr entry_data)
|
||||
{
|
||||
set_ip(entry_ip);
|
||||
rdi = entry_data; // entry function argument is expected to be in regs.rdi
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -273,15 +273,7 @@ LockRefPtr<Process> Process::create_kernel_process(LockRefPtr<Thread>& first_thr
|
|||
return {};
|
||||
auto process = process_or_error.release_value();
|
||||
|
||||
first_thread->regs().set_ip((FlatPtr)entry);
|
||||
#if ARCH(X86_64)
|
||||
first_thread->regs().rdi = FlatPtr(entry_data); // entry function argument is expected to be in regs.rdi
|
||||
#elif ARCH(AARCH64)
|
||||
(void)entry_data;
|
||||
TODO_AARCH64();
|
||||
#else
|
||||
# error Unknown architecture
|
||||
#endif
|
||||
first_thread->regs().set_entry_function((FlatPtr)entry, (FlatPtr)entry_data);
|
||||
|
||||
if (do_register == RegisterProcess::Yes)
|
||||
register_new(*process);
|
||||
|
|
Loading…
Add table
Reference in a new issue