linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Tjernlund <tjernlund@tjernlund.se>
Cc: Linuxppc-Dev <linuxppc-dev@ozlabs.org>,
	'Linh Dang' <linhd@nortel.com>,
	uclibc@uclibc.org
Subject: Re: Linux process ABI broken in 2.6?
Date: Fri, 09 Dec 2005 13:05:00 +1100	[thread overview]
Message-ID: <1134093900.11760.66.camel@gaston> (raw)
In-Reply-To: <000e01c5fc4c$25b17cb0$020120ac@Jocke>

On Fri, 2005-12-09 at 00:07 +0100, Tjernlund wrote:
> Seems like ppc32 kernel pass the application entry point address
> in r7 and MSR in r8 when starting the application. The source might be
> ret_from_syscall, in entry.S: 
> 	...
> 	lwz	r7,_NIP(r1)
>  	lwz	r8,_MSR(r1)
>  	FIX_SRR1(r8, r0)
>  	lwz	r2,GPR2(r1)
> 	lwz	r1,GPR1(r1)
> 	mtspr	SPRN_SRR0,r7
> 	mtspr	SPRN_SRR1,r8
> 	SYNC
> 	RFI
> I am not convinced this is the source, but a non zero r7
> breaks static apps in uClibc.
> 
> Is this on purpose and why?
> 
> Secion 8.4.1 in
> http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-PPC32/LSB-Core-PPC32.html#PROCESSINITIALIZATION
> 
> says:
> "Contrary to what is stated in the Registers part of chapter 3 of the System V Application Binary Interface PowerPC Processor
> Supplement there are no values set in registers r3, r4, r5, r6 and r7. Instead the values specified to appear in all of those
> registers except r7 are placed on the stack. The value to be placed into register r7, the termination function pointer is not passed
> to the process."
> 
> How do one not pass a termination function in r7 other than setting
> r7 to zero?

Just ignore those registers on entry. The semantics of a syscall are to
clobber all volatile registers and there is no point doing anything
else.

Ben.

  reply	other threads:[~2005-12-09  2:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 23:07 Linux process ABI broken in 2.6? Tjernlund
2005-12-09  2:05 ` Benjamin Herrenschmidt [this message]
2005-12-09  3:16 ` Paul Mackerras
  -- strict thread matches above, loose matches on Subject: below --
2005-12-09 11:05 Joakim Tjernlund
2005-12-12  2:28 ` Paul Mackerras
2005-12-11 15:11 Joakim Tjernlund
2005-12-12  8:09 Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1134093900.11760.66.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=linhd@nortel.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=tjernlund@tjernlund.se \
    --cc=uclibc@uclibc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).