Thanks, the magic worked and I sent a revised patch on the elilo side to their list. Much saner looking.<br><br><div class="gmail_quote">On Wed, Aug 17, 2011 at 7:13 AM, Michael Brown <span dir="ltr"><<a href="mailto:mbrown@fensystems.co.uk">mbrown@fensystems.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Tuesday 16 Aug 2011 22:03:07 Jarrod Johnson wrote:<br>
> I have patched elilo to use IPXE exported capabilities to download<br>
> kernel/initrd/config. It probably only builds on linux/gcc/x86_64<br>
> combination due to the hackish way I coped with the calling convention<br>
> situation. I'm hoping some UEFI guru will enlighten me on the correct way.<br>
> In short, elilo code seems to have a 'uefi_call_wrapper' to swap the<br>
> registers around to make calls *to* uefi, but does not have a provision for<br>
> calls from UEFI to itself. This means it expected DI, RSI, RDX, RCX, R8,<br>
> R9 to be the arguments instead of RCX, RDX, R8, R9. I'm presuming there is<br>
> GCC magic to be had that I don't understand right now.<br>
<br>
</div>__attribute__((ms_abi)) is the relevant magic. iPXE uses<br>
<br>
#if __x86_64__<br>
#define EFIAPI __attribute__((ms_abi))<br>
#endif<br>
<br>
#if __i386__<br>
#define EFIAPI __attribute__((cdecl,regparm(0)))<br>
#endif<br>
<br>
to make everything work with the stock EFI headers. All EFI headers mark<br>
functions with EFIAPI, so you can just call them without a wrapper:<br>
<br>
efirc = bs->LocateProtocol ( &guid, NULL, protocol ) );<br>
<br>
and you can define callback functions (again, without any wrapper) as<br>
<br>
static EFI_STATUS EFIAPI callback ( EFI_HANDLE handle, ... ) {<br>
...<br>
<div class="im"> }<br>
<br>
> This is the analogous capability for elilo. It comes in two halves. iPXE<br>
> needed to have capabilities exposed in a UEFI protocol in much the same way<br>
> it exports it in 'legacy boot'. Those patches to ipxe are:<br>
> <a href="https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/d748ebf72206dcde1379b0" target="_blank">https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/d748ebf72206dcde1379b0</a><br>
> 63fd9b533f7572caa5<br>
</div>> <a href="https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/e7b41890bc67350a9f5bc" target="_blank">https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/e7b41890bc67350a9f5bc</a><br>
> f7291ec859fa2174e26<br>
> <a href="https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/45a51f99fd51b231a388b" target="_blank">https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/45a51f99fd51b231a388b</a><br>
> 1db00dfc4b18a5e9e4f<br>
> <a href="https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/23aea6c209965546c3956" target="_blank">https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/23aea6c209965546c3956</a><br>
<div class="im">> 9a770823eabf1358a71<br>
><br>
> Apply those and 'make bin-x86_64-efi/snponly.efi and you have something<br>
> much like undionly.kkpxe, but for UEFI.<br>
<br>
</div>Will take a look at those patches as soon as I get a chance, which might not<br>
be for a couple of weeks. Please poke me if I forget!<br>
<font color="#888888"><br>
Michael<br>
</font></blockquote></div><br>