Lines Matching defs:lwp
302 * load user registers into lwp.
306 lwp_load(klwp_t *lwp, gregset_t grp, uintptr_t thrptr)
308 struct regs *rp = lwptoregs(lwp);
310 setgregs(lwp, grp);
319 * For 32-bit lwps, libc wedges its lwp thread pointer into the
327 if (lwp_getdatamodel(lwp) == DATAMODEL_ILP32) {
329 (void) lwp_setprivate(lwp, _LWP_GSBASE, thrptr);
335 * every new (not main) lwp created. For 64 bit processes
349 (void) lwp_setprivate(lwp, _LWP_FSBASE,
353 (void) lwp_setprivate(lwp, _LWP_GSBASE,
358 (void) lwp_setprivate(lwp, _LWP_GSBASE, thrptr);
361 lwp->lwp_eosys = JUSTRETURN;
362 lwptot(lwp)->t_post_sys = 1;
366 * set syscall()'s return values for a lwp.
369 lwp_setrval(klwp_t *lwp, int v1, int v2)
371 lwptoregs(lwp)->r_ps &= ~PS_C;
372 lwptoregs(lwp)->r_r0 = v1;
373 lwptoregs(lwp)->r_r1 = v2;
377 * set syscall()'s return values for a lwp.
380 lwp_setsp(klwp_t *lwp, caddr_t sp)
382 lwptoregs(lwp)->r_sp = (intptr_t)sp;
389 lwp_forkregs(klwp_t *lwp, klwp_t *clwp)
393 struct regs *rp = lwptoregs(lwp);
406 bcopy(lwp->lwp_regs, clwp->lwp_regs, sizeof (struct regs));
414 lwp_freeregs(klwp_t *lwp, int isexec)
431 * segment registers into the lwp's reg structure. This includes
435 * Here we save the current values from the lwp regs into the pcb
438 * This ensures the lwp's next trip to user land via update_sregs.
459 lwp_segregs_save(klwp_t *lwp)
462 pcb_t *pcb = &lwp->lwp_pcb;
469 rp = lwptoregs(lwp);
473 * %ds/%es/%fs/%gs values from lwp's regs in case the user
483 lwp->lwp_thread->t_post_sys = 1;
488 ASSERT(bcmp(&CPU->cpu_gdt[GDT_LWPFS], &lwp->lwp_pcb.pcb_fsdesc,
489 sizeof (lwp->lwp_pcb.pcb_fsdesc)) == 0);
490 ASSERT(bcmp(&CPU->cpu_gdt[GDT_LWPGS], &lwp->lwp_pcb.pcb_gsdesc,
491 sizeof (lwp->lwp_pcb.pcb_gsdesc)) == 0);
509 update_sregs(struct regs *rp, klwp_t *lwp)
511 pcb_t *pcb = &lwp->lwp_pcb;
679 * 64-bit user code descriptors. That way if a user lwp attempts
702 * Restore lwp private fs and gs segment descriptors
706 lwp_segregs_restore(klwp_t *lwp)
708 pcb_t *pcb = &lwp->lwp_pcb;
725 lwp_segregs_restore32(klwp_t *lwp)
729 pcb_t *pcb = &lwp->lwp_pcb;
731 ASSERT(VALID_LWP_DESC(&lwp->lwp_pcb.pcb_fsdesc));
732 ASSERT(VALID_LWP_DESC(&lwp->lwp_pcb.pcb_gsdesc));
744 * routine must be called when a new lwp is created within a branded zone
745 * or when an existing lwp moves into a branded zone via a zone_enter()
749 lwp_attach_brand_hdlrs(klwp_t *lwp)
751 kthread_t *t = lwptot(lwp);
753 ASSERT(PROC_IS_BRANDED(lwptoproc(lwp)));
772 * lwp in a process is exiting in proc_exit().
775 lwp_detach_brand_hdlrs(klwp_t *lwp)
777 kthread_t *t = lwptot(lwp);
779 ASSERT(PROC_IS_BRANDED(lwptoproc(lwp)));
796 * Add any lwp-associated context handlers to the lwp at the beginning
797 * of the lwp's useful life.
799 * All paths which create lwp's invoke lwp_create(); lwp_create()
803 * All paths which destroy lwp's invoke lwp_exit() to rip the lwp
804 * apart and put it on 'lwp_deathrow'; if the lwp is destroyed it
806 * invoking lwp_stk_fini(). When the lwp is recycled from death
810 * In the case of exec, the surviving lwp is thoroughly scrubbed
816 lwp_installctx(klwp_t *lwp)
818 kthread_t *t = lwptot(lwp);
821 void (*restop)(klwp_t *) = lwp_getdatamodel(lwp) == DATAMODEL_NATIVE ?
828 * Install the basic lwp context handlers on each lwp.
831 * virtualizing %ds, %es, %fs, and %gs to the lwp. The register
836 * virtualizing %gs/%fs to the lwp by updating the per-cpu GDTs
838 ASSERT(removectx(t, lwp, lwp_segregs_save, restop,
842 installctx(t, lwp, lwp_segregs_save, restop,
848 restop(lwp);
855 * lwp's kernel stack pointer across context switches.
858 * it to the lwp's kernel stack pointer (kstktop).
862 caddr_t kstktop = (caddr_t)lwp->lwp_regs;
864 caddr_t kstktop = ((caddr_t)lwp->lwp_regs - MINFRAME) +
885 lwp_attach_brand_hdlrs(lwp);
896 klwp_t *lwp = ttolwp(t);
897 pcb_t *pcb = &lwp->lwp_pcb;
904 rp = lwptoregs(lwp);
939 (void) lwp_setprivate(lwp, _LWP_FSBASE, args->thrptr);
958 (void) lwp_setprivate(lwp, _LWP_GSBASE, args->thrptr);
984 (void) lwp_setprivate(lwp, _LWP_GSBASE, args->thrptr);
987 lwp->lwp_eosys = JUSTRETURN;
998 * Add the lwp context handlers that virtualize segment registers,
1001 lwp_installctx(lwp);
1014 * Return the datamodel of the given lwp.
1018 lwp_getdatamodel(klwp_t *lwp)
1020 return (lwp->lwp_procp->p_model);