diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1594,8 +1594,6 @@ microuptime.9 getsbinuptime.9 \ microuptime.9 nanouptime.9 \ microuptime.9 sbinuptime.9 -MLINKS+=mi_switch.9 cpu_switch.9 \ - mi_switch.9 cpu_throw.9 MLINKS+=mod_cc.9 CCV.9 \ mod_cc.9 DECLARE_CC_MODULE.9 MLINKS+=mtx_pool.9 mtx_pool_alloc.9 \ diff --git a/share/man/man9/mi_switch.9 b/share/man/man9/mi_switch.9 --- a/share/man/man9/mi_switch.9 +++ b/share/man/man9/mi_switch.9 @@ -31,23 +31,17 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 9, 2023 +.Dd January 7, 2025 .Dt MI_SWITCH 9 .Os .Sh NAME -.Nm mi_switch , -.Nm cpu_switch , -.Nm cpu_throw +.Nm mi_switch .Nd switch to another thread context .Sh SYNOPSIS .In sys/param.h .In sys/proc.h .Ft void .Fn mi_switch "int flags" -.Ft void -.Fn cpu_switch "struct thread *oldtd" "struct thread *newtd" "struct mtx *lock" -.Ft void -.Fn cpu_throw "struct thread *oldtd" "struct thread *newtd" .Sh DESCRIPTION The .Fn mi_switch @@ -168,63 +162,9 @@ .Fa oldtd to the chosen thread .Fa newtd . -First, it saves the context of -.Fa oldtd -to its Process Control Block -.Po -PCB, -.Vt struct pcb -.Pc , -pointed at by -.Va oldtd->td_pcb . -The function then updates important per-CPU state such as the -.Dv curthread -variable, and activates -.Fa newtd\&'s -virtual address space using its associated -.Xr pmap 9 -structure. -Finally, it reads in the saved context from -.Fa newtd\&'s -PCB. -CPU instruction flow continues in the new thread context, on -.Fa newtd\&'s -kernel stack. -The return from -.Fn cpu_switch -can be understood as a completion of the function call initiated by -.Fa newtd -when it was previously switched out, at some point in the distant (relative to -CPU time) past. -.Pp -The -.Fa mtx -argument to -.Fn cpu_switch -is used to pass the mutex which will be stored as -.Fa oldtd\&'s -thread lock at the moment that -.Fa oldtd -is completely switched out. -This is an implementation detail of -.Fn sched_switch . -.Pp -.Fn cpu_throw -is similar to -.Fn cpu_switch -except that it does not save the context of the old thread. -This function is useful when the kernel does not have an old thread -context to save, such as when CPUs other than the boot CPU perform their -first task switch, or when the kernel does not care about the state of the -old thread, such as in -.Xr thread_exit 9 -when the kernel terminates the current thread and switches into a new -thread, -.Fa newtd . -The -.Fa oldtd -argument is unused. .Sh SEE ALSO +.Xr cpu_switch 9 , +.Xr cpu_throw 9 , .Xr critical_exit 9 , .Xr issignal 9 , .Xr kern_yield 9 ,