arm64: Add userspace entry wiring.
Change-Id: I53ecd2208e1c29271f85396d01c63509705ee840 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5266 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <arch_cpu.h>
|
||||
#include <arch/thread.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <commpage_defs.h>
|
||||
#include <kernel.h>
|
||||
#include <thread.h>
|
||||
#include <tls.h>
|
||||
@@ -74,16 +75,41 @@ arch_thread_context_switch(Thread *from, Thread *to)
|
||||
_arch_context_swap(&from->arch_info, &to->arch_info);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_thread_dump_info(void *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
extern "C" void _eret_with_iframe(iframe *frame);
|
||||
|
||||
|
||||
status_t
|
||||
arch_thread_enter_userspace(Thread *thread, addr_t entry,
|
||||
void *arg1, void *arg2)
|
||||
{
|
||||
addr_t threadExitAddr;
|
||||
{
|
||||
addr_t commpageAdr = (addr_t)thread->team->commpage_address;
|
||||
status_t ret = user_memcpy(&threadExitAddr,
|
||||
&((addr_t*)commpageAdr)[COMMPAGE_ENTRY_ARM64_THREAD_EXIT],
|
||||
sizeof(threadExitAddr));
|
||||
ASSERT(ret == B_OK);
|
||||
threadExitAddr += commpageAdr;
|
||||
}
|
||||
|
||||
iframe frame;
|
||||
memset(&frame, 0, sizeof(frame));
|
||||
|
||||
frame.spsr = 0;
|
||||
frame.elr = entry;
|
||||
frame.x[0] = (uint64_t)arg1;
|
||||
frame.x[1] = (uint64_t)arg2;
|
||||
frame.lr = threadExitAddr;
|
||||
frame.sp = thread->user_stack_base + thread->user_stack_size;
|
||||
|
||||
_eret_with_iframe(&frame);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -99,6 +125,7 @@ status_t
|
||||
arch_setup_signal_frame(Thread *thread, struct sigaction *sa,
|
||||
struct signal_frame_data *signalFrameData)
|
||||
{
|
||||
panic("arch_setup_signal_frame");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -119,6 +146,7 @@ arch_check_syscall_restart(Thread *thread)
|
||||
void
|
||||
arch_store_fork_frame(struct arch_fork_arg *arg)
|
||||
{
|
||||
panic("arch_store_fork_frame");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user