grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] a.out support for multiboot and freebsd


From: Robert Millan
Subject: Re: [PATCH] a.out support for multiboot and freebsd
Date: Tue, 12 Feb 2008 12:16:14 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Feb 12, 2008 at 05:46:49AM +0800, Bean wrote:
> > > +_bsd_mod_CFLAGS = $(COMMON_CFLAGS)
> > > +_bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
> > > +
> > > +# For freebsd.mod
> > > +bsd_mod_SOURCES = loader/i386/pc/bsd_normal.c
> > > +bsd_mod_CFLAGS = $(COMMON_CFLAGS)
> > > +bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
> >
> > How much pc-dependant are those?  Can we hope they will work in e.g.
> > i386-coreboot in the future, when *BSD kernels remove their BIOS
> > dependency?
> 
> freebsd doesn't need bios at all, openbsd need the memory map, but i
> guess it's easy to construct one without using int 15.

In that case, loader/i386/ would be better than loader/i386/pc.  Moving files
in CVS is painful ;-)

> > > +FUNCTION(grub_unix_real_boot)
> > > +        call    EXT_C(grub_dl_unload_all)
> > > +        call    EXT_C(grub_stop_floppy)
> > > +
> > > +        cli
> > > +
> > > +        popl    %eax
> > > +        popl %eax
> > > +        call *%eax
> >
> > Why a call?  Do we need the return address in the stack here?  A comment 
> > would
> > be nice in that case.
> 
> bsds using stack to pass parameter, it's like this:
> 
> void __cdecl (*func)(parm1, parm2,...);
> 
> the first pop remove the return address,  the second gets the address
> of func, and then call it. the function never returns, using call just
> make sure the first parameter is at esp + 4.

Ok.  How about adding a comment to make this clear?  Maybe something like:

/* Use cdecl calling convention for *BSD kernels.  */
FUNCTION(grub_unix_real_boot)
        ....

        /* Discard `grub_unix_real_boot' return address.  */
        popl %eax

        /* Fetch `entry' address ...  */
        popl %eax

        /* ... and put our return address in its place (the kernel will ignore
           it, but it expects %esp to point to it.  */
        call *%eax

does this look good?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]