From 710338e94ff0f28bccff7b6b5379402164c41810 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sat, 16 Aug 2003 23:15:15 +0000 Subject: [PATCH] In vm_thread_swap{in|out}(), remove the alpha specific conditional compilation and replace it with a call to cpu_thread_swap{in|out}(). This allows us to add similar code on ia64 without cluttering the code even more. --- sys/alpha/alpha/vm_machdep.c | 17 +++++++++++++++++ sys/amd64/amd64/vm_machdep.c | 10 ++++++++++ sys/i386/i386/vm_machdep.c | 10 ++++++++++ sys/ia64/ia64/vm_machdep.c | 10 ++++++++++ sys/powerpc/aim/vm_machdep.c | 16 +++++++++------- sys/powerpc/powerpc/vm_machdep.c | 16 +++++++++------- sys/sparc64/sparc64/vm_machdep.c | 10 ++++++++++ sys/sys/proc.h | 2 ++ sys/vm/vm_glue.c | 15 ++------------- 9 files changed, 79 insertions(+), 27 deletions(-) diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 361128072e3a..9139dc7d694b 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -265,6 +265,23 @@ cpu_thread_setup(struct thread *td) td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb) - 1; } +void +cpu_thread_swapin(struct thread *td) +{ + /* + * The pcb may be at a different physical address now so cache the + * new address. + */ + td->td_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)td->td_pcb); +} + +void +cpu_thread_swapout(struct thread *td) +{ + /* Make sure we aren't fpcurthread. */ + alpha_fpstate_save(td, 1); +} + void cpu_set_upcall(struct thread *td, struct thread *td0) { diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index e9422af363b0..aab07a8f18af 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -198,6 +198,16 @@ cpu_thread_clean(struct thread *td) { } +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ +} + void cpu_sched_exit(td) register struct thread *td; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 134126506073..7cec62039f64 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -300,6 +300,16 @@ cpu_thread_clean(struct thread *td) } } +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ +} + void cpu_sched_exit(td) register struct thread *td; diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c index 77d7c6405122..ae8ff3b32cad 100644 --- a/sys/ia64/ia64/vm_machdep.c +++ b/sys/ia64/ia64/vm_machdep.c @@ -121,6 +121,16 @@ cpu_thread_setup(struct thread *td) td->td_frame->tf_length = sizeof(struct trapframe); } +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ +} + void cpu_set_upcall(struct thread *td, struct thread *td0) { diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index ead7511620e5..3f83f8843dc2 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -257,8 +257,6 @@ is_physical_memory(addr) void cpu_thread_exit(struct thread *td) { - - return; } void @@ -269,20 +267,24 @@ cpu_thread_clean(struct thread *td) void cpu_thread_setup(struct thread *td) { +} - return; +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ } void cpu_set_upcall(struct thread *td, struct thread *td0) { - - return; } void cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku) { - - return; } diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index ead7511620e5..3f83f8843dc2 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -257,8 +257,6 @@ is_physical_memory(addr) void cpu_thread_exit(struct thread *td) { - - return; } void @@ -269,20 +267,24 @@ cpu_thread_clean(struct thread *td) void cpu_thread_setup(struct thread *td) { +} - return; +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ } void cpu_set_upcall(struct thread *td, struct thread *td0) { - - return; } void cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku) { - - return; } diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c index 884b55fcc3b8..983e733894e4 100644 --- a/sys/sparc64/sparc64/vm_machdep.c +++ b/sys/sparc64/sparc64/vm_machdep.c @@ -144,6 +144,16 @@ cpu_thread_setup(struct thread *td) td->td_pcb = pcb; } +void +cpu_thread_swapin(struct thread *td) +{ +} + +void +cpu_thread_swapout(struct thread *td) +{ +} + void cpu_set_upcall(struct thread *td, struct thread *td0) { diff --git a/sys/sys/proc.h b/sys/sys/proc.h index a7b222ad0c3f..3c46e969dbb6 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -889,6 +889,8 @@ void cpu_thread_clean(struct thread *); void cpu_thread_exit(struct thread *); void cpu_thread_setup(struct thread *td); void cpu_thread_siginfo(int sig, u_long code, siginfo_t *si); +void cpu_thread_swapin(struct thread *); +void cpu_thread_swapout(struct thread *); void kse_reassign(struct kse *ke); void kse_link(struct kse *ke, struct ksegrp *kg); void kse_unlink(struct kse *ke); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 5d0744ba5d43..821e51198df9 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -498,12 +498,7 @@ vm_thread_swapout(struct thread *td) vm_page_t m; int i, pages; -#ifdef __alpha__ - /* - * Make sure we aren't fpcurthread. - */ - alpha_fpstate_save(td, 1); -#endif + cpu_thread_swapout(td); pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; pmap_qremove(td->td_kstack, pages); @@ -550,13 +545,7 @@ vm_thread_swapin(struct thread *td) } VM_OBJECT_UNLOCK(ksobj); pmap_qenter(td->td_kstack, ma, pages); -#ifdef __alpha__ - /* - * The pcb may be at a different physical address now so cache the - * new address. - */ - td->td_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)td->td_pcb); -#endif + cpu_thread_swapin(td); } /*