Lines Matching refs:vgc

220 mp_set_cpu_context(vcpu_guest_context_t *vgc, cpu_t *cp)  in mp_set_cpu_context()  argument
224 vgc->flags = VGCF_IN_KERNEL; in mp_set_cpu_context()
232 vgc->user_regs.cs = KCS_SEL | SEL_KPL; /* force to ring 3 */ in mp_set_cpu_context()
234 vgc->user_regs.cs = KCS_SEL; in mp_set_cpu_context()
236 vgc->user_regs.ds = KDS_SEL; in mp_set_cpu_context()
237 vgc->user_regs.es = KDS_SEL; in mp_set_cpu_context()
238 vgc->user_regs.ss = KDS_SEL; in mp_set_cpu_context()
239 vgc->kernel_ss = KDS_SEL; in mp_set_cpu_context()
250 vgc->user_regs.fs = 0; in mp_set_cpu_context()
251 vgc->user_regs.gs = 0; in mp_set_cpu_context()
252 vgc->user_regs.rflags = F_OFF | iopl; in mp_set_cpu_context()
254 vgc->user_regs.fs = KFS_SEL; in mp_set_cpu_context()
255 vgc->user_regs.gs = KGS_SEL; in mp_set_cpu_context()
256 vgc->user_regs.eflags = F_OFF | iopl; in mp_set_cpu_context()
257 vgc->event_callback_cs = vgc->user_regs.cs; in mp_set_cpu_context()
258 vgc->failsafe_callback_cs = vgc->user_regs.cs; in mp_set_cpu_context()
265 ASSERT(NIDT == sizeof (vgc->trap_ctxt) / sizeof (vgc->trap_ctxt[0])); in mp_set_cpu_context()
268 trap_info_t *ti = &vgc->trap_ctxt[vec]; in mp_set_cpu_context()
286 vgc->gdt_frames[0] = pa_to_ma(mmu_btop(cp->cpu_m.mcpu_gdtpa)); in mp_set_cpu_context()
288 vgc->gdt_frames[0] = pfn_to_mfn(mmu_btop(cp->cpu_m.mcpu_gdtpa)); in mp_set_cpu_context()
290 vgc->gdt_ents = NGDT; in mp_set_cpu_context()
292 vgc->ctrlreg[0] = CR0_ENABLE_FPU_FLAGS(getcr0()); in mp_set_cpu_context()
296 vgc->ctrlreg[3] = in mp_set_cpu_context()
300 vgc->ctrlreg[3] = in mp_set_cpu_context()
303 vgc->ctrlreg[4] = getcr4(); in mp_set_cpu_context()
305 vgc->event_callback_eip = (uintptr_t)xen_callback; in mp_set_cpu_context()
306 vgc->failsafe_callback_eip = (uintptr_t)xen_failsafe_callback; in mp_set_cpu_context()
307 vgc->flags |= VGCF_failsafe_disables_events; in mp_set_cpu_context()
313 vgc->syscall_callback_eip = (uintptr_t)sys_syscall; in mp_set_cpu_context()
314 vgc->flags |= VGCF_syscall_disables_events; in mp_set_cpu_context()
316 ASSERT(vgc->user_regs.gs == 0); in mp_set_cpu_context()
317 vgc->gs_base_kernel = (uintptr_t)cp; in mp_set_cpu_context()
320 return (xen_vcpu_initialize(cp->cpu_id, vgc)); in mp_set_cpu_context()
338 vcpu_guest_context_t vgc; in mach_cpucontext_alloc() local
366 bzero(&vgc, sizeof (vgc)); in mach_cpucontext_alloc()
369 vgc.user_regs.rip = tp->t_pc; in mach_cpucontext_alloc()
370 vgc.user_regs.rsp = tp->t_sp; in mach_cpucontext_alloc()
371 vgc.user_regs.rbp = tp->t_sp - 2 * sizeof (greg_t); in mach_cpucontext_alloc()
373 vgc.user_regs.eip = tp->t_pc; in mach_cpucontext_alloc()
374 vgc.user_regs.esp = tp->t_sp; in mach_cpucontext_alloc()
375 vgc.user_regs.ebp = tp->t_sp - 2 * sizeof (greg_t); in mach_cpucontext_alloc()
392 vgc.kernel_sp = (ulong_t)tp->t_stk; in mach_cpucontext_alloc()
394 err = mp_set_cpu_context(&vgc, cp); in mach_cpucontext_alloc()
446 pcb_to_user_regs(label_t *pcb, vcpu_guest_context_t *vgc) in pcb_to_user_regs() argument
449 vgc->user_regs.rip = pcb->val[REG_LABEL_PC]; in pcb_to_user_regs()
450 vgc->user_regs.rsp = pcb->val[REG_LABEL_SP]; in pcb_to_user_regs()
451 vgc->user_regs.rbp = pcb->val[REG_LABEL_BP]; in pcb_to_user_regs()
452 vgc->user_regs.rbx = pcb->val[REG_LABEL_RBX]; in pcb_to_user_regs()
453 vgc->user_regs.r12 = pcb->val[REG_LABEL_R12]; in pcb_to_user_regs()
454 vgc->user_regs.r13 = pcb->val[REG_LABEL_R13]; in pcb_to_user_regs()
455 vgc->user_regs.r14 = pcb->val[REG_LABEL_R14]; in pcb_to_user_regs()
456 vgc->user_regs.r15 = pcb->val[REG_LABEL_R15]; in pcb_to_user_regs()
458 vgc->user_regs.eip = pcb->val[REG_LABEL_PC]; in pcb_to_user_regs()
459 vgc->user_regs.esp = pcb->val[REG_LABEL_SP]; in pcb_to_user_regs()
460 vgc->user_regs.ebp = pcb->val[REG_LABEL_BP]; in pcb_to_user_regs()
461 vgc->user_regs.ebx = pcb->val[REG_LABEL_EBX]; in pcb_to_user_regs()
462 vgc->user_regs.esi = pcb->val[REG_LABEL_ESI]; in pcb_to_user_regs()
463 vgc->user_regs.edi = pcb->val[REG_LABEL_EDI]; in pcb_to_user_regs()
474 vcpu_guest_context_t vgc; in mach_cpucontext_restore() local
480 bzero(&vgc, sizeof (vgc)); in mach_cpucontext_restore()
482 pcb_to_user_regs(&cp->cpu_thread->t_pcb, &vgc); in mach_cpucontext_restore()
490 vgc.user_regs.rax = 1; in mach_cpucontext_restore()
491 vgc.user_regs.rsp += sizeof (ulong_t); in mach_cpucontext_restore()
493 vgc.user_regs.eax = 1; in mach_cpucontext_restore()
494 vgc.user_regs.esp += sizeof (ulong_t); in mach_cpucontext_restore()
497 vgc.kernel_sp = cp->cpu_thread->t_sp; in mach_cpucontext_restore()
499 err = mp_set_cpu_context(&vgc, cp); in mach_cpucontext_restore()
958 xen_vcpu_initialize(processorid_t id, vcpu_guest_context_t *vgc) in xen_vcpu_initialize() argument
962 if ((err = HYPERVISOR_vcpu_op(VCPUOP_initialise, id, vgc)) != 0) { in xen_vcpu_initialize()