mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
Reorganize code flow in fpudna()/npxdna() to highlight the critical
section scope. Sprinkle __predict_false() for conditions known to never occur or occur only on rare platforms. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
fa7fad8ab9
commit
5803d744c7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335132
@ -722,7 +722,7 @@ fpudna(void)
|
||||
|
||||
KASSERT((curpcb->pcb_flags & PCB_FPUNOSAVE) == 0,
|
||||
("fpudna while in fpu_kern_enter(FPU_KERN_NOCTX)"));
|
||||
if (PCPU_GET(fpcurthread) == td) {
|
||||
if (__predict_false(PCPU_GET(fpcurthread) == td)) {
|
||||
/*
|
||||
* Some virtual machines seems to set %cr0.TS at
|
||||
* arbitrary moments. Silently clear the TS bit
|
||||
@ -730,15 +730,15 @@ fpudna(void)
|
||||
* mode.
|
||||
*/
|
||||
stop_emulating();
|
||||
critical_exit();
|
||||
return;
|
||||
} else {
|
||||
if (__predict_false(PCPU_GET(fpcurthread) != NULL)) {
|
||||
panic(
|
||||
"fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n",
|
||||
PCPU_GET(fpcurthread),
|
||||
PCPU_GET(fpcurthread)->td_tid, td, td->td_tid);
|
||||
}
|
||||
restore_fpu_curthread(td);
|
||||
}
|
||||
if (PCPU_GET(fpcurthread) != NULL) {
|
||||
panic("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n",
|
||||
PCPU_GET(fpcurthread), PCPU_GET(fpcurthread)->td_tid,
|
||||
td, td->td_tid);
|
||||
}
|
||||
restore_fpu_curthread(td);
|
||||
critical_exit();
|
||||
}
|
||||
|
||||
|
@ -835,7 +835,7 @@ npxdna(void)
|
||||
return (0);
|
||||
td = curthread;
|
||||
critical_enter();
|
||||
if (PCPU_GET(fpcurthread) == td) {
|
||||
if (__predict_false(PCPU_GET(fpcurthread) == td)) {
|
||||
/*
|
||||
* Some virtual machines seems to set %cr0.TS at
|
||||
* arbitrary moments. Silently clear the TS bit
|
||||
@ -843,19 +843,18 @@ npxdna(void)
|
||||
* mode.
|
||||
*/
|
||||
stop_emulating();
|
||||
critical_exit();
|
||||
return (1);
|
||||
} else {
|
||||
if (__predict_false(PCPU_GET(fpcurthread) != NULL)) {
|
||||
printf(
|
||||
"npxdna: fpcurthread = %p (%d), curthread = %p (%d)\n",
|
||||
PCPU_GET(fpcurthread),
|
||||
PCPU_GET(fpcurthread)->td_proc->p_pid,
|
||||
td, td->td_proc->p_pid);
|
||||
panic("npxdna");
|
||||
}
|
||||
restore_npx_curthread(td, td->td_pcb);
|
||||
}
|
||||
if (PCPU_GET(fpcurthread) != NULL) {
|
||||
printf("npxdna: fpcurthread = %p (%d), curthread = %p (%d)\n",
|
||||
PCPU_GET(fpcurthread),
|
||||
PCPU_GET(fpcurthread)->td_proc->p_pid,
|
||||
td, td->td_proc->p_pid);
|
||||
panic("npxdna");
|
||||
}
|
||||
restore_npx_curthread(td, td->td_pcb);
|
||||
critical_exit();
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user