[ipxe-devel] elilo patch for iPXE download protocol

Jarrod Johnson jarrod.b.johnson at gmail.com
Wed Aug 17 13:24:21 UTC 2011


Thanks, the magic worked and I sent a revised patch on the elilo side to
their list.  Much saner looking.

On Wed, Aug 17, 2011 at 7:13 AM, Michael Brown <mbrown at fensystems.co.uk>wrote:

> On Tuesday 16 Aug 2011 22:03:07 Jarrod Johnson wrote:
> > I have patched elilo to use IPXE exported capabilities to download
> > kernel/initrd/config.  It probably only builds on linux/gcc/x86_64
> > combination due to the hackish way I coped with the calling convention
> > situation.  I'm hoping some UEFI guru will enlighten me on the correct
> way.
> >  In short, elilo code seems to have a 'uefi_call_wrapper' to swap the
> > registers around to make calls *to* uefi, but does not have a provision
> for
> > calls from UEFI to itself.  This means it expected DI, RSI, RDX, RCX, R8,
> > R9 to be the arguments instead of RCX, RDX, R8, R9.  I'm presuming there
> is
> > GCC magic to be had that I don't understand right now.
>
> __attribute__((ms_abi)) is the relevant magic.  iPXE uses
>
>  #if __x86_64__
>  #define EFIAPI __attribute__((ms_abi))
>  #endif
>
>  #if __i386__
>  #define EFIAPI __attribute__((cdecl,regparm(0)))
>  #endif
>
> to make everything work with the stock EFI headers.  All EFI headers mark
> functions with EFIAPI, so you can just call them without a wrapper:
>
>  efirc = bs->LocateProtocol ( &guid, NULL, protocol ) );
>
> and you can define callback functions (again, without any wrapper) as
>
>  static EFI_STATUS EFIAPI callback ( EFI_HANDLE handle, ... ) {
>    ...
>   }
>
> > This is the analogous capability for elilo. It comes in two halves. iPXE
> > needed to have capabilities exposed in a UEFI protocol in much the same
> way
> > it exports it in 'legacy boot'.  Those patches to ipxe are:
> >
> https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/d748ebf72206dcde1379b0
> > 63fd9b533f7572caa5
> >
> https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/e7b41890bc67350a9f5bc
> > f7291ec859fa2174e26
> >
> https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/45a51f99fd51b231a388b
> > 1db00dfc4b18a5e9e4f
> >
> https://git.ipxe.org/people/jbjohnso/ipxe.git/commit/23aea6c209965546c3956
> > 9a770823eabf1358a71
> >
> > Apply those and 'make bin-x86_64-efi/snponly.efi and you have something
> >  much like undionly.kkpxe, but for UEFI.
>
> Will take a look at those patches as soon as I get a chance, which might
> not
> be for a couple of weeks.  Please poke me if I forget!
>
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20110817/91059742/attachment.htm>


More information about the ipxe-devel mailing list