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
commit 5b87904ab5
Notes: sideshowbarker 2024-07-19 00:52:06 +09:00
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);