Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/powerpc64/gen/makecontext.c
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | for (i = 0; i < stackargs; i++) | ||||
*argp++ = va_arg(ap, uint64_t); | *argp++ = va_arg(ap, uint64_t); | ||||
} | } | ||||
va_end(ap); | va_end(ap); | ||||
/* | /* | ||||
* Use caller-saved regs 14/15 to hold params that _ctx_start | * Use caller-saved regs 14/15 to hold params that _ctx_start | ||||
* will use to invoke the user-supplied func | * will use to invoke the user-supplied func | ||||
*/ | */ | ||||
#if !defined(_CALL_ELF) || _CALL_ELF == 1 | |||||
/* Cast to ensure this is treated as a function descriptor. */ | |||||
mc->mc_srr0 = *(uintptr_t *)_ctx_start; | mc->mc_srr0 = *(uintptr_t *)_ctx_start; | ||||
#else | |||||
mc->mc_srr0 = (uintptr_t) _ctx_start; | |||||
#endif | |||||
mc->mc_gpr[1] = (uintptr_t) sp; /* new stack pointer */ | mc->mc_gpr[1] = (uintptr_t) sp; /* new stack pointer */ | ||||
mc->mc_gpr[14] = (uintptr_t) start; /* r14 <- start */ | mc->mc_gpr[14] = (uintptr_t) start; /* r14 <- start */ | ||||
mc->mc_gpr[15] = (uintptr_t) ucp; /* r15 <- ucp */ | mc->mc_gpr[15] = (uintptr_t) ucp; /* r15 <- ucp */ | ||||
} | } |