Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/powerpc/swtch64.S
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#include "assym.inc" | #include "assym.inc" | ||||
#include "opt_sched.h" | #include "opt_sched.h" | ||||
#include <sys/syscall.h> | #include <sys/syscall.h> | ||||
#include <machine/trap.h> | #include <machine/trap.h> | ||||
#include <machine/spr.h> | |||||
#include <machine/param.h> | #include <machine/param.h> | ||||
#include <machine/asm.h> | #include <machine/asm.h> | ||||
#ifdef _CALL_ELF | #ifdef _CALL_ELF | ||||
.abiversion _CALL_ELF | .abiversion _CALL_ELF | ||||
#endif | #endif | ||||
TOC_ENTRY(blocked_lock) | TOC_ENTRY(blocked_lock) | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | ENTRY(cpu_switch) | ||||
mr %r14,%r3 /* Copy the old thread ptr... */ | mr %r14,%r3 /* Copy the old thread ptr... */ | ||||
mr %r13,%r4 /* and the new thread ptr in curthread*/ | mr %r13,%r4 /* and the new thread ptr in curthread*/ | ||||
mr %r16,%r5 /* and the new lock */ | mr %r16,%r5 /* and the new lock */ | ||||
mr %r17,%r6 /* and the PCB */ | mr %r17,%r6 /* and the PCB */ | ||||
stdu %r1,-48(%r1) | stdu %r1,-48(%r1) | ||||
lwz %r7,PCB_FLAGS(%r17) | lwz %r7, PCB_FLAGS(%r17) | ||||
andi. %r7, %r7, PCB_CDSCR | |||||
beq .L0 | |||||
/* Custom DSCR was set. Reseting it to enter kernel */ | |||||
li %r7, 0x0 | |||||
mtspr SPR_DSCR, %r7 | |||||
.L0: | |||||
lwz %r7,PCB_FLAGS(%r17) | |||||
/* Save FPU context if needed */ | /* Save FPU context if needed */ | ||||
andi. %r7, %r7, PCB_FPU | andi. %r7, %r7, PCB_FPU | ||||
beq .L1 | beq .L1 | ||||
bl save_fpu | bl save_fpu | ||||
nop | nop | ||||
.L1: | .L1: | ||||
mr %r3,%r14 /* restore old thread ptr */ | mr %r3,%r14 /* restore old thread ptr */ | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | 1: mfsprg %r7,0 /* Get the pcpu pointer */ | ||||
mr %r3,%r13 /* Pass curthread to enable_fpu */ | mr %r3,%r13 /* Pass curthread to enable_fpu */ | ||||
bl enable_fpu | bl enable_fpu | ||||
nop | nop | ||||
.L3: | .L3: | ||||
lwz %r6, PCB_FLAGS(%r17) | lwz %r6, PCB_FLAGS(%r17) | ||||
/* Restore Altivec context if needed */ | /* Restore Altivec context if needed */ | ||||
andi. %r6, %r6, PCB_VEC | andi. %r6, %r6, PCB_VEC | ||||
beq .L4 | beq .L31 | ||||
mr %r3,%r13 /* Pass curthread to enable_vec */ | mr %r3,%r13 /* Pass curthread to enable_vec */ | ||||
bl enable_vec | bl enable_vec | ||||
nop | nop | ||||
.L31: | |||||
lwz %r6, PCB_FLAGS(%r17) | |||||
/* Restore Custom DSCR if needed */ | |||||
andi. %r6, %r6, PCB_CDSCR | |||||
beq .L4 | |||||
ld %r6, PCB_DSCR(%r17) /* Load the DSCR register*/ | |||||
mtspr SPR_DSCR, %r6 | |||||
/* thread to restore is in r3 */ | /* thread to restore is in r3 */ | ||||
.L4: | .L4: | ||||
addi %r1,%r1,48 | addi %r1,%r1,48 | ||||
mr %r3,%r17 /* Recover PCB ptr */ | mr %r3,%r17 /* Recover PCB ptr */ | ||||
ld %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs. */ | ld %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs. */ | ||||
ld %r14,PCB_CONTEXT+2*8(%r3) | ld %r14,PCB_CONTEXT+2*8(%r3) | ||||
ld %r15,PCB_CONTEXT+3*8(%r3) | ld %r15,PCB_CONTEXT+3*8(%r3) | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |