mips multiboot2 support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-04-03 14:14:48 +02:00
parent a60f822cb2
commit 8c46a785e3
7 changed files with 69 additions and 16 deletions

View file

@ -41,7 +41,7 @@
#include <grub/misc.h>
#include <grub/gzio.h>
#include <grub/env.h>
#include <grub/i386/relocator.h>
#include <grub/cpu/relocator.h>
#include <grub/video.h>
#include <grub/memory.h>
#include <grub/i18n.h>
@ -121,16 +121,9 @@ grub_multiboot_boot (void)
{
grub_size_t mbi_size;
grub_err_t err;
struct grub_relocator32_state state =
{
.eax = MULTIBOOT_BOOTLOADER_MAGIC,
.ecx = 0,
.edx = 0,
.eip = grub_multiboot_payload_eip,
/* Set esp to some random location in low memory to avoid breaking
non-compliant kernels. */
.esp = 0x7ff00
};
struct grub_relocator32_state state = MULTIBOOT_INITIAL_STATE;
state.MULTIBOOT_ENTRY_REGISTER = grub_multiboot_payload_eip;
mbi_size = grub_multiboot_get_mbi_size ();
if (grub_multiboot_alloc_mbi < mbi_size)
@ -143,7 +136,8 @@ grub_multiboot_boot (void)
grub_multiboot_alloc_mbi = mbi_size;
}
state.ebx = grub_multiboot_payload_dest + grub_multiboot_pure_size;
state.MULTIBOOT_MBI_REGISTER = grub_multiboot_payload_dest
+ grub_multiboot_pure_size;
err = grub_multiboot_make_mbi (grub_multiboot_payload_orig,
grub_multiboot_payload_dest,
grub_multiboot_pure_size, mbi_size);

View file

@ -18,13 +18,13 @@
#if defined(MULTIBOOT_LOAD_ELF32)
# define XX 32
# define E_MACHINE EM_386
# define E_MACHINE MULTIBOOT_ELF32_MACHINE
# define ELFCLASSXX ELFCLASS32
# define Elf_Ehdr Elf32_Ehdr
# define Elf_Phdr Elf32_Phdr
#elif defined(MULTIBOOT_LOAD_ELF64)
# define XX 64
# define E_MACHINE EM_X86_64
# define E_MACHINE MULTIBOOT_ELF64_MACHINE
# define ELFCLASSXX ELFCLASS64
# define Elf_Ehdr Elf64_Ehdr
# define Elf_Phdr Elf64_Phdr

View file

@ -90,7 +90,8 @@ grub_multiboot_load (grub_file_t file)
{
if (header->magic == MULTIBOOT_HEADER_MAGIC
&& !(header->magic + header->architecture
+ header->header_length + header->checksum))
+ header->header_length + header->checksum)
&& header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT)
break;
}