#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysmacros.h>
#include <sys/signal.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/mman.h>
#include <sys/class.h>
#include <sys/proc.h>
#include <sys/procfs.h>
#include <sys/kmem.h>
#include <sys/cred.h>
#include <sys/archsystm.h>
#include <sys/contract_impl.h>
#include <sys/reboot.h>
#include <sys/uadmin.h>
#include <sys/vfs.h>
#include <sys/vnode.h>
#include <sys/session.h>
#include <sys/ucontext.h>
#include <sys/dnlc.h>
#include <sys/var.h>
#include <sys/cmn_err.h>
#include <sys/debug.h>
#include <sys/thread.h>
#include <sys/vtrace.h>
#include <sys/consdev.h>
#include <sys/frame.h>
#include <sys/stack.h>
#include <sys/swap.h>
#include <sys/vmparam.h>
#include <sys/cpuvar.h>
#include <sys/cpu.h>
#include <sys/privregs.h>
#include <vm/hat.h>
#include <vm/anon.h>
#include <vm/as.h>
#include <vm/page.h>
#include <vm/seg.h>
#include <vm/seg_kmem.h>
#include <vm/seg_map.h>
#include <vm/seg_vn.h>
#include <sys/exec.h>
#include <sys/acct.h>
#include <sys/corectl.h>
#include <sys/modctl.h>
#include <sys/tuneable.h>
#include <c2/audit.h>
#include <sys/trap.h>
#include <sys/sunddi.h>
#include <sys/bootconf.h>
#include <sys/memlist.h>
#include <sys/systeminfo.h>
#include <sys/promif.h>
int
check_boot_version(int boots_version)
{
if (boots_version == BO_VERSION)
return (0);
prom_printf("Wrong boot interface - kernel needs v%d found v%d\n",
BO_VERSION, boots_version);
prom_panic("halting");
}
void
kern_setup1(void)
{
proc_t *pp;
pp = &p0;
proc_sched = pp;
pp->p_stat = SRUN;
pp->p_flag = SSYS;
pp->p_pidp = &pid0;
pp->p_pgidp = &pid0;
pp->p_sessp = &session0;
pp->p_tlist = &t0;
pid0.pid_pglink = pp;
pid0.pid_pgtail = pp;
PTOU(curproc)->u_cmask = (mode_t)CMASK;
thread_init();
pid_init();
contract_init();
init_pages_pp_maximum();
}
void
thread_load(kthread_t *t, void (*start)(), caddr_t arg, size_t len)
{
struct rwindow *rwin;
caddr_t sp;
size_t framesz;
caddr_t argp;
extern void thread_start();
sp = t->t_stk;
if (len != 0) {
framesz = SA(len);
sp -= framesz;
ASSERT(sp > t->t_stkbase);
argp = sp + SA(MINFRAME);
bcopy(arg, argp, len);
arg = argp;
}
rwin = (struct rwindow *)sp;
rwin->rw_in[0] = (intptr_t)arg;
rwin->rw_in[1] = len;
rwin->rw_in[6] = 0;
rwin->rw_in[7] = (intptr_t)start;
t->t_pc = (uintptr_t)thread_start - 8;
t->t_sp = (uintptr_t)sp - STACK_BIAS;
}
#if !defined(lwp_getdatamodel)
model_t
lwp_getdatamodel(klwp_t *lwp)
{
return (lwp->lwp_procp->p_model);
}
#endif
#if !defined(get_udatamodel)
model_t
get_udatamodel(void)
{
return (curproc->p_model);
}
#endif