lkml.org 
[lkml]   [2020]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v28 21/22] x86/vdso: Implement a vDSO for Intel SGX enclave call
On Thu, Mar 19, 2020 at 12:01:26AM +0200, Jarkko Sakkinen wrote:
> On Mon, Mar 16, 2020 at 04:56:42PM -0700, Xing, Cedric wrote:
> > On 3/16/2020 3:55 PM, Sean Christopherson wrote:
> > > On Mon, Mar 16, 2020 at 02:31:36PM +0100, Jethro Beekman wrote:
> > > > Can someone remind me why we're not passing TCS in RBX but on the stack?
> > >
> > > I finally remembered why. It's pulled off the stack and passed into the
> > > exit handler. I'm pretty sure the vDSO could take it in %rbx and manually
> > > save it on the stack, but I'd rather keep the current behavior so that the
> > > vDSO is callable from C (assuming @leaf is changed to be passed via %rcx).
> > >
> > The idea is that the caller of this vDSO API is C callable, hence it cannot
> > receive TCS in %rbx anyway. Then it has to either MOV to %rbx or PUSH to
> > stack. Either way the complexity is the same. The vDSO API however has to
> > always save it on stack for exit handler. So receiving it via stack ends up
> > in simplest code.
>
> It is never C callable anyway given that not following the ABI so
> who cares about being C callable anyway?

A direct quote from the documentation:

"**Important!** __vdso_sgx_enter_enclave() is **NOT** compliant with
the x86-64 ABI, i.e. cannot be called from standard C code."

/Jarkko

\
 
 \ /
  Last update: 2020-03-18 23:18    [W:0.070 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site