From: Scott Wood <scottwood@freescale.com>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
Michael Neuling <mikey@neuling.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: BOOKE KVM calling load_up_fpu from C?
Date: Wed, 13 Feb 2013 11:37:27 -0600 [thread overview]
Message-ID: <1360777047.6853.3@snotra> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D065A3511@039-SN2MPN1-023.039d.mgd.msft.net> (from R65777@freescale.com on Tue Feb 12 22:17:00 2013)
On 02/12/2013 10:17:00 PM, Bhushan Bharat-R65777 wrote:
>=20
>=20
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Wednesday, February 13, 2013 6:53 AM
> > To: Bhushan Bharat-R65777
> > Cc: Wood Scott-B07421; Michael Neuling; =20
> linuxppc-dev@lists.ozlabs.org
> > Subject: Re: BOOKE KVM calling load_up_fpu from C?
> >
> > On 02/12/2013 07:18:14 PM, Bhushan Bharat-R65777 wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Wednesday, February 13, 2013 12:03 AM
> > > > To: Bhushan Bharat-R65777
> > > > Cc: Michael Neuling; Wood Scott-B07421;
> > > linuxppc-dev@lists.ozlabs.org
> > > > Subject: Re: BOOKE KVM calling load_up_fpu from C?
> > > >
> > > > On 64-bit, though, there's a store to the caller's stack frame
> > > > (yuck) which the kvm/booke.h caller is not prepared for.
> > >
> > > So if caller is using r12 then it can lead to come corruption, =20
> right ?
> >
> > No, r12 is a volatile register in the ABI, as is r9. The issue is =20
> that the
> > stack can be corrupted.
>=20
> What do you mean by stack is corrupted?
load_up_fpu() makes assumptions about the caller's stack frame that =20
aren't true when called from C code.
> My understanding is that when calling the assembly function from C =20
> function then stack frame will not be pushed and assembly function =20
> uses the caller stack frame.
Huh? Assembly functions obey the same ABI as C functions (at least, =20
asm functions meant to be callable from C do). If the above were true, =20
how would C code know that it's calling an asm function, and how would =20
it know how much stack to create and which portions would be clobbered?
The issue with load_up_fpu() is that it was apparently not meant to be =20
called directly from C code.
-Scott=
prev parent reply other threads:[~2013-02-13 17:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 3:29 BOOKE KVM calling load_up_fpu from C? Michael Neuling
2013-02-12 3:37 ` Bhushan Bharat-R65777
2013-02-12 3:46 ` Michael Neuling
2013-02-12 3:58 ` Bhushan Bharat-R65777
2013-02-12 4:16 ` Michael Neuling
2013-02-12 9:01 ` Bhushan Bharat-R65777
2013-02-12 18:33 ` Scott Wood
2013-02-12 22:51 ` Michael Neuling
2013-02-13 1:18 ` Bhushan Bharat-R65777
2013-02-13 1:23 ` Scott Wood
2013-02-13 1:26 ` Bhushan Bharat-R65777
2013-02-13 4:17 ` Bhushan Bharat-R65777
2013-02-13 17:37 ` Scott Wood [this message]
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=1360777047.6853.3@snotra \
--to=scottwood@freescale.com \
--cc=B07421@freescale.com \
--cc=R65777@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.