Initial multi-i386 support for *BSD

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-13 21:04:19 +01:00
parent c30074e344
commit 8874cbbded
4 changed files with 30 additions and 25 deletions

View file

@ -102,7 +102,7 @@ bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = aout.mod play.mod serial.mod \
pkglib_MODULES = play.mod serial.mod \
memdisk.mod pci.mod lspci.mod reboot.mod \
halt.mod datetime.mod date.mod datehook.mod \
lsmmap.mod mmap.mod
@ -150,18 +150,6 @@ multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
pkglib_MODULES += bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For play.mod.
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -119,7 +119,7 @@ pkglib_MODULES = biosdisk.mod chain.mod \
reboot.mod halt.mod \
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
vga.mod memdisk.mod pci.mod lspci.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
pxe.mod pxecmd.mod datetime.mod date.mod \
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
efiemu.mod mmap.mod acpi.mod drivemap.mod
@ -253,17 +253,6 @@ lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For usb.mod
usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
usb_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -33,3 +33,16 @@ pkglib_MODULES += linux.mod
linux_mod_SOURCES = loader/i386/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod
pkglib_MODULES += aout.mod
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
pkglib_MODULES += bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)

View file

@ -37,6 +37,9 @@
#ifdef GRUB_MACHINE_PCBIOS
#include <grub/machine/biosnum.h>
#endif
#ifdef GRUB_MACHINE_EFI
#include <grub/efi/efi.h>
#endif
#include <grub/disk.h>
#include <grub/device.h>
#include <grub/partition.h>
@ -553,6 +556,9 @@ grub_freebsd_boot (void)
if (err)
return err;
if (! grub_efi_finish_boot_services ())
grub_fatal ("cannot exit boot services");
pagetable = p - (4096 * 3);
fill_bsd64_pagetable (pagetable, (pagetable - p0) + p_target);
@ -579,6 +585,9 @@ grub_freebsd_boot (void)
if (err)
return err;
if (! grub_efi_finish_boot_services ())
grub_fatal ("cannot exit boot services");
grub_memcpy (&stack[8], &bi, sizeof (bi));
state.eip = entry;
state.esp = stack_target;
@ -684,6 +693,9 @@ grub_openbsd_boot (void)
buf = (grub_uint8_t *) pa;
argbuf_target_end = buf - buf0 + buf_target;
if (! grub_efi_finish_boot_services ())
grub_fatal ("cannot exit boot services");
state.eip = entry;
state.esp = ((grub_uint8_t *) stack - buf0) + buf_target;
stack[0] = entry;
@ -804,6 +816,9 @@ grub_netbsd_boot (void)
if (err)
return err;
if (! grub_efi_finish_boot_services ())
grub_fatal ("cannot exit boot services");
state.eip = entry;
state.esp = stack_target;
stack[0] = entry;