MCPcopy Create free account
hub / github.com/F-Stack/f-stack / npxsetregs

Function npxsetregs

freebsd/i386/i386/npx.c:1117–1150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1115}
1116
1117int
1118npxsetregs(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
1152static void
1153npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct save87 *sv_87)

Callers 3

cpu_ptrace_xstateFunction · 0.85
set_fpcontextFunction · 0.85
npx_set_fsaveFunction · 0.85

Calls 6

npxsetxstateFunction · 0.85
fpurstorFunction · 0.85
npxuserinitedFunction · 0.85
get_pcb_user_save_tdFunction · 0.70
critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected