| 1115 | } |
| 1116 | |
| 1117 | int |
| 1118 | npxsetregs(struct thread *td, union savefpu *addr, char *xfpustate, |
| 1119 | size_t xfpustate_size) |
| 1120 | { |
| 1121 | struct pcb *pcb; |
| 1122 | int error; |
| 1123 | |
| 1124 | if (!hw_float) |
| 1125 | return (ENXIO); |
| 1126 | |
| 1127 | if (cpu_fxsr) |
| 1128 | addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; |
| 1129 | pcb = td->td_pcb; |
| 1130 | error = 0; |
| 1131 | critical_enter(); |
| 1132 | if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { |
| 1133 | error = npxsetxstate(td, xfpustate, xfpustate_size); |
| 1134 | if (error == 0) { |
| 1135 | if (!cpu_fxsr) |
| 1136 | fnclex(); /* As in npxdrop(). */ |
| 1137 | bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); |
| 1138 | fpurstor(get_pcb_user_save_td(td)); |
| 1139 | pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; |
| 1140 | } |
| 1141 | } else { |
| 1142 | error = npxsetxstate(td, xfpustate, xfpustate_size); |
| 1143 | if (error == 0) { |
| 1144 | bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); |
| 1145 | npxuserinited(td); |
| 1146 | } |
| 1147 | } |
| 1148 | critical_exit(); |
| 1149 | return (error); |
| 1150 | } |
| 1151 | |
| 1152 | static void |
| 1153 | npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct save87 *sv_87) |
no test coverage detected