From 9353bd72292d0f11ccf8cc7a56b7e37d6757fff2 Mon Sep 17 00:00:00 2001 From: gonzo Date: Mon, 12 Mar 2012 20:24:59 +0000 Subject: [PATCH 137/175] - Although we pass first 4 arguments in registers, function callinf ABI requires space to be reserved for them in stack. _rtld() prologue saves a1 and a2 in this space. - Whitespace cleanup while I'm at it git-svn-id: http://svn.freebsd.org/base/head@232884 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit 93f7721be3d4b3031b006ca230ed65703a954518) Signed-off-by: Xin Li --- libexec/rtld-elf/mips/rtld_start.S | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libexec/rtld-elf/mips/rtld_start.S b/libexec/rtld-elf/mips/rtld_start.S index 354db13..631f641 100644 --- a/libexec/rtld-elf/mips/rtld_start.S +++ b/libexec/rtld-elf/mips/rtld_start.S @@ -58,28 +58,30 @@ LEAF(rtld_start) PTR_LA a1, 1f bal 1f - PTR_LA t0, _C_LABEL(_rtld_relocate_nonplt_self) + PTR_LA t0, _C_LABEL(_rtld_relocate_nonplt_self) 1: PTR_SUBU a1, ra, a1 /* relocbase */ PTR_LA a0, _DYNAMIC PTR_ADDU t9, a1, t0 jalr t9 /* _rtld_relocate_nonplt_self(dynp, relocabase) */ - PTR_ADDU a0, a1, a0 /* &_DYNAMIC */ + PTR_ADDU a0, a1, a0 /* &_DYNAMIC */ move a0, s0 /* sp */ PTR_ADDU a1, sp, 2*PTR_SIZE /* &our atexit function */ PTR_ADDU a2, sp, 3*PTR_SIZE /* obj_main entry */ + subu sp, 4*SZREG /* ABI requires to reserve memory for 4 regs */ PTR_LA t9, _C_LABEL(_rtld) jalr t9 /* v0 = _rtld(sp, cleanup, objp) */ - nop + nop + addu sp, 4*SZREG PTR_L a1, 2*PTR_SIZE(sp) /* our atexit function */ PTR_L a2, 3*PTR_SIZE(sp) /* obj_main entry */ PTR_ADDU sp, 4*PTR_SIZE /* readjust stack */ move a0, s0 /* stack pointer */ move t9, v0 + subu sp, 4*SZREG /* ABI requires to reserve memory for 4 regs */ jr t9 /* _start(sp, cleanup, obj); */ - move a3, s3 /* restore ps_strings */ - + move a3, s3 /* restore ps_strings */ END(rtld_start) #define XCALLFRAME_SIZ (12*SZREG) @@ -140,7 +142,7 @@ _rtld_bind_start: PTR_LA t9, _C_LABEL(_mips_rtld_bind) jalr t9 - nop + nop move sp, s0 REG_L ra, XCALLFRAME_RA(sp) @@ -159,5 +161,5 @@ _rtld_bind_start: PTR_ADDU sp, XCALLFRAME_SIZ move t9, v0 jr t9 - nop + nop END(_rtld_bind_start) -- 1.7.9.4