1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 00:57:43 +00:00

Kernel: Add ability to load interpreter instead of main program

When the main executable needs an interpreter, we load the requested
interpreter program, and pass to it an open file decsriptor to the main
executable via the auxiliary vector.

Note that we do not allocate a TLS region for the interpreter.
This commit is contained in:
Itamar 2020-10-10 12:13:21 +03:00 committed by Andreas Kling
parent 711c42e25e
commit 5b87904ab5
6 changed files with 219 additions and 151 deletions

View file

@ -1105,6 +1105,10 @@ Vector<FlatPtr> Thread::raw_backtrace(FlatPtr ebp, FlatPtr eip) const
KResult Thread::make_thread_specific_region(Badge<Process>)
{
// The process may not require a TLS region
if (!process().m_master_tls_region)
return KSuccess;
size_t thread_specific_region_alignment = max(process().m_master_tls_alignment, alignof(ThreadSpecificData));
m_thread_specific_region_size = align_up_to(process().m_master_tls_size, thread_specific_region_alignment) + sizeof(ThreadSpecificData);
auto* region = process().allocate_region({}, m_thread_specific_region_size, "Thread-specific", PROT_READ | PROT_WRITE, true);