Lines Matching refs:fpu
46 hma_fpu_init(hma_fpu_t *fpu) in hma_fpu_init() argument
50 ASSERT0(fpu->hf_inguest); in hma_fpu_init()
54 bcopy(&sse_initial, fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_fx, in hma_fpu_init()
56 fpu->hf_guest_fpu.fpu_xsave_mask = 0; in hma_fpu_init()
64 xs = fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_xs; in hma_fpu_init()
68 fpu->hf_guest_fpu.fpu_xsave_mask = XFEATURE_FP_ALL; in hma_fpu_init()
74 fpu->hf_guest_fpu.fpu_flags = FPU_EN | FPU_VALID; in hma_fpu_init()
80 hma_fpu_free(hma_fpu_t *fpu) in hma_fpu_free() argument
82 if (fpu == NULL) in hma_fpu_free()
85 ASSERT3P(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic, !=, NULL); in hma_fpu_free()
87 fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic); in hma_fpu_free()
88 kmem_free(fpu, sizeof (*fpu)); in hma_fpu_free()
94 hma_fpu_t *fpu; in hma_fpu_alloc() local
96 fpu = kmem_zalloc(sizeof (hma_fpu_t), kmflag); in hma_fpu_alloc()
97 if (fpu == NULL) in hma_fpu_alloc()
100 fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic = in hma_fpu_alloc()
102 if (fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic == NULL) { in hma_fpu_alloc()
103 kmem_free(fpu, sizeof (hma_fpu_t)); in hma_fpu_alloc()
106 fpu->hf_inguest = B_FALSE; in hma_fpu_alloc()
113 bzero(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic, in hma_fpu_alloc()
117 bzero(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic, in hma_fpu_alloc()
124 return (fpu); in hma_fpu_alloc()
128 hma_fpu_start_guest(hma_fpu_t *fpu) in hma_fpu_start_guest() argument
135 ASSERT3S(fpu->hf_inguest, ==, B_FALSE); in hma_fpu_start_guest()
136 ASSERT3P(fpu->hf_curthread, ==, NULL); in hma_fpu_start_guest()
138 ASSERT3U(fpu->hf_guest_fpu.fpu_flags & FPU_EN, !=, 0); in hma_fpu_start_guest()
139 ASSERT3U(fpu->hf_guest_fpu.fpu_flags & FPU_VALID, !=, 0); in hma_fpu_start_guest()
141 fpu->hf_inguest = B_TRUE; in hma_fpu_start_guest()
142 fpu->hf_curthread = curthread; in hma_fpu_start_guest()
146 fp_restore(&fpu->hf_guest_fpu); in hma_fpu_start_guest()
147 fpu->hf_guest_fpu.fpu_flags &= ~FPU_VALID; in hma_fpu_start_guest()
157 do_fp_save(fpu_ctx_t *fpu) in do_fp_save() argument
164 fpu != &curthread->t_lwp->lwp_pcb.pcb_fpu); in do_fp_save()
168 fpxsave(fpu->fpu_regs.kfpu_u.kfpu_fx); in do_fp_save()
171 xsavep(fpu->fpu_regs.kfpu_u.kfpu_xs, fpu->fpu_xsave_mask); in do_fp_save()
176 fpu->fpu_flags |= FPU_VALID; in do_fp_save()
181 hma_fpu_stop_guest(hma_fpu_t *fpu) in hma_fpu_stop_guest() argument
183 ASSERT3S(fpu->hf_inguest, ==, B_TRUE); in hma_fpu_stop_guest()
184 ASSERT3P(fpu->hf_curthread, ==, curthread); in hma_fpu_stop_guest()
185 ASSERT3U(fpu->hf_guest_fpu.fpu_flags & FPU_EN, !=, 0); in hma_fpu_stop_guest()
186 ASSERT3U(fpu->hf_guest_fpu.fpu_flags & FPU_VALID, ==, 0); in hma_fpu_stop_guest()
188 do_fp_save(&fpu->hf_guest_fpu); in hma_fpu_stop_guest()
192 fpu->hf_inguest = B_FALSE; in hma_fpu_stop_guest()
193 fpu->hf_curthread = NULL; in hma_fpu_stop_guest()
271 hma_fpu_get_xsave_state(const hma_fpu_t *fpu, void *buf, size_t len) in hma_fpu_get_xsave_state() argument
273 ASSERT(!fpu->hf_inguest); in hma_fpu_get_xsave_state()
281 bcopy(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic, buf, in hma_fpu_get_xsave_state()
296 bcopy(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_generic, buf, in hma_fpu_get_xsave_state()
307 hma_fpu_set_xsave_state(hma_fpu_t *fpu, void *buf, size_t len) in hma_fpu_set_xsave_state() argument
309 ASSERT(!fpu->hf_inguest); in hma_fpu_set_xsave_state()
388 fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_fx, in hma_fpu_set_xsave_state()
392 fpxsave(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_fx); in hma_fpu_set_xsave_state()
397 xsavep(fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_xs, in hma_fpu_set_xsave_state()
398 fpu->hf_guest_fpu.fpu_xsave_mask); in hma_fpu_set_xsave_state()
417 hma_fpu_get_fxsave_state(const hma_fpu_t *fpu, struct fxsave_state *fx) in hma_fpu_get_fxsave_state() argument
421 ASSERT3S(fpu->hf_inguest, ==, B_FALSE); in hma_fpu_get_fxsave_state()
423 guest = fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_fx; in hma_fpu_get_fxsave_state()
428 hma_fpu_set_fxsave_state(hma_fpu_t *fpu, const struct fxsave_state *fx) in hma_fpu_set_fxsave_state() argument
433 ASSERT3S(fpu->hf_inguest, ==, B_FALSE); in hma_fpu_set_fxsave_state()
450 gfx = fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_fx; in hma_fpu_set_fxsave_state()
454 gxs = fpu->hf_guest_fpu.fpu_regs.kfpu_u.kfpu_xs; in hma_fpu_set_fxsave_state()