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

Function vfp_save_state

freebsd/arm64/arm64/vfp.c:166–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void
167vfp_save_state(struct thread *td, struct pcb *pcb)
168{
169 uint32_t cpacr;
170
171 KASSERT(pcb != NULL, ("NULL vfp pcb"));
172 KASSERT(td == NULL || td->td_pcb == pcb, ("Invalid vfp pcb"));
173
174 /*
175 * savectx() will be called on panic with dumppcb as an argument,
176 * dumppcb doesn't have pcb_fpusaved set, so set it to save
177 * the VFP registers.
178 */
179 if (pcb->pcb_fpusaved == NULL)
180 pcb->pcb_fpusaved = &pcb->pcb_fpustate;
181
182 if (td == NULL)
183 td = curthread;
184
185 critical_enter();
186 /*
187 * Only store the registers if the VFP is enabled,
188 * i.e. return if we are trapping on FP access.
189 */
190 cpacr = READ_SPECIALREG(cpacr_el1);
191 if ((cpacr & CPACR_FPEN_MASK) == CPACR_FPEN_TRAP_NONE) {
192 KASSERT(PCPU_GET(fpcurthread) == td,
193 ("Storing an invalid VFP state"));
194
195 vfp_store(pcb->pcb_fpusaved);
196 dsb(ish);
197 vfp_disable();
198 }
199 critical_exit();
200}
201
202void
203vfp_restore_state(void)

Callers 5

fpu_kern_enterFunction · 0.85
get_fpcontext32Function · 0.85
cpu_forkFunction · 0.85
fill_fpregsFunction · 0.85
get_fpcontextFunction · 0.85

Calls 4

vfp_disableFunction · 0.85
vfp_storeFunction · 0.70
critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected