Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JOt9N-0005iU-CM for mharc-grub-devel@gnu.org; Tue, 12 Feb 2008 06:18:09 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOt9L-0005gw-6R for grub-devel@gnu.org; Tue, 12 Feb 2008 06:18:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOt9I-0005fN-NO for grub-devel@gnu.org; Tue, 12 Feb 2008 06:18:06 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOt9I-0005f6-Ai for grub-devel@gnu.org; Tue, 12 Feb 2008 06:18:04 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JOt9H-00009w-Vk for grub-devel@gnu.org; Tue, 12 Feb 2008 06:18:04 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JOt9F-0002Qq-Nm for grub-devel@gnu.org; Tue, 12 Feb 2008 12:18:03 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JOt7W-0004vX-Il for grub-devel@gnu.org; Tue, 12 Feb 2008 12:16:14 +0100 Date: Tue, 12 Feb 2008 12:16:14 +0100 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080212111614.GB18073@thorin> References: <20080211212816.GA1064@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] a.out support for multiboot and freebsd X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2008 11:18:07 -0000 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 I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.)