2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>

* include/grub/i386/bsd.h (FREEBSD_N_BIOS_GEOM): Removed.
	(grub_freebsd_bootinfo): Rewritten.
	* loader/i386/bsd.c (grub_freebsd_boot): Use new grub_freebsd_bootinfo.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-21 17:35:14 +01:00
parent 01fc7054b9
commit f9ab2e25d3
3 changed files with 27 additions and 29 deletions

View file

@ -1,3 +1,9 @@
2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i386/bsd.h (FREEBSD_N_BIOS_GEOM): Removed.
(grub_freebsd_bootinfo): Rewritten.
* loader/i386/bsd.c (grub_freebsd_boot): Use new grub_freebsd_bootinfo.
2010-01-21 Vladimir Serbinenko <phcoder@gmail.com>
* util/misc.c (make_system_path_relative_to_its_root): Fix typo.

View file

@ -44,33 +44,25 @@ enum bsd_kernel_types
#define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
#define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
#define FREEBSD_BOOTINFO_VERSION 1
#define FREEBSD_N_BIOS_GEOM 8
#define FREEBSD_MODTYPE_KERNEL "elf kernel"
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
#define FREEBSD_MODTYPE_ELF_MODULE "elf module"
#define FREEBSD_MODTYPE_ELF_MODULE_OBJ "elf obj module"
#define FREEBSD_MODTYPE_RAW "raw"
#define FREEBSD_BOOTINFO_VERSION 1
struct grub_freebsd_bootinfo
{
grub_uint32_t bi_version;
grub_uint8_t *bi_kernelname;
struct nfs_diskless *bi_nfs_diskless;
grub_uint32_t bi_n_bios_used;
grub_uint32_t bi_bios_geom[FREEBSD_N_BIOS_GEOM];
grub_uint32_t bi_size;
grub_uint8_t bi_memsizes_valid;
grub_uint8_t bi_bios_dev;
grub_uint8_t bi_pad[2];
grub_uint32_t bi_basemem;
grub_uint32_t bi_extmem;
grub_uint32_t bi_symtab;
grub_uint32_t bi_esymtab;
grub_uint32_t bi_kernend;
grub_uint32_t bi_envp;
grub_uint32_t bi_modulep;
grub_uint32_t version;
grub_uint8_t unused1[44];
grub_uint32_t length;
grub_uint8_t unused2;
grub_uint8_t boot_device;
grub_uint8_t unused3[18];
grub_uint32_t kern_end;
grub_uint32_t environment;
grub_uint32_t tags;
} __attribute__ ((packed));
struct grub_openbsd_bios_mmap

View file

@ -461,14 +461,14 @@ grub_freebsd_boot (void)
}
grub_memset (&bi, 0, sizeof (bi));
bi.bi_version = FREEBSD_BOOTINFO_VERSION;
bi.bi_size = sizeof (bi);
bi.version = FREEBSD_BOOTINFO_VERSION;
bi.length = sizeof (bi);
grub_bsd_get_device (&biosdev, &unit, &slice, &part);
bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
bi.bi_bios_dev = biosdev;
bi.boot_device = biosdev;
p = (char *) kern_end;
@ -478,7 +478,7 @@ grub_freebsd_boot (void)
{
*(p++) = 0;
bi.bi_envp = kern_end;
bi.environment = kern_end;
kern_end = ALIGN_PAGE ((grub_uint32_t) p);
}
@ -491,23 +491,23 @@ grub_freebsd_boot (void)
return grub_errno;
grub_memcpy ((char *) kern_end, mod_buf, mod_buf_len);
bi.bi_modulep = kern_end;
bi.tags = kern_end;
kern_end = ALIGN_PAGE (kern_end + mod_buf_len);
if (is_64bit)
kern_end += 4096 * 4;
md_ofs = bi.bi_modulep + kern_end_mdofs;
md_ofs = bi.tags + kern_end_mdofs;
ofs = (is_64bit) ? 16 : 12;
*((grub_uint32_t *) md_ofs) = kern_end;
md_ofs -= ofs;
*((grub_uint32_t *) md_ofs) = bi.bi_envp;
*((grub_uint32_t *) md_ofs) = bi.environment;
md_ofs -= ofs;
*((grub_uint32_t *) md_ofs) = bootflags;
}
bi.bi_kernend = kern_end;
bi.kern_end = kern_end;
grub_video_set_mode ("text", 0, 0);
@ -554,12 +554,12 @@ grub_freebsd_boot (void)
&grub_bsd64_trampoline_end - &grub_bsd64_trampoline_start);
/* Launch trampoline. */
launch_trampoline (entry, entry_hi, pagetable, bi.bi_modulep,
launch_trampoline (entry, entry_hi, pagetable, bi.tags,
kern_end);
}
else
grub_unix_real_boot (entry, bootflags | FREEBSD_RB_BOOTINFO, bootdev,
0, 0, 0, &bi, bi.bi_modulep, kern_end);
0, 0, 0, &bi, bi.tags, kern_end);
/* Not reached. */
return GRUB_ERR_NONE;