sgimips linux loader

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-13 16:36:41 +02:00
parent 8906c3dd40
commit 12ce749d86

View file

@ -31,10 +31,12 @@
GRUB_MOD_LICENSE ("GPLv3+");
/* For frequencies. */
#include <grub/pci.h>
#include <grub/machine/time.h>
#ifdef GRUB_MACHINE_MIPS_YEELOONG
#include <grub/pci.h>
/* This can be detected on runtime from PMON, but:
a) it wouldn't work when GRUB is the firmware
and
@ -52,7 +54,10 @@ static struct grub_relocator *relocator;
static grub_uint8_t *playground;
static grub_addr_t target_addr, entry_addr;
static int linux_argc;
static grub_off_t argv_off, envp_off;
static grub_off_t argv_off;
#ifdef GRUB_MACHINE_MIPS_YEELOONG
static grub_off_t envp_off;
#endif
static grub_off_t rd_addr_arg_off, rd_size_arg_off;
static int initrd_loaded = 0;
@ -65,7 +70,12 @@ grub_linux_boot (void)
state.gpr[1] = entry_addr;
state.gpr[4] = linux_argc;
state.gpr[5] = target_addr + argv_off;
#ifdef GRUB_MACHINE_MIPS_YEELOONG
state.gpr[6] = target_addr + envp_off;
#else
state.gpr[6] = 0;
#endif
state.gpr[7] = 0;
state.jumpreg = 1;
grub_relocator32_boot (relocator, state);
@ -200,9 +210,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int i;
int size;
void *extra = NULL;
grub_uint32_t *linux_argv, *linux_envp;
char *linux_args, *linux_envs;
grub_uint32_t *linux_argv;
char *linux_args;
grub_err_t err;
#ifdef GRUB_MACHINE_MIPS_YEELOONG
char *linux_envs;
grub_uint32_t *linux_envp;
#endif
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
@ -313,6 +327,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
extra = linux_args;
#ifdef GRUB_MACHINE_MIPS_YEELOONG
linux_envp = extra;
envp_off = (grub_uint8_t *) linux_envp - (grub_uint8_t *) playground;
linux_envs = (char *) (linux_envp + 5);
@ -340,8 +355,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ target_addr;
linux_envs += ALIGN_UP (grub_strlen (linux_envs) + 1, 4);
linux_envp[4] = 0;
#endif
grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
initrd_loaded = 0;