static boolean_t fpu_thread_promote_avx512(thread_t); /* Forward */
-/*
- * Define a wrapper for bcopy to defeat destination size checka.
- * This is needed to treat repeated objects such as
- * _STRUCT_XMM_REG fpu_ymmh0;
- * ...
- * _STRUCT_XMM_REG fpu_ymmh7;
- * as an array and to copy like so:
- * bcopy_nockch(src,&dst->fpu_ymmh0,8*sizeof(_STRUCT_XMM_REG));
- * without the compiler throwing a __builtin__memmove_chk error.
- */
-static inline void
-bcopy_nochk(void *_src, void *_dst, size_t _len)
-{
- bcopy(_src, _dst, _len);
-}
/*
* Furthermore, make compile-time asserts that no padding creeps into structures
state->fpu_mxcsr &= mxcsr_capability_mask;
- bcopy((char *)&state->fpu_fcw, (char *)ifps, fp_state_size[FP]);
+ __nochk_bcopy((char *)&state->fpu_fcw, (char *)ifps, fp_state_size[FP]);
switch (thread_xstate(thr_act)) {
case UNDEFINED_FULL:
iavx->_xh.xcomp_bv = 0;
if (f == x86_AVX_STATE32) {
- bcopy_nochk(&xs->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
} else if (f == x86_AVX_STATE64) {
- bcopy_nochk(&xs->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
} else {
iavx->_xh.xstate_bv = (XFEM_SSE | XFEM_X87);
}
switch (f) {
case x86_AVX512_STATE32:
- bcopy_nochk(&xs.s32->fpu_k0, iavx->x_Opmask, 8 * sizeof(_STRUCT_OPMASK_REG));
- bcopy_nochk(&xs.s32->fpu_zmmh0, iavx->x_ZMM_Hi256, 8 * sizeof(_STRUCT_YMM_REG));
- bcopy_nochk(&xs.s32->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs.s32->fpu_k0, iavx->x_Opmask, 8 * sizeof(_STRUCT_OPMASK_REG));
+ __nochk_bcopy(&xs.s32->fpu_zmmh0, iavx->x_ZMM_Hi256, 8 * sizeof(_STRUCT_YMM_REG));
+ __nochk_bcopy(&xs.s32->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
DBG_AVX512_STATE(iavx);
break;
case x86_AVX_STATE32:
- bcopy_nochk(&xs.s32->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs.s32->fpu_ymmh0, iavx->x_YMM_Hi128, 8 * sizeof(_STRUCT_XMM_REG));
break;
case x86_AVX512_STATE64:
- bcopy_nochk(&xs.s64->fpu_k0, iavx->x_Opmask, 8 * sizeof(_STRUCT_OPMASK_REG));
- bcopy_nochk(&xs.s64->fpu_zmm16, iavx->x_Hi16_ZMM, 16 * sizeof(_STRUCT_ZMM_REG));
- bcopy_nochk(&xs.s64->fpu_zmmh0, iavx->x_ZMM_Hi256, 16 * sizeof(_STRUCT_YMM_REG));
- bcopy_nochk(&xs.s64->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs.s64->fpu_k0, iavx->x_Opmask, 8 * sizeof(_STRUCT_OPMASK_REG));
+ __nochk_bcopy(&xs.s64->fpu_zmm16, iavx->x_Hi16_ZMM, 16 * sizeof(_STRUCT_ZMM_REG));
+ __nochk_bcopy(&xs.s64->fpu_zmmh0, iavx->x_ZMM_Hi256, 16 * sizeof(_STRUCT_YMM_REG));
+ __nochk_bcopy(&xs.s64->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
DBG_AVX512_STATE(iavx);
break;
case x86_AVX_STATE64:
- bcopy_nochk(&xs.s64->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(&xs.s64->fpu_ymmh0, iavx->x_YMM_Hi128, 16 * sizeof(_STRUCT_XMM_REG));
break;
}
break;
* No valid floating-point state.
*/
- bcopy((char *)&initial_fp_state, (char *)&state->fpu_fcw,
+ __nochk_bcopy((char *)&initial_fp_state, (char *)&state->fpu_fcw,
fp_state_size[FP]);
simple_unlock(&pcb->lock);
(void)ml_set_interrupts_enabled(intr);
}
if (ifps->fp_valid) {
- bcopy((char *)ifps, (char *)&state->fpu_fcw, fp_state_size[FP]);
+ __nochk_bcopy((char *)ifps, (char *)&state->fpu_fcw, fp_state_size[FP]);
switch (thread_xstate(thr_act)) {
case UNDEFINED_FULL:
case FP_FULL:
struct x86_avx_thread_state *iavx = (void *) ifps;
x86_avx_state64_t *xs = (x86_avx_state64_t *) state;
if (f == x86_AVX_STATE32) {
- bcopy_nochk(iavx->x_YMM_Hi128, &xs->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
} else if (f == x86_AVX_STATE64) {
- bcopy_nochk(iavx->x_YMM_Hi128, &xs->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
}
break;
}
} xs = { .ts = tstate };
switch (f) {
case x86_AVX512_STATE32:
- bcopy_nochk(iavx->x_Opmask, &xs.s32->fpu_k0, 8 * sizeof(_STRUCT_OPMASK_REG));
- bcopy_nochk(iavx->x_ZMM_Hi256, &xs.s32->fpu_zmmh0, 8 * sizeof(_STRUCT_YMM_REG));
- bcopy_nochk(iavx->x_YMM_Hi128, &xs.s32->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_Opmask, &xs.s32->fpu_k0, 8 * sizeof(_STRUCT_OPMASK_REG));
+ __nochk_bcopy(iavx->x_ZMM_Hi256, &xs.s32->fpu_zmmh0, 8 * sizeof(_STRUCT_YMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs.s32->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
DBG_AVX512_STATE(iavx);
break;
case x86_AVX_STATE32:
- bcopy_nochk(iavx->x_YMM_Hi128, &xs.s32->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs.s32->fpu_ymmh0, 8 * sizeof(_STRUCT_XMM_REG));
break;
case x86_AVX512_STATE64:
- bcopy_nochk(iavx->x_Opmask, &xs.s64->fpu_k0, 8 * sizeof(_STRUCT_OPMASK_REG));
- bcopy_nochk(iavx->x_Hi16_ZMM, &xs.s64->fpu_zmm16, 16 * sizeof(_STRUCT_ZMM_REG));
- bcopy_nochk(iavx->x_ZMM_Hi256, &xs.s64->fpu_zmmh0, 16 * sizeof(_STRUCT_YMM_REG));
- bcopy_nochk(iavx->x_YMM_Hi128, &xs.s64->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_Opmask, &xs.s64->fpu_k0, 8 * sizeof(_STRUCT_OPMASK_REG));
+ __nochk_bcopy(iavx->x_Hi16_ZMM, &xs.s64->fpu_zmm16, 16 * sizeof(_STRUCT_ZMM_REG));
+ __nochk_bcopy(iavx->x_ZMM_Hi256, &xs.s64->fpu_zmmh0, 16 * sizeof(_STRUCT_YMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs.s64->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
DBG_AVX512_STATE(iavx);
break;
case x86_AVX_STATE64:
- bcopy_nochk(iavx->x_YMM_Hi128, &xs.s64->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
+ __nochk_bcopy(iavx->x_YMM_Hi128, &xs.s64->fpu_ymmh0, 16 * sizeof(_STRUCT_XMM_REG));
break;
}
break;
if (ifps->fp_valid) {
child->machine.ifps = new_ifps;
child->machine.xstate = xstate;
- bcopy((char *)(ppcb->ifps),
+ __nochk_bcopy((char *)(ppcb->ifps),
(char *)(child->machine.ifps),
fp_state_size[xstate]);
if (pcb->ifps == 0 && !get_interrupt_level()) {
ifps = fp_state_alloc(xstate);
- bcopy((char *)&initial_fp_state, (char *)ifps,
+ __nochk_bcopy((char *)&initial_fp_state, (char *)ifps,
fp_state_size[xstate]);
if (!thread_is_64bit_addr(thr_act)) {
ifps->fp_save_layout = fpu_YMM_capable ? XSAVE32 : FXSAVE32;
/* Allocate an AVX512 savearea and copy AVX state into it */
if (pcb->xstate != AVX512) {
- bcopy(ifps, ifps512, fp_state_size[AVX]);
+ __nochk_bcopy(ifps, ifps512, fp_state_size[AVX]);
pcb->ifps = ifps512;
pcb->xstate = AVX512;
ifps512 = NULL;