From 7c82e0520d2cccaccea9795bc42790dc6f4c4bdc Mon Sep 17 00:00:00 2001 From: grehan Date: Tue, 23 Oct 2007 00:52:25 +0000 Subject: Cut over to ULE on PowerPC kern/sched_ule.c - Add __powerpc__ to the list of supported architectures powerpc/conf/GENERIC - Swap SCHED_4BSD with SCHED_ULE powerpc/powerpc/genassym.c - Export TD_LOCK field of thread struct powerpc/powerpc/swtch.S - Handle new 3rd parameter to cpu_switch() by updating the old thread's lock. Note: uniprocessor-only, will require modification for MP support. powerpc/powerpc/vm_machdep.c - Set 3rd param of cpu_switch to mutex of old thread's lock, making the call a no-op. Reviewed by: marcel, jeffr (slightly older version) --- sys/powerpc/aim/swtch.S | 8 ++++++-- sys/powerpc/aim/vm_machdep.c | 2 +- sys/powerpc/conf/GENERIC | 2 +- sys/powerpc/powerpc/genassym.c | 1 + sys/powerpc/powerpc/swtch.S | 8 ++++++-- sys/powerpc/powerpc/vm_machdep.c | 2 +- 6 files changed, 16 insertions(+), 7 deletions(-) (limited to 'sys/powerpc') diff --git a/sys/powerpc/aim/swtch.S b/sys/powerpc/aim/swtch.S index 038e788..1a09d87 100644 --- a/sys/powerpc/aim/swtch.S +++ b/sys/powerpc/aim/swtch.S @@ -67,13 +67,17 @@ #include /* - * void cpu_switch(struct thread *old, struct thread *new) + * void cpu_switch(struct thread *old, + * struct thread *new, + * struct mutex *mtx); * * Switch to a new thread saving the current state in the old thread. */ ENTRY(cpu_switch) - lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */ + stw %r5,TD_LOCK(%r3) /* ULE: update old thread's lock */ + /* XXX needs to change for MP */ + lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */ mr %r12,%r2 stmw %r12,PCB_CONTEXT(%r5) /* Save the non-volatile GP regs. These can now be used for scratch */ diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index 1b58c1e..1492a07 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -197,7 +197,7 @@ void cpu_throw(struct thread *old, struct thread *new) { - cpu_switch(old, new, NULL); + cpu_switch(old, new, old->td_lock); panic("cpu_throw() didn't"); } diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index f99af0b..ef31949 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -30,7 +30,7 @@ makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options POWERMAC #NewWorld Apple PowerMacs options PSIM #GDB PSIM ppc simulator -options SCHED_4BSD #4BSD scheduler +options SCHED_ULE #ULE scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options SCTP #Stream Control Transmission Protocol diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c index 63719cc..5c276b1 100644 --- a/sys/powerpc/powerpc/genassym.c +++ b/sys/powerpc/powerpc/genassym.c @@ -137,6 +137,7 @@ ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); ASSYM(PCB_FPU, PCB_FPU); +ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); diff --git a/sys/powerpc/powerpc/swtch.S b/sys/powerpc/powerpc/swtch.S index 038e788..1a09d87 100644 --- a/sys/powerpc/powerpc/swtch.S +++ b/sys/powerpc/powerpc/swtch.S @@ -67,13 +67,17 @@ #include /* - * void cpu_switch(struct thread *old, struct thread *new) + * void cpu_switch(struct thread *old, + * struct thread *new, + * struct mutex *mtx); * * Switch to a new thread saving the current state in the old thread. */ ENTRY(cpu_switch) - lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */ + stw %r5,TD_LOCK(%r3) /* ULE: update old thread's lock */ + /* XXX needs to change for MP */ + lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */ mr %r12,%r2 stmw %r12,PCB_CONTEXT(%r5) /* Save the non-volatile GP regs. These can now be used for scratch */ diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index 1b58c1e..1492a07 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -197,7 +197,7 @@ void cpu_throw(struct thread *old, struct thread *new) { - cpu_switch(old, new, NULL); + cpu_switch(old, new, old->td_lock); panic("cpu_throw() didn't"); } -- cgit v1.1