Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
#include <compat/cloudabi64/cloudabi64_syscall.h> | #include <compat/cloudabi64/cloudabi64_syscall.h> | ||||
#include <compat/cloudabi64/cloudabi64_util.h> | #include <compat/cloudabi64/cloudabi64_util.h> | ||||
extern const char *cloudabi64_syscallnames[]; | extern const char *cloudabi64_syscallnames[]; | ||||
extern struct sysent cloudabi64_sysent[]; | extern struct sysent cloudabi64_sysent[]; | ||||
static int | static int | ||||
cloudabi64_fixup_tcb(register_t **stack_base, struct image_params *imgp) | cloudabi64_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) | ||||
{ | { | ||||
int error; | int error; | ||||
register_t tcbptr; | register_t tcbptr; | ||||
/* Place auxiliary vector and TCB on the stack. */ | /* Place auxiliary vector and TCB on the stack. */ | ||||
error = cloudabi64_fixup(stack_base, imgp); | error = cloudabi64_fixup(stack_base, imgp); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
/* | /* | ||||
* On x86-64, the TCB is referred to by %fs:0. Take some space | * On x86-64, the TCB is referred to by %fs:0. Take some space | ||||
* from the top of the stack to store a single element array, | * from the top of the stack to store a single element array, | ||||
* containing a pointer to the TCB. %fs base will point to this. | * containing a pointer to the TCB. %fs base will point to this. | ||||
*/ | */ | ||||
tcbptr = (register_t)*stack_base; | tcbptr = (register_t)*stack_base; | ||||
return (copyout(&tcbptr, --*stack_base, sizeof(tcbptr))); | *stack_base -= sizeof(tcbptr); | ||||
return (copyout(&tcbptr, (void *)*stack_base, sizeof(tcbptr))); | |||||
} | } | ||||
static void | static void | ||||
cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, | cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, | ||||
unsigned long stack) | uintptr_t stack) | ||||
{ | { | ||||
struct trapframe *regs; | struct trapframe *regs; | ||||
exec_setregs(td, imgp, stack); | exec_setregs(td, imgp, stack); | ||||
/* | /* | ||||
* The stack now contains a pointer to the TCB, the TCB itself, | * The stack now contains a pointer to the TCB, the TCB itself, | ||||
* and the auxiliary vector. Let %rdx point to the auxiliary | * and the auxiliary vector. Let %rdx point to the auxiliary | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |