Prevent potential loss of memory map by overwrite on qemu-mips.
* grub-core/boot/mips/startup_raw.S [GRUB_MACHINE_MIPS_QEMU_MIPS]: Save ram size in $s4. * grub-core/kern/mips/qemu_mips/init.c (RAMSIZE): Removed. All users changed to grub_arch_memsize. * grub-core/kern/mips/startup.S (grub_arch_machine): Restrict to Loongson. [GRUB_MACHINE_MIPS_QEMU_MIPS]: Save grub_arch_memsize. * grub-core/loader/mips/linux.c (grub_linux_boot): Pass memory size. * include/grub/mips/qemu_mips/memory.h (grub_arch_memsize): New external variable.
This commit is contained in:
parent
5d420cd983
commit
566a191715
6 changed files with 44 additions and 7 deletions
|
@ -80,13 +80,21 @@ grub_linux_boot (void)
|
|||
{
|
||||
grub_err_t err;
|
||||
grub_relocator_chunk_t ch;
|
||||
grub_uint32_t *memsize;
|
||||
grub_uint32_t *magic;
|
||||
char *str;
|
||||
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
((16 << 20) - 256),
|
||||
grub_strlen (params) + 1);
|
||||
((16 << 20) - 264),
|
||||
grub_strlen (params) + 1 + 8);
|
||||
if (err)
|
||||
return err;
|
||||
grub_strcpy (get_virtual_current_address (ch), params);
|
||||
memsize = get_virtual_current_address (ch);
|
||||
magic = memsize + 1;
|
||||
*memsize = grub_mmap_get_lower ();
|
||||
*magic = 0x12345678;
|
||||
str = (char *) (magic + 1);
|
||||
grub_strcpy (str, params);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue