Merge from trunk
This commit is contained in:
commit
648fb15b29
18 changed files with 199 additions and 118 deletions
110
ChangeLog
110
ChangeLog
|
@ -1,3 +1,113 @@
|
|||
2009-12-13 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* loader/i386/multiboot_elfxx.c
|
||||
(CONCAT(grub_multiboot_load_elf, XX)): Fix `grub_multiboot_payload_eip'
|
||||
initialization.
|
||||
|
||||
2009-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Relocator framework
|
||||
|
||||
* loader/i386/xnu_helper.S: Removed. All users updated.
|
||||
* conf/i386.rmk (pkglib_MODULES): Add relocator.mod.
|
||||
(relocator_mod_SOURCES): New variable.
|
||||
(relocator_mod_CFLAGS): Likewise.
|
||||
(relocator_mod_LDFLAGS): Likewise.
|
||||
(relocator_mod_ASFLAGS): Likewise.
|
||||
* conf/x86_64.rmk: Likewise.
|
||||
* include/grub/i386/multiboot.h (grub_multiboot_payload_orig): Removed.
|
||||
(grub_multiboot_payload_entry_offset): Likewise.
|
||||
(grub_multiboot_forward_relocator): Likewise.
|
||||
(grub_multiboot_forward_relocator_end): Likewise.
|
||||
(grub_multiboot_backward_relocator): Likewise.
|
||||
(grub_multiboot_backward_relocator_end): Likewise.
|
||||
(grub_multiboot_payload_eip): New variable.
|
||||
(grub_multiboot_payload_orig): Likewise.
|
||||
* include/grub/i386/pc/memory.h: Include grub/i386/memory.h.
|
||||
(GRUB_MEMORY_MACHINE_CR0_PE_ON): Move from here ...
|
||||
* include/grub/i386/memory.h
|
||||
(GRUB_MEMORY_CPU_CR0_PE_ON): ... to here
|
||||
(GRUB_MEMORY_CPU_CR4_PAE_ON): New definition.
|
||||
(GRUB_MEMORY_CPU_CR0_PAGING_ON): Likewise.
|
||||
(GRUB_MEMORY_CPU_AMD64_MSR): Likewise.
|
||||
(GRUB_MEMORY_CPU_AMD64_MSR_ON): Likewise.
|
||||
* include/grub/i386/relocator.h: New file.
|
||||
* include/grub/x86_64/relocator.h: Likewise.
|
||||
* include/grub/i386/xnu.h: Include grub/cpu/relocator.h.
|
||||
(XNU_RELOCATOR): New macro.
|
||||
(grub_xnu_launcher_start): Remove.
|
||||
(grub_xnu_launcher_end): Likewise.
|
||||
* include/grub/xnu.h (grub_xnu_boot_resume): New prototype.
|
||||
(grub_xnu_heap_real_start): Remove.
|
||||
(grub_xnu_heap_start): Change to void *. All users updated.
|
||||
* kern/i386/realmode.S (real_to_prot): Use GRUB_MEMORY_CPU_CR0_PE_ON.
|
||||
* lib/i386/relocator.c: New file.
|
||||
* lib/i386/relocator_asm.S: Likewise.
|
||||
* lib/i386/relocator_backward.S: Likewise.
|
||||
* lib/mips/relocator.c: Likewise.
|
||||
* lib/mips/relocator_asm.S: Likewise.
|
||||
* lib/relocator.c: Likewise.
|
||||
* loader/i386/multiboot.c: Include grub/i386/relocator.h.
|
||||
(entry): Removed.
|
||||
(playground): Likewise.
|
||||
(grub_multiboot_payload_orig): New variable.
|
||||
(grub_multiboot_payload_dest): Likewise.
|
||||
(grub_multiboot_payload_size): Likewise.
|
||||
(grub_multiboot_payload_eip): Likewise.
|
||||
(grub_multiboot_payload_esp): Likewise.
|
||||
(grub_multiboot_boot): Use grub_relocator32_boot.
|
||||
(grub_multiboot_unload): Free relocators.
|
||||
(grub_multiboot): Setup stack. Use relocators.
|
||||
* loader/i386/multiboot_elfxx.c: Include grub/i386/relocator.h.
|
||||
(grub_multiboot_load_elfXX): Use relocators.
|
||||
* loader/i386/multiboot_helper.S (grub_multiboot_payload_orig): Removed.
|
||||
(grub_multiboot_payload_size): Likewise.
|
||||
(grub_multiboot_payload_dest): Likewise.
|
||||
(grub_multiboot_payload_entry_offset): Likewise.
|
||||
(grub_multiboot_forward_relocator): Likewise.
|
||||
(grub_multiboot_backward_relocator): Likewise.
|
||||
(grub_multiboot_real_boot): Likewise.
|
||||
* loader/i386/xnu.c (grub_xnu_heap_will_be_at): New variable.
|
||||
(grub_xnu_entry_point): Likewise.
|
||||
(grub_xnu_arg1): Likewise.
|
||||
(grub_xnu_stack): Likewise.
|
||||
(grub_xnu_launch): Removed.
|
||||
(grub_xnu_boot_resume): New function.
|
||||
(grub_xnu_boot): Use relocators.
|
||||
* loader/i386/xnu_helper.S: Removed.
|
||||
* loader/xnu.c (grub_xnu_heap_start): New variable.
|
||||
(grub_xnu_heap_size): Likewise.
|
||||
(grub_xnu_heap_malloc): Use relocators.
|
||||
* loader/xnu_resume.c (grub_xnu_resume): Use relocators.
|
||||
|
||||
2009-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/i386/pc/startup.S (multiboot_entry): Setup stack before calling
|
||||
anything.
|
||||
|
||||
2009-12-13 Carles Pina i Estany <carles@pina.cat>
|
||||
|
||||
* script/execute.c (grub_script_execute_cmdline): Set grub_errno to
|
||||
GRUB_ERR_NONE before calling grub_env_set.
|
||||
|
||||
2009-12-12 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* gendistlist.sh (EXTRA_DISTFILES): Add `genvideolist.sh'.
|
||||
* genmk.rb (video): New variable.
|
||||
(CLEANFILES, VIDEOFILES): Add #{video}.
|
||||
(#{video}): New target rule.
|
||||
* genvideolist.sh: New file.
|
||||
* Makefile.in (pkglib_DATA): Add video.lst.
|
||||
(video.lst): New target rule.
|
||||
* util/grub-mkconfig.in: Initialize ${GRUB_VIDEO_BACKEND} using
|
||||
`video.lst'.
|
||||
* util/grub.d/30_os-prober.in: Replace `vbe' with
|
||||
${GRUB_VIDEO_BACKEND}.
|
||||
|
||||
2009-12-11 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* THANKS: Add David Miller.
|
||||
|
||||
2009-12-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
libpciaccess support.
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Relocator framework
|
||||
|
||||
* THANKS: Add David Miller.
|
||||
* loader/i386/xnu_helper.S: Removed. All users updated.
|
||||
* conf/i386.rmk (pkglib_MODULES): Add relocator.mod.
|
||||
(relocator_mod_SOURCES): New variable.
|
||||
(relocator_mod_CFLAGS): Likewise.
|
||||
(relocator_mod_LDFLAGS): Likewise.
|
||||
(relocator_mod_ASFLAGS): Likewise.
|
||||
* conf/x86_64.rmk: Likewise.
|
||||
* include/grub/i386/multiboot.h (grub_multiboot_payload_orig): Removed.
|
||||
(grub_multiboot_payload_entry_offset): Likewise.
|
||||
(grub_multiboot_forward_relocator): Likewise.
|
||||
(grub_multiboot_forward_relocator_end): Likewise.
|
||||
(grub_multiboot_backward_relocator): Likewise.
|
||||
(grub_multiboot_backward_relocator_end): Likewise.
|
||||
(grub_multiboot_payload_eip): New variable.
|
||||
(grub_multiboot_payload_orig): Likewise.
|
||||
(GRUB_MULTIBOOT_STACK_SIZE): New definition.
|
||||
* include/grub/i386/pc/memory.h: Include grub/i386/memory.h.
|
||||
(GRUB_MEMORY_MACHINE_CR0_PE_ON): Move from here ...
|
||||
* include/grub/i386/memory.h
|
||||
(GRUB_MEMORY_CPU_CR0_PE_ON): ... to here
|
||||
(GRUB_MEMORY_CPU_CR4_PAE_ON): New definition.
|
||||
(GRUB_MEMORY_CPU_CR0_PAGING_ON): Likewise.
|
||||
(GRUB_MEMORY_CPU_AMD64_MSR): Likewise.
|
||||
(GRUB_MEMORY_CPU_AMD64_MSR_ON): Likewise.
|
||||
* include/grub/i386/relocator.h: New file.
|
||||
* include/grub/x86_64/relocator.h: Likewise.
|
||||
* include/grub/i386/xnu.h: Include grub/cpu/relocator.h.
|
||||
(XNU_RELOCATOR): New macro.
|
||||
(grub_xnu_launcher_start): Remove.
|
||||
(grub_xnu_launcher_end): Likewise.
|
||||
* include/grub/xnu.h (grub_xnu_boot_resume): New prototype.
|
||||
(grub_xnu_heap_real_start): Remove.
|
||||
(grub_xnu_heap_start): Change to void *. All users updated.
|
||||
* kern/i386/realmode.S (real_to_prot): Use GRUB_MEMORY_CPU_CR0_PE_ON.
|
||||
* lib/i386/relocator.c: New file.
|
||||
* lib/i386/relocator_asm.S: Likewise.
|
||||
* lib/i386/relocator_backward.S: Likewise.
|
||||
* lib/mips/relocator.c: Likewise.
|
||||
* lib/mips/relocator_asm.S: Likewise.
|
||||
* lib/relocator.c: Likewise.
|
||||
* loader/i386/multiboot.c: Include grub/i386/relocator.h.
|
||||
(entry): Removed.
|
||||
(playground): Likewise.
|
||||
(grub_multiboot_payload_orig): New variable.
|
||||
(grub_multiboot_payload_dest): Likewise.
|
||||
(grub_multiboot_payload_size): Likewise.
|
||||
(grub_multiboot_payload_eip): Likewise.
|
||||
(grub_multiboot_payload_esp): Likewise.
|
||||
(grub_multiboot_boot): Use grub_relocator32_boot.
|
||||
(grub_multiboot_unload): Free relocators.
|
||||
(grub_multiboot): Setup stack. Use relocators.
|
||||
* loader/i386/multiboot_elfxx.c: Include grub/i386/relocator.h.
|
||||
(grub_multiboot_load_elfXX): Use relocators.
|
||||
* loader/i386/multiboot_helper.S (grub_multiboot_payload_orig): Removed.
|
||||
(grub_multiboot_payload_size): Likewise.
|
||||
(grub_multiboot_payload_dest): Likewise.
|
||||
(grub_multiboot_payload_entry_offset): Likewise.
|
||||
(grub_multiboot_forward_relocator): Likewise.
|
||||
(grub_multiboot_backward_relocator): Likewise.
|
||||
(grub_multiboot_real_boot): Likewise.
|
||||
* loader/i386/xnu.c (grub_xnu_heap_will_be_at): New variable.
|
||||
(grub_xnu_entry_point): Likewise.
|
||||
(grub_xnu_arg1): Likewise.
|
||||
(grub_xnu_stack): Likewise.
|
||||
(grub_xnu_launch): Removed.
|
||||
(grub_xnu_boot_resume): New function.
|
||||
(grub_xnu_boot): Use relocators.
|
||||
* loader/i386/xnu_helper.S: Removed.
|
||||
* loader/xnu.c (grub_xnu_heap_start): New variable.
|
||||
(grub_xnu_heap_size): Likewise.
|
||||
(grub_xnu_heap_malloc): Use relocators.
|
||||
* loader/xnu_resume.c (grub_xnu_resume): Use relocators.
|
|
@ -169,7 +169,7 @@ endif
|
|||
### General targets.
|
||||
|
||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
|
||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||
cat $(DEFSYMFILES) /dev/null \
|
||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
||||
|
@ -190,6 +190,9 @@ handler.lst: $(HANDLERFILES)
|
|||
parttool.lst: $(PARTTOOLFILES)
|
||||
cat $^ /dev/null | sort | uniq > $@
|
||||
|
||||
video.lst: $(VIDEOFILES)
|
||||
cat $^ /dev/null | sort | uniq > $@
|
||||
|
||||
ifneq (true, $(MAKEINFO))
|
||||
info_INFOS += docs/grub.info
|
||||
endif
|
||||
|
|
|
@ -19,6 +19,7 @@ EXTRA_DISTFILES="AUTHORS COPYING ChangeLog DISTLIST INSTALL NEWS README \
|
|||
gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \
|
||||
geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \
|
||||
genmodsrc.sh genpartmaplist.sh genparttoollist.sh \
|
||||
genvideolist.sh \
|
||||
gensymlist.sh.in install-sh mkinstalldirs stamp-h.in"
|
||||
|
||||
DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \
|
||||
|
|
9
genmk.rb
9
genmk.rb
|
@ -193,6 +193,7 @@ endif
|
|||
partmap = 'partmap-' + obj.suffix('lst')
|
||||
handler = 'handler-' + obj.suffix('lst')
|
||||
parttool = 'parttool-' + obj.suffix('lst')
|
||||
video = 'video-' + obj.suffix('lst')
|
||||
dep = deps[i]
|
||||
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
|
||||
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
|
||||
|
@ -203,7 +204,7 @@ endif
|
|||
-include #{dep}
|
||||
|
||||
clean-module-#{extra_target}.#{@rule_count}:
|
||||
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool}
|
||||
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video}
|
||||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
|
||||
|
||||
|
@ -212,6 +213,7 @@ FSFILES += #{fs}
|
|||
PARTTOOLFILES += #{parttool}
|
||||
PARTMAPFILES += #{partmap}
|
||||
HANDLERFILES += #{handler}
|
||||
VIDEOFILES += #{video}
|
||||
|
||||
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
|
||||
set -e; \
|
||||
|
@ -238,6 +240,11 @@ HANDLERFILES += #{handler}
|
|||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||
|
||||
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
|
||||
set -e; \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||
|
||||
"
|
||||
end.join('')
|
||||
end
|
||||
|
|
26
genvideolist.sh
Normal file
26
genvideolist.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2005,2008,2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This script is free software; the author
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Read source code from stdin and detect partmap names.
|
||||
|
||||
module=$1
|
||||
|
||||
# Ignore video.mod.
|
||||
if test $module = video; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# For now, this emits only a module name, if the module registers a partition map.
|
||||
if grep -v "^#" | grep '^ *grub_video_register' >/dev/null 2>&1; then
|
||||
echo $module
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
/* memory.h - describe the memory map */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,8 +23,8 @@
|
|||
/* The flag for protected mode. */
|
||||
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
|
||||
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000040
|
||||
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
|
||||
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
|
||||
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
|
||||
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
|
||||
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
|
||||
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
|
||||
|
||||
#endif /* ! GRUB_MEMORY_CPU_HEADER */
|
||||
|
|
|
@ -32,6 +32,4 @@ extern char *grub_multiboot_payload_orig;
|
|||
extern grub_addr_t grub_multiboot_payload_dest;
|
||||
extern grub_size_t grub_multiboot_payload_size;
|
||||
|
||||
#define GRUB_MULTIBOOT_STACK_SIZE 4096
|
||||
|
||||
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
|
||||
|
|
|
@ -146,6 +146,9 @@ multiboot_entry:
|
|||
/* obtain the boot device */
|
||||
movl 12(%ebx), %edx
|
||||
|
||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
/* relocate the code */
|
||||
movl $(GRUB_KERNEL_MACHINE_RAW_SIZE + 0x200), %ecx
|
||||
addl EXT_C(grub_compressed_size) - _start + 0x100000 + 0x200, %ecx
|
||||
|
|
|
@ -138,7 +138,7 @@ LOCAL(cont0):
|
|||
|
||||
lgdt (LOCAL(gdtdesc) - LOCAL(base)) (RSI, 1)
|
||||
|
||||
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
|
||||
/* Update %cs. */
|
||||
ljmp *(LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
|
||||
|
||||
LOCAL(cont1):
|
||||
|
|
|
@ -78,10 +78,10 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
|||
|
||||
/* Very unlikely condition: Relocator may risk overwrite itself.
|
||||
Just move it a bit up. */
|
||||
if ((grub_uint8_t *) UINT_TO_PTR (dest) - (grub_uint8_t *) relocator
|
||||
< (signed) (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
|
||||
&& (grub_uint8_t *) UINT_TO_PTR (dest) - (grub_uint8_t *) relocator
|
||||
> - (signed) (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN))
|
||||
if ((grub_addr_t) dest < (grub_addr_t) relocator
|
||||
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
|
||||
&& (grub_addr_t) dest + (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
|
||||
> (grub_addr_t) relocator)
|
||||
{
|
||||
void *relocator_new = ((grub_uint8_t *) relocator)
|
||||
+ (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
|
||||
|
@ -95,7 +95,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
|||
relocator = relocator_new;
|
||||
}
|
||||
|
||||
if (UINT_TO_PTR (dest) >= relocator)
|
||||
if ((grub_addr_t) dest >= (grub_addr_t) relocator)
|
||||
{
|
||||
int overhead;
|
||||
overhead = dest -
|
||||
|
|
|
@ -59,7 +59,6 @@ char *grub_multiboot_payload_orig;
|
|||
grub_addr_t grub_multiboot_payload_dest;
|
||||
grub_size_t grub_multiboot_payload_size;
|
||||
grub_uint32_t grub_multiboot_payload_eip;
|
||||
grub_uint32_t grub_multiboot_payload_esp;
|
||||
|
||||
static grub_err_t
|
||||
grub_multiboot_boot (void)
|
||||
|
@ -71,7 +70,9 @@ grub_multiboot_boot (void)
|
|||
.ecx = 0,
|
||||
.edx = 0,
|
||||
.eip = grub_multiboot_payload_eip,
|
||||
.esp = grub_multiboot_payload_esp
|
||||
/* Set esp to some random location in low memory to avoid breaking
|
||||
non-compliant kernels. */
|
||||
.esp = 0x7ff00
|
||||
};
|
||||
|
||||
grub_relocator32_boot (grub_multiboot_payload_orig,
|
||||
|
@ -290,13 +291,11 @@ grub_multiboot (int argc, char *argv[])
|
|||
((void *) ((x) + code_size + cmdline_length))
|
||||
#define mbi_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length))
|
||||
#define mmap_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct multiboot_info)))
|
||||
#define stack_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct multiboot_info) + mmap_length + GRUB_MULTIBOOT_STACK_SIZE))
|
||||
|
||||
grub_multiboot_payload_size = cmdline_length
|
||||
/* boot_loader_name_length might need to grow for mbi,etc to be aligned (see below) */
|
||||
+ boot_loader_name_length + 3
|
||||
+ sizeof (struct multiboot_info) + mmap_length
|
||||
+ GRUB_MULTIBOOT_STACK_SIZE;
|
||||
+ sizeof (struct multiboot_info) + mmap_length;
|
||||
|
||||
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
|
||||
{
|
||||
|
@ -319,7 +318,7 @@ grub_multiboot (int argc, char *argv[])
|
|||
if (! grub_multiboot_payload_orig)
|
||||
goto fail;
|
||||
|
||||
if ((grub_file_seek (file, offset)) == (grub_off_t) - 1)
|
||||
if ((grub_file_seek (file, offset)) == (grub_off_t) -1)
|
||||
goto fail;
|
||||
|
||||
grub_file_read (file, (void *) grub_multiboot_payload_orig, load_size);
|
||||
|
@ -382,8 +381,6 @@ grub_multiboot (int argc, char *argv[])
|
|||
if (grub_multiboot_get_bootdev (&mbi->boot_device))
|
||||
mbi->flags |= MULTIBOOT_INFO_BOOTDEV;
|
||||
|
||||
grub_multiboot_payload_esp = PTR_TO_UINT32 (stack_addr (grub_multiboot_payload_dest));
|
||||
|
||||
grub_loader_set (grub_multiboot_boot, grub_multiboot_unload, 1);
|
||||
|
||||
fail:
|
||||
|
|
|
@ -138,7 +138,8 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
|
|||
if (phdr(i)->p_vaddr <= ehdr->e_entry
|
||||
&& phdr(i)->p_vaddr + phdr(i)->p_memsz > ehdr->e_entry)
|
||||
{
|
||||
grub_multiboot_payload_eip = ehdr->e_entry;
|
||||
grub_multiboot_payload_eip = grub_multiboot_payload_dest
|
||||
+ (ehdr->e_entry - phdr(i)->p_vaddr) + (phdr(i)->p_paddr - phdr(lowest_segment)->p_paddr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ grub_linux_load32 (grub_elf_t elf)
|
|||
if (entry == 0)
|
||||
entry = 0x01400000;
|
||||
|
||||
linux_size = grub_elf32_size (elf, 0);
|
||||
linux_size = grub_elf32_size (elf);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
||||
|
@ -160,7 +160,7 @@ grub_linux_load64 (grub_elf_t elf)
|
|||
if (entry == 0)
|
||||
entry = 0x01400000;
|
||||
|
||||
linux_size = grub_elf64_size (elf, 0);
|
||||
linux_size = grub_elf64_size (elf);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
||||
|
|
|
@ -94,16 +94,28 @@ grub_xnu_resume (char *imagename)
|
|||
/* Try to allocate necessary space.
|
||||
FIXME: mm isn't good enough yet to handle huge allocations.
|
||||
*/
|
||||
grub_xnu_hibernate_image = buf = XNU_RELOCATOR (alloc) (hibhead.image_size);
|
||||
grub_xnu_hibernate_image = buf = XNU_RELOCATOR (alloc) (hibhead.image_size
|
||||
+ codesize
|
||||
+ GRUB_XNU_PAGESIZE);
|
||||
if (! buf)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
/* Read code part. */
|
||||
if (grub_file_seek (file, total_header_size) == (grub_off_t) -1
|
||||
|| grub_file_read (file, buf, codesize)
|
||||
!= (grub_ssize_t) codesize)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "Cannot read resume image.");
|
||||
}
|
||||
|
||||
/* Read image. */
|
||||
if (grub_file_seek (file, 0) == (grub_off_t)-1
|
||||
|| grub_file_read (file, buf, hibhead.image_size)
|
||||
if (grub_file_seek (file, 0) == (grub_off_t) -1
|
||||
|| grub_file_read (file, buf + codesize + GRUB_XNU_PAGESIZE,
|
||||
hibhead.image_size)
|
||||
!= (grub_ssize_t) hibhead.image_size)
|
||||
{
|
||||
grub_file_close (file);
|
||||
|
@ -114,10 +126,14 @@ grub_xnu_resume (char *imagename)
|
|||
/* Setup variables needed by asm helper. */
|
||||
grub_xnu_heap_will_be_at = codedest;
|
||||
grub_xnu_heap_start = buf;
|
||||
grub_xnu_heap_size = codesize;
|
||||
grub_xnu_heap_size = codesize + GRUB_XNU_PAGESIZE + hibhead.image_size;
|
||||
grub_xnu_stack = (codedest + hibhead.stack);
|
||||
grub_xnu_entry_point = (codedest + hibhead.entry_point);
|
||||
grub_xnu_arg1 = (long) buf;
|
||||
grub_xnu_arg1 = codedest + codesize + GRUB_XNU_PAGESIZE;
|
||||
|
||||
grub_dprintf ("xnu", "entry point 0x%x\n", codedest + hibhead.entry_point);
|
||||
grub_dprintf ("xnu", "image at 0x%x\n",
|
||||
codedest + codesize + GRUB_XNU_PAGESIZE);
|
||||
|
||||
/* We're ready now. */
|
||||
grub_loader_set (grub_xnu_boot_resume,
|
||||
|
|
|
@ -113,13 +113,13 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
|
||||
if (eq)
|
||||
{
|
||||
/* This was set because the command was not found. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
/* Create two strings and set the variable. */
|
||||
*eq = '\0';
|
||||
eq++;
|
||||
grub_env_set (assign, eq);
|
||||
|
||||
/* This was set because the command was not found. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
grub_free (assign);
|
||||
|
||||
|
|
|
@ -144,13 +144,9 @@ case x${GRUB_TERMINAL_OUTPUT} in
|
|||
x | xgfxterm)
|
||||
# If this platform supports gfxterm, try to use it.
|
||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
GRUB_VIDEO_BACKEND=
|
||||
for i in vbe ; do
|
||||
if test -e ${grub_prefix}/$i.mod ; then
|
||||
GRUB_VIDEO_BACKEND=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
# FIXME: this should do something smarter than just loading first
|
||||
# video backend.
|
||||
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
|
||||
if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
||||
elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
|
||||
|
|
|
@ -120,7 +120,7 @@ menuentry "${LONGNAME} (on ${DEVICE})" {
|
|||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod vbe
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
do_resume=0
|
||||
if [ /var/vm/sleepimage -nt10 / ]; then
|
||||
if xnu_resume /var/vm/sleepimage; then
|
||||
|
|
Loading…
Reference in a new issue