#ifdef SHOW_SYSCALLS_TASK
LOADBASE(r31,show_syscalls_task)
ld r31,show_syscalls_task@l(r31)
- cmp 0,r13,r31
+ ld r10,PACACURRENT(r13)
+ cmp 0,r10,r31
bne 1f
#endif
LOADADDR(r3,7f)
LOADADDR(r3,77f)
ld r4,GPR8(r1)
ld r5,GPR9(r1)
- mr r6,r13
+ ld r6, PACACURRENT(r13)
bl .printk
ld r0,GPR0(r1)
ld r3,GPR3(r1)
20: std r3,RESULT(r1) /* Save result */
#ifdef SHOW_SYSCALLS
#ifdef SHOW_SYSCALLS_TASK
- cmp 0,r13,r31
+ ld r10, PACACURRENT(13)
+ cmp 0,r10,r31
bne 91f
#endif
mr r4,r3
std r23,_CCR(r1)
std r1,KSP(r3) /* Set old stack pointer */
- mfspr r5,SPRG3 /* Get paca */
- addi r13,r4,-THREAD /* Convert THREAD to 'current' */
- std r13,PACACURRENT(r5) /* Set new 'current' */
+ addi r6,r4,-THREAD /* Convert THREAD to 'current' */
+ std r6,PACACURRENT(r13) /* Set new 'current' */
#ifdef CONFIG_PPC_ISERIES
#error fixme
CHECKANYINT(r3,r4)
beq+ 4f /* skip do_IRQ if no interrupts */
+#warning FIX ISERIES
mfspr r5,SPRG3
li r3,0
stb r3,PACAPROCENABLED(r5) /* ensure we are disabled */
bne do_work
addi r0,r1,INT_FRAME_SIZE /* size of frame */
- std r0,THREAD+KSP(r13) /* save kernel stack pointer */
- mfspr r4,SPRG3 /* current task's PACA */
- std r1,PACAKSAVE(r4) /* save exception stack pointer */
+ ld r4,PACACURRENT(r13)
+ std r0,THREAD+KSP(r4) /* save kernel stack pointer */
+ std r1,PACAKSAVE(r13) /* save exception stack pointer */
+
+ /*
+ * r13 is our per cpu area, only restore it if we are returning to
+ * userspace
+ */
+ REST_GPR(13,r1)
restore:
ld r3,_CTR(r1)
stdcx. r0,0,r1 /* to clear the reservation */
#ifdef DO_SOFT_DISABLE
+ /* XXX do this in do_work, r13 isnt valid here */
ld r0,SOFTE(r1)
stb r0,PACAPROCENABLED(r13)
#endif
ld r0,_MSR(r1)
mtspr SRR1,r0
+
ld r2,_CCR(r1)
mtcrf 0xFF,r2
ld r2,_NIP(r1)
mtspr SRR0,r2
- REST_GPR(13,r1)
+
ld r0,GPR0(r1)
ld r2,GPR2(r1)
ld r3,GPR3(r1)
ld r4,GPR4(r1)
ld r1,GPR1(r1)
+ /*
+ * What if we took an exception and stole this segment, we may
+ * fault on the above addresses and globber SRR0/1. Should check RI
+ * bit and repeat - Anton
+ */
rfid
+/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */
do_work:
/* Enable interrupts */
ori r10,r10,MSR_EE|MSR_RI
b recheck
1: andi. r0,r3,_TIF_SIGPENDING
- beq 2f
+ beq recheck
li r3,0
addi r4,r1,STACK_FRAME_OVERHEAD
bl .do_signal
b recheck
-2: /* nobody uses the TIF_NOTIFY_RESUME bit yet */
- b recheck
-
/*
* On CHRP, the Run-Time Abstraction Services (RTAS) have to be
* called with the MMU off.
* RTAS might touch to the stack. (r0, r3-r13 are caller saved)
*/
SAVE_GPR(2, r1) /* Save the TOC */
- SAVE_GPR(13, r1) /* Save current */
+ SAVE_GPR(13, r1) /* Save paca */
SAVE_8GPRS(14, r1) /* Save the non-volatiles */
SAVE_10GPRS(22, r1) /* ditto */
mfsrr1 r10
std r10,_SRR1(r1)
- /* Unfortunatly, the stack pointer and the MSR are also clobbered,
- * so they are saved in the PACA (SPRG3) which allows us to restore
+ /* Unfortunately, the stack pointer and the MSR are also clobbered,
+ * so they are saved in the PACA which allows us to restore
* our original state after RTAS returns.
*/
- mfspr r4,SPRG3 /* Get PACA */
- std r1,PACAR1(r4)
+ std r1,PACAR1(r13)
mfmsr r6
- std r6,PACASAVEDMSR(r4)
+ std r6,PACASAVEDMSR(r13)
/* Setup our real return addr */
SET_REG_TO_LABEL(r4,.rtas_return_loc)
_STATIC(rtas_restore_regs)
/* relocation is on at this point */
REST_GPR(2, r1) /* Restore the TOC */
- REST_GPR(13, r1) /* Restore current */
+ REST_GPR(13, r1) /* Restore paca */
REST_8GPRS(14, r1) /* Restore the non-volatiles */
REST_10GPRS(22, r1) /* ditto */
- /* put back current in r13 */
- mfspr r4,SPRG3
- ld r13,PACACURRENT(r4)
+ mfspr r13,SPRG3
ld r4,_CCR(r1)
mtcr r4
* PROM might touch to the stack. (r0, r3-r13 are caller saved)
*/
SAVE_8GPRS(2, r1) /* Save the TOC & incoming param(s) */
- SAVE_GPR(13, r1) /* Save current */
+ SAVE_GPR(13, r1) /* Save paca */
SAVE_8GPRS(14, r1) /* Save the non-volatiles */
SAVE_10GPRS(22, r1) /* ditto */
isync
REST_8GPRS(2, r1) /* Restore the TOC & param(s) */
- REST_GPR(13, r1) /* Restore current */
+ REST_GPR(13, r1) /* Restore paca */
REST_8GPRS(14, r1) /* Restore the non-volatiles */
REST_10GPRS(22, r1) /* ditto */
blrl /* Entering PROM here... */
isync
REST_GPR(2, r1) /* Restore the TOC */
- REST_GPR(13, r1) /* Restore current */
+ REST_GPR(13, r1) /* Restore paca */
REST_8GPRS(14, r1) /* Restore the non-volatiles */
REST_10GPRS(22, r1) /* ditto */
SAVE_8GPRS(2, r1); /* save r2 - r13 in stackframe */ \
SAVE_4GPRS(10, r1); \
ld r2,PACATOC(r20); \
- ld r13,PACACURRENT(r20)
+ mr r13,r20
/*
* Note: code which follows this uses cr0.eq (set if from kernel),
.globl SystemReset_Iseries
SystemReset_Iseries:
- mfspr 25,SPRG3 /* Get paca address */
- lhz r24,PACAPACAINDEX(r25) /* Get processor # */
+ mfspr r13,SPRG3 /* Get paca address */
+ lhz r24,PACAPACAINDEX(r13) /* Get processor # */
cmpi 0,r24,0 /* Are we processor 0? */
beq .__start_initialization_iSeries /* Start up the first processor */
mfspr r4,CTRLF
1:
HMT_LOW
#ifdef CONFIG_SMP
- lbz r23,PACAPROCSTART(r25) /* Test if this processor
+ lbz r23,PACAPROCSTART(r13) /* Test if this processor
* should start */
sync
LOADADDR(r3,current_set)
#endif /* CONFIG_SMP */
li r0,-1 /* r0=-1 indicates a Hypervisor call */
sc /* Invoke the hypervisor via a system call */
- mfspr r25,SPRG3 /* Put r25 back ???? */
+ mfspr r13,SPRG3 /* Put r13 back ???? */
b 1b /* If SMP not configured, secondaries
* loop forever */
/* */
/* The call to do_irq will preserve the value of r14 - r31 */
/* */
- mfspr r20,SPRG3 /* get paca */
- lbz r21,PACAHRDWINTCOUNT(r20) /* get hardware interrupt cnt */
+/*
+ * XXX turn off interrupt stacks until the thread_info stuff is fixed.
+ * Otherwise we end up setting need_resched etc bits in the interrupt
+ * stack and they never get seen when we return to the process stack - Anton
+ */
+#if 0
+ lbz r21,PACAHRDWINTCOUNT(r13) /* get hardware interrupt cnt */
cmpi 0,r21,1 /* */
addi r21,r21,1 /* incr hardware interrupt cnt*/
- stb r21,PACAHRDWINTCOUNT(r20) /* */
+ stb r21,PACAHRDWINTCOUNT(r13) /* */
bne 2f /* */
mr r14,r1 /* preserve current r1 */
- ld r1,PACAHRDWINTSTACK(r20) /* */
+ ld r1,PACAHRDWINTSTACK(r13) /* */
std r14,0(r1) /* set the back chain */
bl .do_IRQ
- lbz r22,PACAHRDWINTCOUNT(r20) /* get hardware interrupt cnt */
+ lbz r22,PACAHRDWINTCOUNT(r13) /* get hardware interrupt cnt */
cmp 0,r22,r21 /* debug test */
bne 3f
subi r21,r21,1
- stb r21,PACAHRDWINTCOUNT(r20) /* */
+ stb r21,PACAHRDWINTCOUNT(r13) /* */
mr r1,r14 /* */
b .ret_from_except
+#endif
2:
bl .do_IRQ
- lbz r22,PACAHRDWINTCOUNT(r20) /* get hardware interrupt cnt */
+#if 0
+ lbz r22,PACAHRDWINTCOUNT(r13) /* get hardware interrupt cnt */
cmp 0,r22,r21 /* debug test */
bne 3f /* */
subi r21,r21,1 /* decr hardware interrupt cnt*/
- stb r21,PACAHRDWINTCOUNT(r20) /* */
+ stb r21,PACAHRDWINTCOUNT(r13) /* */
+#endif
b .ret_from_except
* Indicate that r1 contains the kernel stack and
* get the Kernel TOC and CURRENT pointers from the paca
*/
- mfspr r23,SPRG3 /* Get PACA */
- std r22,PACAKSAVE(r23) /* r1 is now kernel sp */
- ld r2,PACATOC(r23) /* Get Kernel TOC pointer */
+ std r22,PACAKSAVE(r13) /* r1 is now kernel sp */
+ ld r2,PACATOC(r13) /* Get Kernel TOC pointer */
/*
* If from user state, update THREAD.regs
*/
beq 2f /* Modify THREAD.regs if from user */
addi r24,r1,STACK_FRAME_OVERHEAD
- std r24,THREAD+PT_REGS(r13)
+ ld r22, PACACURRENT(r13)
+ std r24,THREAD+PT_REGS(r22)
2:
SET_REG_TO_CONST(r22, MSR_KERNEL)
#ifdef DO_SOFT_DISABLE
- stb r20,PACAPROCENABLED(r23) /* possibly soft enable */
+#warning FIX ISERIES
+ stb r20,PACAPROCENABLED(r13) /* possibly soft enable */
ori r22,r22,MSR_EE /* always hard enable */
#else
rldimi r22,r20,15,48 /* Insert desired EE value */
/* Set up a paca value for this processor. */
LOADADDR(r24, paca) /* Get base vaddr of paca array */
- mulli r25,r3,PACA_SIZE /* Calculate vaddr of right paca */
- add r25,r25,r24 /* for this processor. */
+ mulli r13,r3,PACA_SIZE /* Calculate vaddr of right paca */
+ add r13,r13,r24 /* for this processor. */
- mtspr SPRG3,r25 /* Save vaddr of paca in SPRG3 */
+ mtspr SPRG3,r13 /* Save vaddr of paca in SPRG3 */
mr r24,r3 /* __secondary_start needs cpu# */
1:
HMT_LOW
- lbz r23,PACAPROCSTART(r25) /* Test if this processor should */
+ lbz r23,PACAPROCSTART(r13) /* Test if this processor should */
/* start. */
sync
/* Create a temp kernel stack for use before relocation is on. */
- mr r1,r25
+ mr r1,r13
addi r1,r1,PACAGUARD
addi r1,r1,0x1000
subi r1,r1,STACK_FRAME_OVERHEAD
#endif /* CONFIG_SMP */
/* enable use of FP after return */
ori r23,r23,MSR_FP|MSR_FE0|MSR_FE1
- addi r5,r13,THREAD /* Get THREAD */
+ ld r4, PACACURRENT(r13)
+ addi r5,r4,THREAD /* Get THREAD */
lfd fr0,THREAD_FPSCR-4(r5)
mtfsf 0xff,fr0
REST_32FPRS(0, r5)
ori r3,r3,MSR_FP
std r3,_MSR(r1) /* enable use of FP after return */
LOADADDR(r3,86f)
- mfspr r4,SPRG3 /* Get PACA */
- ld r4,PACACURRENT(r4) /* current */
+ ld r4,PACACURRENT(r13) /* current */
ld r5,_NIP(r1)
b .ret_from_except
86: .string "floating point used in kernel (task=%p, pc=%x)\n"
* On entry the following are set:
* r1 = stack pointer. vaddr for iSeries, raddr (temp stack) for pSeries
* r24 = cpu# (in Linux terms)
- * r25 = paca virtual address
+ * r13 = paca virtual address
* SPRG3 = paca virtual address
*/
_GLOBAL(__secondary_start)
addi r2,r2,0x4000
addi r2,r2,0x4000
- std r2,PACATOC(r25)
+ std r2,PACATOC(r13)
li r6,0
- std r6,PACAKSAVE(r25)
- stb r6,PACAPROCENABLED(r25)
+ std r6,PACAKSAVE(r13)
+ stb r6,PACAPROCENABLED(r13)
#ifndef CONFIG_PPC_ISERIES
/* Initialize the page table pointer register. */
mtspr SDR1,r6 /* set the htab location */
#endif
/* Initialize the first segment table (or SLB) entry */
- ld r3,PACASTABVIRT(r25) /* get addr of segment table */
+ ld r3,PACASTABVIRT(r13) /* get addr of segment table */
bl .stab_initialize
- /* load current into r13 */
- ld r13,PACACURRENT(r25)
-
/* Initialize the kernel stack. Just a repeat for iSeries. */
LOADADDR(r3,current_set)
sldi r28,r24,3 /* get current_set[cpu#] */
addi r1,r1,THREAD_SIZE
subi r1,r1,STACK_FRAME_OVERHEAD
- ld r3,PACASTABREAL(r25) /* get raddr of segment table */
+ ld r3,PACASTABREAL(r13) /* get raddr of segment table */
ori r4,r3,1 /* turn on valid bit */
#ifdef CONFIG_PPC_ISERIES
/* Get the pointer to the segment table which is used by */
/* stab_initialize */
- li r27,0x4000
- ld r6,PACA(r27) /* Get the base paca pointer */
- sub r6,r6,r26 /* convert to physical addr */
- mtspr SPRG3,r6 /* PPPBBB: Temp... -Peter */
- ld r3,PACASTABREAL(r6)
+ LOADADDR(r27, boot_cpuid)
+ sub r27,r27,r26
+ lwz r27,0(r27)
+
+ LOADADDR(r24, paca) /* Get base vaddr of paca array */
+ mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */
+ add r13,r13,r24 /* for this processor. */
+ sub r13,r13,r26 /* convert to physical addr */
+
+ mtspr SPRG3,r13 /* PPPBBB: Temp... -Peter */
+ li r3,0x5000
+ std r3,PACASTABREAL(r13)
+ LOADADDR(r24, __start_stab)
+ std r24,PACASTABVIRT(r13)
ori r4,r3,1 /* turn on valid bit */
/* set the ASR */
addi r8,r8,0x4000
std r8,0(r9) /* set the value of the naca ptr */
- LOADADDR(r4,naca) /* Get naca ptr address */
- ld r4,0(r4) /* Get the location of the naca */
- ld r4,PACA(r4) /* Get the base paca pointer */
- mtspr SPRG3,r4
+ LOADADDR(r26, boot_cpuid)
+ lwz r26,0(r26)
+
+ LOADADDR(r24, paca) /* Get base vaddr of paca array */
+ mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
+ add r13,r13,r24 /* for this processor. */
+ mtspr SPRG3,r13
/* ptr to current */
- LOADADDR(r13,init_task)
- std r13,PACACURRENT(r4)
+ LOADADDR(r4,init_task)
+ std r4,PACACURRENT(r13)
- std r2,PACATOC(r4)
+ std r2,PACATOC(r13)
li r5,0
- std r0,PACAKSAVE(r4)
+ std r0,PACAKSAVE(r13)
/* ptr to hardware interrupt stack for processor 0 */
LOADADDR(r3, hardware_int_paca0)
subi r5,r5,STACK_FRAME_OVERHEAD
add r3,r3,r5
- std r3,PACAHRDWINTSTACK(r4)
+ std r3,PACAHRDWINTSTACK(r13)
li r3,0
- stb r3,PACAHRDWINTCOUNT(r4)
+ stb r3,PACAHRDWINTCOUNT(r13)
/* Restore the parms passed in from the bootloader. */
mr r3,r31
/* Load up the kernel context */
5:
#ifdef DO_SOFT_DISABLE
+#warning FIX ISERIES
mfspr r4,SPRG3
li r5,0
stb r5,PACAPROCENABLED(r4) /* Soft Disabled */
hardware_int_paca0:
.space 8*4096
-/* 1 page segment table per cpu (max 48, cpu0 allocated at 0x5000) */
+/* 1 page segment table per cpu (max 48) */
.globl stab_array
stab_array:
- .space 4096 * (48 - 1)
+ .space 4096 * 48
/*
* This space gets a copy of optional info passed to us by the bootstrap