[PATCH] -mminimal-toc removal 2: Add required nops
Anton Blanchard
anton at samba.org
Tue Aug 24 23:18:50 EST 2004
Add nops after function calls where required. The linker may need to
restore r2.
Signed-off-by: Anton Blanchard <anton at samba.org>
---
mminimal_toc_die_die_die-anton/arch/ppc64/kernel/entry.S | 25 ++++++-
mminimal_toc_die_die_die-anton/arch/ppc64/kernel/head.S | 52 ++++++++++++++-
mminimal_toc_die_die_die-anton/arch/ppc64/kernel/misc.S | 2
3 files changed, 76 insertions(+), 3 deletions(-)
diff -puN arch/ppc64/kernel/entry.S~mminimal_toc_die_die_die_2 arch/ppc64/kernel/entry.S
--- mminimal_toc_die_die_die/arch/ppc64/kernel/entry.S~mminimal_toc_die_die_die_2 2004-08-24 19:50:08.942397929 +1000
+++ mminimal_toc_die_die_die-anton/arch/ppc64/kernel/entry.S 2004-08-24 19:50:08.976395316 +1000
@@ -110,6 +110,7 @@ SystemCall_common:
#ifdef SHOW_SYSCALLS
bl .do_show_syscall
+ nop
REST_GPR(0,r1)
REST_4GPRS(3,r1)
REST_2GPRS(7,r1)
@@ -150,6 +151,7 @@ syscall_exit:
#ifdef SHOW_SYSCALLS
std r3,GPR3(r1)
bl .do_show_syscall_exit
+ nop
ld r3,GPR3(r1)
#endif
std r3,RESULT(r1)
@@ -216,6 +218,7 @@ syscall_dotrace:
bl .save_nvgprs
addi r3,r1,STACK_FRAME_OVERHEAD
bl .do_syscall_trace_enter
+ nop
ld r0,GPR0(r1) /* Restore original registers */
ld r3,GPR3(r1)
ld r4,GPR4(r1)
@@ -232,6 +235,7 @@ syscall_exit_trace:
std r3,GPR3(r1)
bl .save_nvgprs
bl .do_syscall_trace_leave
+ nop
REST_NVGPRS(r1)
ld r3,GPR3(r1)
ld r5,_CCR(r1)
@@ -265,53 +269,64 @@ _GLOBAL(save_nvgprs)
_GLOBAL(ppc32_sigsuspend)
bl .save_nvgprs
bl .sys32_sigsuspend
+ nop
b syscall_exit
_GLOBAL(ppc64_rt_sigsuspend)
bl .save_nvgprs
bl .sys_rt_sigsuspend
+ nop
b syscall_exit
_GLOBAL(ppc32_rt_sigsuspend)
bl .save_nvgprs
bl .sys32_rt_sigsuspend
+ nop
b syscall_exit
_GLOBAL(ppc_fork)
bl .save_nvgprs
bl .sys_fork
+ nop
b syscall_exit
_GLOBAL(ppc_vfork)
bl .save_nvgprs
bl .sys_vfork
+ nop
b syscall_exit
_GLOBAL(ppc_clone)
bl .save_nvgprs
bl .sys_clone
+ nop
b syscall_exit
_GLOBAL(ppc32_swapcontext)
bl .save_nvgprs
bl .sys32_swapcontext
+ nop
b 80f
_GLOBAL(ppc64_swapcontext)
bl .save_nvgprs
bl .sys_swapcontext
+ nop
b 80f
_GLOBAL(ppc32_sigreturn)
bl .sys32_sigreturn
+ nop
b 80f
_GLOBAL(ppc32_rt_sigreturn)
bl .sys32_rt_sigreturn
+ nop
b 80f
_GLOBAL(ppc64_rt_sigreturn)
bl .sys_rt_sigreturn
+ nop
80: cmpdi 0,r3,0
blt syscall_exit
@@ -320,10 +335,12 @@ _GLOBAL(ppc64_rt_sigreturn)
andi. r4,r4,_TIF_SYSCALL_T_OR_A
beq+ 81f
bl .do_syscall_trace_leave
+ nop
81: b .ret_from_except
_GLOBAL(ret_from_fork)
bl .schedule_tail
+ nop
REST_NVGPRS(r1)
li r3,0
b syscall_exit
@@ -492,6 +509,7 @@ restore:
mtmsrd r10 /* hard-enable again */
addi r3,r1,STACK_FRAME_OVERHEAD
bl .do_IRQ
+ nop
b .ret_from_except /* loop back and handle more */
4: stb r5,PACAPROCENABLED(r13)
@@ -568,6 +586,7 @@ do_work:
#endif
mtmsrd r10,1 /* reenable interrupts */
bl .schedule
+ nop
mfmsr r10
clrrdi r9,r1,THREAD_SHIFT
rldicl r10,r10,48,1 /* disable interrupts again */
@@ -588,17 +607,20 @@ user_work:
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
bl .schedule
+ nop
b .ret_from_except_lite
1: bl .save_nvgprs
li r3,0
addi r4,r1,STACK_FRAME_OVERHEAD
bl .do_signal
+ nop
b .ret_from_except
unrecov_restore:
addi r3,r1,STACK_FRAME_OVERHEAD
bl .unrecoverable_exception
+ nop
b unrecov_restore
#ifdef CONFIG_PPC_PSERIES
@@ -769,7 +791,8 @@ _GLOBAL(enter_prom)
std r11,_MSR(r1)
/* Get the PROM entrypoint */
- bl .reloc_offset
+ bl .reloc_offset
+ nop
LOADADDR(r12,prom)
sub r12,r12,r3
ld r12,PROMENTRY(r12)
diff -puN arch/ppc64/kernel/head.S~mminimal_toc_die_die_die_2 arch/ppc64/kernel/head.S
--- mminimal_toc_die_die_die/arch/ppc64/kernel/head.S~mminimal_toc_die_die_die_2 2004-08-24 19:50:08.948397468 +1000
+++ mminimal_toc_die_die_die-anton/arch/ppc64/kernel/head.S 2004-08-24 19:50:08.985394624 +1000
@@ -386,9 +386,12 @@ label##_common: \
EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
DISABLE_INTS; \
bl .save_nvgprs; \
+ nop; \
addi r3,r1,STACK_FRAME_OVERHEAD; \
bl hdlr; \
- b .ret_from_except
+ nop; \
+ b .ret_from_except; \
+ nop
#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \
.align 7; \
@@ -397,7 +400,9 @@ label##_common: \
DISABLE_INTS; \
addi r3,r1,STACK_FRAME_OVERHEAD; \
bl hdlr; \
- b .ret_from_except_lite
+ nop; \
+ b .ret_from_except_lite; \
+ nop
/*
* Start of pSeries system interrupt routines
@@ -777,9 +782,12 @@ MachineCheck_common:
EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
DISABLE_INTS
bl .save_nvgprs
+ nop
addi r3,r1,STACK_FRAME_OVERHEAD
bl .MachineCheckException
+ nop
b .ret_from_except
+ nop
STD_EXCEPTION_COMMON_LITE(0x900, Decrementer, .timer_interrupt)
STD_EXCEPTION_COMMON(0xa00, Trap_0a, .UnknownException)
@@ -832,6 +840,7 @@ bad_stack:
ld r2,PACATOC(r13)
1: addi r3,r1,STACK_FRAME_OVERHEAD
bl .kernel_bad_stack
+ nop
b 1b
/*
@@ -871,8 +880,10 @@ fast_exception_return:
unrecov_fer:
bl .save_nvgprs
+ nop
1: addi r3,r1,STACK_FRAME_OVERHEAD
bl .unrecoverable_exception
+ nop
b 1b
/*
@@ -908,7 +919,9 @@ HardwareInterrupt_entry:
DISABLE_INTS
addi r3,r1,STACK_FRAME_OVERHEAD
bl .do_IRQ
+ nop
b .ret_from_except_lite
+ nop
.align 7
Alignment_common:
@@ -922,28 +935,36 @@ Alignment_common:
std r3,_DAR(r1)
std r4,_DSISR(r1)
bl .save_nvgprs
+ nop
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
bl .AlignmentException
+ nop
b .ret_from_except
+ nop
.align 7
ProgramCheck_common:
EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
bl .save_nvgprs
+ nop
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
bl .ProgramCheckException
+ nop
b .ret_from_except
+ nop
.align 7
FPUnavailable_common:
EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
bne load_up_fpu /* if from user, just load it up */
bl .save_nvgprs
+ nop
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
bl .KernelFPUnavailableException
+ nop
BUG_OPCODE
.align 7
@@ -953,10 +974,13 @@ AltivecUnavailable_common:
bne load_up_altivec /* if from user, just load it up */
#endif
bl .save_nvgprs
+ nop
addi r3,r1,STACK_FRAME_OVERHEAD
ENABLE_INTS
bl .AltivecUnavailableException
+ nop
b .ret_from_except
+ nop
/*
* Hash table stuff
@@ -999,6 +1023,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
* at return r3 = 0 for success
*/
bl .hash_page /* build HPTE if possible */
+ nop
cmpdi r3,0 /* see if hash_page succeeded */
#ifdef DO_SOFT_DISABLE
@@ -1011,6 +1036,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
* interrupts if necessary.
*/
beq .ret_from_except_lite
+ nop
/*
* hash_page couldn't handle it, set soft interrupt enable back
* to what it was before the trap. Note that .local_irq_restore
@@ -1031,14 +1057,19 @@ handle_page_fault:
ld r5,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
bl .do_page_fault
+ nop
cmpdi r3,0
beq+ .ret_from_except_lite
+ nop
bl .save_nvgprs
+ nop
mr r5,r3
addi r3,r1,STACK_FRAME_OVERHEAD
lwz r4,_DAR(r1)
bl .bad_page_fault
+ nop
b .ret_from_except
+ nop
/* here we have a segment miss */
do_ste_alloc:
@@ -1158,6 +1189,7 @@ do_slb_miss:
std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
bl .slb_allocate /* handle it */
+ nop
/* All done -- return from exception. */
@@ -1191,8 +1223,10 @@ unrecov_slb:
EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
DISABLE_INTS
bl .save_nvgprs
+ nop
1: addi r3,r1,STACK_FRAME_OVERHEAD
bl .unrecoverable_exception
+ nop
b 1b
@@ -1256,6 +1290,7 @@ _GLOBAL(__start_initialization_iSeries)
LOADADDR(r4,cur_cpu_spec)
li r5,0
bl .identify_cpu
+ nop
LOADADDR(r2,__toc_start)
addi r2,r2,0x4000
@@ -1304,6 +1339,7 @@ __start_initialization_pSeries:
/* put a relocation offset into r3 */
bl .reloc_offset
+ nop
LOADADDR(r2,__toc_start)
addi r2,r2,0x4000
@@ -1321,6 +1357,7 @@ __start_initialization_pSeries:
/* Do all of the interaction with OF client interface */
bl .prom_init
+ nop
mr r23,r3 /* Save phys address we are running at */
/* Setup some critical 970 SPRs before switching MMU off */
@@ -1352,6 +1389,7 @@ after_prom_start:
* r27 == KERNELBASE
*/
bl .reloc_offset
+ nop
mr r26,r3
SET_REG_TO_CONST(r27,KERNELBASE)
@@ -1725,6 +1763,7 @@ _GLOBAL(__secondary_start)
/* Initialize the first segment table (or SLB) entry */
ld r3,PACASTABVIRT(r13) /* get addr of segment table */
bl .stab_initialize
+ nop
/* Initialize the kernel stack. Just a repeat for iSeries. */
LOADADDR(r3,current_set)
@@ -1786,6 +1825,7 @@ start_secondary_prolog:
li r3,0
std r3,0(r1) /* Zero the stack frame pointer */
bl .start_secondary
+ nop
#endif
/*
@@ -1810,6 +1850,7 @@ enable_64b_mode:
start_here_pSeries:
/* get a new offset, now that the kernel has moved. */
bl .reloc_offset
+ nop
mr r26,r3
mfmsr r6
@@ -1883,6 +1924,7 @@ start_here_pSeries:
sub r4,r4,r26
mr r5,r26
bl .identify_cpu
+ nop
/* Get the pointer to the segment table which is used by */
/* stab_initialize */
@@ -1923,7 +1965,9 @@ start_here_pSeries:
/* Initialize an initial memory mapping and turn on relocation. */
bl .stab_initialize
+ nop
bl .htab_initialize
+ nop
li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */
lwz r3,PLATFORM(r3) /* r3 = platform flags */
@@ -1962,6 +2006,7 @@ start_here_common:
*/
li r3,0
bl .do_cpu_ftr_fixups
+ nop
/* setup the systemcfg pointer */
LOADADDR(r9,systemcfg)
@@ -1997,6 +2042,7 @@ start_here_common:
mr r7,r27
bl .setup_system
+ nop
/* Load up the kernel context */
5:
@@ -2009,6 +2055,7 @@ start_here_common:
#endif
bl .start_kernel
+ nop
_GLOBAL(__setup_cpu_power3)
blr
@@ -2062,6 +2109,7 @@ __hmt_secondary_hold:
#endif
mr r3,r24
b .pseries_secondary_smp_init
+ nop
#ifdef CONFIG_HMT
hmt_start_secondary:
diff -puN arch/ppc64/kernel/misc.S~mminimal_toc_die_die_die_2 arch/ppc64/kernel/misc.S
--- mminimal_toc_die_die_die/arch/ppc64/kernel/misc.S~mminimal_toc_die_die_die_2 2004-08-24 19:50:08.954397007 +1000
+++ mminimal_toc_die_die_die-anton/arch/ppc64/kernel/misc.S 2004-08-24 19:50:08.988394393 +1000
@@ -110,6 +110,7 @@ _GLOBAL(call_do_softirq)
stdu r1,THREAD_SIZE-112(r3)
mr r1,r3
bl .__do_softirq
+ nop
ld r1,0(r1)
ld r0,16(r1)
mtlr r0
@@ -121,6 +122,7 @@ _GLOBAL(call_handle_irq_event)
stdu r1,THREAD_SIZE-112(r6)
mr r1,r6
bl .handle_irq_event
+ nop
ld r1,0(r1)
ld r0,16(r1)
mtlr r0
_
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list