The calling conventions are detailed here, in case it helps.

http://en.wikipedia.org/wiki/X86_calling_conventions



From: Jarrod B Johnson [mailto:[email protected]]
Sent: Tuesday, August 16, 2011 2:21 PM
To: Jarrod B Johnson
Cc: [email protected]
Subject: Re: [elilo-discuss] EFI callback workings...


Ok, figured it out through careful examination of uefi_call_wrapper and the 
assembly that backed it.

It wasn't reversed, it was just that the 3rd and 4th arguments happened to be 
zero and thus matched RDI and RSI, and gave the appearance of reversed if you 
assume too easily.

So in GCC world, we seem to expect the caller to have done rdi, rsi, rdx, rcx, 
r8, r9. However, in UEFI world the MS convention is king and so rdi and rsi are 
meaningless, rdx and rcx are swapped, and r8 and r9 are in order, just off by 
two. Thankfully, I don't need more than 4 arguments to figure out the other 
magic.

Perusing through, I didn't see any documentation or facility for the converse 
of uefi_call_wrapper to rearrange the stack in the way a gcc would work. Any 
thoughts?

[cid:[email protected]]Jarrod B Johnson---08/16/2011 01:51:25 
PM---So I'm working on implementing support in netfs for IPXE download 
protocol, if available.

From: Jarrod B Johnson/Raleigh/IBM@IBMUS
To: [email protected]
Date: 08/16/2011 01:51 PM
Subject: [elilo-discuss] EFI callback workings...

________________________________



So I'm working on implementing support in netfs for IPXE download protocol, if 
available.

The thing I'm hitting is that when iPXE goes to invoke the callback, the 
argument list seems reversed. I know how to kind of brute force this scenario, 
but was wondering if there was some more sane looking way to cope.

For example, assume:
iPXE calls data callback with:
*context, *buffer, length, offset
0xaddf, 0xcdde, 1024, 0

And if I have elilo print out the arguments in order, I get:
0, 1024, 0xcdde, 0xaddf

I see quite a bit of dancing in gnu-efi to have code call into uefi provided 
functions, but wasn't clear on the 
converse...------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
elilo-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/elilo-discuss

<<inline: image001.gif>>

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
elilo-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/elilo-discuss

Reply via email to