Commit graph

222 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
46ecfc49b6 * grub-core/loader/i386/bsdXX.c (grub_openbsd_find_ramdisk): Use
multiplication rather than division.
2013-03-10 20:37:41 +01:00
Vladimir 'phcoder' Serbinenko
a9c94590dd * grub-core/loader/i386/pc/plan9.c (fill_disk): Fix types to use
intended shifts rather than division.
2013-03-10 19:27:50 +01:00
Vladimir 'phcoder' Serbinenko
5341c0fbfc Avoid costly 64-bit division in grub_get_time_ms on most platforms. 2013-03-10 17:45:38 +01:00
Vladimir 'phcoder' Serbinenko
3188131f72 * grub-core/kern/env.c, include/grub/env.h: Change iterator through
all vars to a macro. All users updated.
2013-03-03 01:34:27 +01:00
Vladimir 'phcoder' Serbinenko
73bf57e2c8 Make elfload not use hooks. Opt for flags and iterators instead. 2013-03-02 16:45:57 +01:00
Vladimir 'phcoder' Serbinenko
e230377407 * grub-core/loader/i386/pc/linux.c (grub_cmd_linux): Fix compilation
for 64-bit platforms.
2013-03-01 10:39:41 +01:00
Vladimir 'phcoder' Serbinenko
0789b67232 Enable linux16 on non-BIOS systems for i.a. memtest.
* grub-core/loader/i386/pc/linux.c (grub_cmd_linux): Handle hole at 0
	correctly.
	* grub-core/Makefile.core.def (linux16): Enable on all x86 flavours.
2013-02-28 22:48:41 +01:00
Vladimir 'phcoder' Serbinenko
43c918828d * grub-core/loader/machoXX.c: Remove nested functions. 2013-02-27 20:56:23 +01:00
C. Masloch
08bcec5020 Improve FreeDOS direct loading support compatibility.
* include/grub/i386/relocator.h (grub_relocator16_state):
	New member ebp.
	* grub-core/lib/i386/relocator.c (grub_relocator16_ebp): New extern
	variable.
	(grub_relocator16_boot): Handle %ebp.
	* grub-core/lib/i386/relocator16.S: Likewise.
	* grub-core/loader/i386/pc/freedos.c:
	Load BPB to pass kernel which partition to load from.
	Check that kernel file is not too large.
	Set register dl to BIOS unit number as well.
2013-01-27 16:07:25 +01:00
Colin Watson
ed12a00309 Fix powerpc and sparc64 build failures caused by un-nesting memory
map iterators.
2013-01-21 14:41:06 +00:00
Colin Watson
fc524edf65 Remove nested functions from filesystem directory iterators.
* include/grub/fs.h (grub_fs_dir_hook_t): New type.
(struct grub_fs.dir): Add hook_data argument.

Update all implementations and callers.
2013-01-21 01:33:46 +00:00
Colin Watson
6a0debbd91 * grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't add the
initrd size to addr_min, since the initrd will be allocated after
this address.
2013-01-20 23:03:35 +00:00
Colin Watson
6c724b85b4 Remove nested functions from ELF iterators. 2013-01-20 15:54:09 +00:00
Colin Watson
25239370fd Remove nested functions from device iterators.
* include/grub/arc/arc.h (grub_arc_iterate_devs_hook_t): New type.
(grub_arc_iterate_devs): Add hook_data argument.
* include/grub/ata.h (grub_ata_dev_iterate_hook_t): New type.
(struct grub_ata_dev.iterate): Add hook_data argument.
* include/grub/device.h (grub_device_iterate_hook_t): New type.
(grub_device_iterate): Add hook_data argument.
* include/grub/disk.h (grub_disk_dev_iterate_hook_t): New type.
(struct grub_disk_dev.iterate): Add hook_data argument.
(grub_disk_dev_iterate): Likewise.
* include/grub/gpt_partition.h (grub_gpt_partition_map_iterate):
Likewise.
* include/grub/msdos_partition.h (grub_partition_msdos_iterate):
Likewise.
* include/grub/partition.h (grub_partition_iterate_hook_t): New
type.
(struct grub_partition_map.iterate): Add hook_data argument.
(grub_partition_iterate): Likewise.
* include/grub/scsi.h (grub_scsi_dev_iterate_hook_t): New type.
(struct grub_scsi_dev.iterate): Add hook_data argument.

Update all callers.
2013-01-20 15:52:15 +00:00
Colin Watson
d0d4b8a063 Remove nested functions from memory map iterators.
* grub-core/efiemu/mm.c (grub_efiemu_mmap_iterate): Add hook_data
argument, passed to hook.
* grub-core/kern/i386/coreboot/mmap.c
(grub_linuxbios_table_iterate): Likewise.
(grub_machine_mmap_iterate: iterate_linuxbios_table): Make static
instead of nested.
(grub_machine_mmap_iterate): Add hook_data argument.
* grub-core/kern/i386/multiboot_mmap.c (grub_machine_mmap_iterate):
Add hook_data argument, passed to hook.
* grub-core/kern/i386/pc/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/i386/qemu/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/arc/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/loongson/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/qemu_mips/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/mmap/efi/mmap.c (grub_efi_mmap_iterate): Likewise.
(grub_machine_mmap_iterate): Likewise.
* grub-core/mmap/mmap.c (grub_mmap_iterate): Likewise.
* include/grub/efiemu/efiemu.h (grub_efiemu_mmap_iterate): Update
prototype.
* include/grub/memory.h (grub_memory_hook_t): Add data argument.
Remove NESTED_FUNC_ATTR from here and from all users.
(grub_mmap_iterate): Update prototype.
(grub_efi_mmap_iterate): Update prototype.  Update all callers to
pass appropriate hook data.
(grub_machine_mmap_iterate): Likewise.

* grub-core/commands/acpi.c (grub_acpi_create_ebda: find_hook): Make
static instead of nested.
* grub-core/commands/lsmmap.c (grub_cmd_lsmmap: hook): Likewise.
Rename to ...
(lsmmap_hook): ... this.
* grub-core/efiemu/mm.c (grub_efiemu_mmap_init: bounds_hook):
Likewise.
(grub_efiemu_mmap_fill: fill_hook): Likewise.
* grub-core/kern/i386/coreboot/init.c (grub_machine_init:
heap_init): Likewise.
* grub-core/kern/i386/pc/init.c (grub_machine_init: hook): Likewise.
Rename to ...
(mmap_iterate_hook): ... this.
* grub-core/kern/ieee1275/init.c (grub_claim_heap: heap_init):
Likewise.
* grub-core/lib/ieee1275/relocator.c
(grub_relocator_firmware_get_max_events: count): Likewise.
(grub_relocator_firmware_fill_events: fill): Likewise.  Rename
to ...
(grub_relocator_firmware_fill_events_iter): ... this.
* grub-core/lib/relocator.c (grub_relocator_alloc_chunk_align:
hook): Likewise.  Rename to ...
(grub_relocator_alloc_chunk_align_iter): ... this.
* grub-core/loader/i386/bsd.c (generate_e820_mmap: hook): Likewise.
Rename to ...
(generate_e820_mmap_iter): ... this.
* grub-core/loader/i386/linux.c (find_mmap_size: hook): Likewise.
Rename to ...
(count_hook): ... this.
(grub_linux_boot: hook): Likewise.  Rename to ...
(grub_linux_boot_mmap_find): ... this.
(grub_linux_boot: hook_fill): Likewise.  Rename to ...
(grub_linux_boot_mmap_fill): ... this.
* grub-core/loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap:
hook): Likewise.  Rename to ...
(grub_fill_multiboot_mmap_iter): ... this.
* grub-core/loader/multiboot.c (grub_get_multiboot_mmap_count:
hook): Likewise.  Rename to ...
(count_hook): ... this.
* grub-core/loader/multiboot_mbi2.c (grub_fill_multiboot_mmap:
hook): Likewise.  Rename to ...
(grub_fill_multiboot_mmap_iter): ... this.
* grub-core/loader/powerpc/ieee1275/linux.c
(grub_linux_claimmap_iterate: alloc_mem): Likewise.
* grub-core/loader/sparc64/ieee1275/linux.c (alloc_phys: choose):
Likewise.  Rename to ...
(alloc_phys_choose): ... this.
(determine_phys_base: get_physbase): Likewise.
* grub-core/mmap/i386/mmap.c (grub_mmap_malign_and_register:
find_hook): Likewise.
* grub-core/mmap/i386/pc/mmap.c (preboot: fill_hook): Likewise.
(malloc_hook: count_hook): Likewise.
* grub-core/mmap/i386/uppermem.c (grub_mmap_get_lower: hook):
Likewise.  Rename to ...
(lower_hook): ... this.
(grub_mmap_get_upper: hook): Likewise.  Rename to ...
(upper_hook): ... this.
(grub_mmap_get_post64: hook): Likewise.  Rename to ...
(post64_hook): ... this.
* grub-core/mmap/mips/uppermem.c (grub_mmap_get_lower: hook):
Likewise.  Rename to ...
(lower_hook): ... this.
(grub_mmap_get_upper: hook): Likewise.  Rename to ...
(upper_hook): ... this.
* grub-core/mmap/mmap.c (grub_mmap_iterate: count_hook): Likewise.
(grub_mmap_iterate: fill_hook): Likewise.
(fill_mask): Pass addr and mask within a single struct.
(grub_cmd_badram: hook): Make static instead of nested.  Rename
to ...
(badram_iter): ... this.
(grub_cmd_cutmem: hook): Likewise.  Rename to ...
(cutmem_iter): ... this.
2013-01-15 12:02:35 +00:00
Vladimir 'phcoder' Serbinenko
3e4f356646 Support Apple FAT binaries on non-Apple platforms.
* include/grub/macho.h (GRUB_MACHO_FAT_EFI_MAGIC): New define.
	* include/grub/i386/macho.h (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT):
	Likewise.
	* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Parse
	Apple FAT binaries.
2013-01-10 12:50:01 +01:00
Colin Watson
39525c22be * grub-core/loader/i386/linux.c (allocate_pages): Fix spelling of
preferred_address.
(grub_cmd_linux): Likewise.
* grub-core/net/icmp6.c (struct prefix_option): Fix spelling of
preferred_lifetime.  Update all users.
2012-10-05 13:09:19 +01:00
Vladimir 'phcoder' Serbinenko
4e09245441 * grub-core/loader/i386/linux.c (grub_cmd_linux): Fix incorrect
le-conversion.
	Reported by: BURETTE, Bernard.
2012-09-18 11:44:29 +02:00
Benoit Gschwind
801a3027be * grub-core/loader/efi/appleloader.c (devpath_8): New var.
(devs): Add devpath_8.
2012-09-10 09:34:29 +02:00
Vladimir 'phcoder' Serbinenko
ac625d8f79 * grub-core/loader/i386/bsd.c (grub_bsd_elf32_size_hook): Fix mask.
(grub_bsd_elf32_hook): Likewise.
	(grub_bsd_elf64_size_hook): Likewise.
	(grub_bsd_elf64_hook): Likewise.
	(grub_bsd_load_elf): Likewise.
2012-07-22 16:30:48 +02:00
Vladimir 'phcoder' Serbinenko
3569288126 * grub-core/loader/i386/linux.c (find_efi_mmap_size): Don't decrease
efi_mmap_size.
	Reported by: Stuart Hayes.
2012-07-02 11:14:37 +02:00
Vladimir 'phcoder' Serbinenko
f923ad22ce * grub-core/loader/i386/linux.c (find_efi_mmap_size): Increase
additional size to 3 pages.
	Reported by: Stuart Hayes.
2012-06-27 22:55:09 +02:00
Vladimir 'phcoder' Serbinenko
8645f72c72 * grub-core/loader/i386/linux.c (grub_cmd_initrd): Avoid unnecessarry
cast between linux_kernel_header and linux_kernel_params.
2012-06-25 17:44:36 +02:00
Vladimir 'phcoder' Serbinenko
67caf9eb06 * grub-core/loader/i386/linux.c (grub_linux_boot): Setup video before
determining EFI memory map size.
2012-06-20 23:39:33 +02:00
Vladimir 'phcoder' Serbinenko
a09eb54103 Don't assume that beginning address is also the entry point on ppc.
* grub-core/loader/powerpc/ieee1275/linux.c (linux_entry): New variable.
	(grub_linux_boot): Use linux_entry.
	(grub_linux_load32): Fill linux_entry. Fix setting linux_addr.
	(grub_linux_load64): Likewise.
2012-06-13 01:15:15 +02:00
Vladimir 'phcoder' Serbinenko
c5c81ff978 Pass PCIINFO on BIOS to OpenBSD since otherwise it fails to boot
on some qemu versions with GRUB.

	* include/grub/i386/openbsd_bootarg.h (OPENBSD_BOOTARG_PCIBIOS): New
	define.
	(grub_openbsd_bootarg_pcibios): New struct.
	* grub-core/loader/i386/bsd.c (grub_openbsd_boot) [GRUB_MACHINE_PCBIOS]:
	Add PCIINFO.
2012-06-07 16:41:52 +02:00
Vladimir 'phcoder' Serbinenko
49cea015c0 * grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_boot): Sync
caches.
2012-06-06 18:58:19 +02:00
Vladimir 'phcoder' Serbinenko
c21b17e6e0 * grub-core/loader/efi/chainloader.c (copy_file_path): Handle non-ASCII
filenames.
	(make_file_path): Likewise.
2012-06-06 02:34:32 +02:00
Vladimir 'phcoder' Serbinenko
05b0bb9100 * grub-core/loader/i386/linux.c (grub_linux_boot): Use right version.
(grub_cmd_linux): Likewise.
2012-05-31 14:06:11 +02:00
Peter Jones
bcc75fb3f7 * include/grub/i386/linux.h (linux_kernel_params): Add v206.
* grub-core/loader/i386/linux.c (grub_linux_boot): Use v206.
	(grub_cmd_linux) [__x86_64__]: Validate grub_efi_system_table.
2012-05-31 13:23:30 +02:00
Vladimir 'phcoder' Serbinenko
f19cb95e1d * grub-core/loader/i386/linux.c (grub_linux_boot): Fix overflow and
uninited variable. Allocate at least setup_sects.
2012-05-31 12:04:55 +02:00
Vladimir 'phcoder' Serbinenko
a4e5ca80d9 Fix handling of EFI with big memory maps.
* grub-core/loader/i386/linux.c (GRUB_LINUX_CL_OFFSET): Removed.
	(real_mode_mem): Likewise.
	(real_mode_target): Likewise.
	(real_mode_pages): Likewise.
	(prot_mode_pages): Likewise.
	(linux_params): New var.
	(linux_cmdline): Likewise.
	(free_pages): Don't set real mode variables.
	(allocate_pages): Don't allocate real mode memory.
	(grub_e820_add_region): Remove the limit.
	(grub_linux_boot): Allocate and copy real mode memory.
	(grub_linux_unload): Free linux_cmdline.
	(grub_cmd_linux): Use temporary storage for parameters.
	(grub_cmd_initrd): Likewise.
	* include/grub/i386/linux.h (GRUB_E820_MAX_ENTRY): Removed.
	(linux_kernel_params): Make it 1K big.
2012-05-30 14:56:53 +02:00
Vladimir 'phcoder' Serbinenko
e6ad0555e4 * grub-core/efiemu/runtime/efiemu.c: Replace APPLE_CC with __APPLE__.
* grub-core/kern/misc.c: Likewise.
	* grub-core/loader/i386/xnu.c: Likewise.
	* include/grub/i386/tsc.h: Likewise.
	* include/grub/symbol.h: Likewise.
2012-05-28 17:49:18 +02:00
Vladimir 'phcoder' Serbinenko
b41be5623a * grub-core/loader/i386/linux.c (allocate_pages): Overwrite low memory
boot services if we have no other choice.
2012-04-17 13:00:06 +02:00
Vladimir 'phcoder' Serbinenko
9bab65c49d * grub-core/loader/i386/linux.c (grub_cmd_linux): Avoid accessing
kh.loadflags on pre-2.00 kernels.
2012-04-11 22:40:20 +02:00
Vladimir 'phcoder' Serbinenko
3c491b479c Terminate UNDI and PXE before launching the payload to avoid problems
with DMA.

	* grub-core/commands/boot.c (grub_loader_noreturn): Rename to ...
	(grub_loader_flags): ... this. All users updated.
	(grub_loader_boot): Check for GRUB_LOADER_FLAG_NORETURN.
	* grub-core/loader/i386/pc/pxechainloader.c (grub_cmd_pxechain): Mark
	loader as GRUB_LOADER_FLAG_PXE_NOT_UNLOAD.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_shutdown): New
	function.
	(grub_pxe_restore): Likewise.
	(fini_hnd): New var.
	(GRUB_MOD_INIT): Register shutdown hook.
	(GRUB_MOD_FINI): Shutdown and unregister shutdown hook.
	* include/grub/loader.h (GRUB_LOADER_FLAG_NORETURN): New const.
	(GRUB_LOADER_FLAG_PXE_NOT_UNLOAD): Likewise.
	(grub_loader_set): Rename second argument to flags.
2012-04-11 22:32:31 +02:00
Felix
f65a829e41 * grub-core/loader/efi/appleloader.c (devpath_7): New var.
(devs): Add MBP 2011.
2012-04-01 21:30:24 +02:00
Vladimir 'phcoder' Serbinenko
2282da4a93 * grub-core/loader/i386/linux.c (allocate_pages): Don't allocate
beyond 4 GiB.
	(grub_cmd_linux): Use GRUB_LINUX_BZIMAGE_ADDR for non-relocatable
	images independently of preffered adderss field.
2012-03-11 23:41:29 +01:00
Vladimir 'phcoder' Serbinenko
1ecd61a47a Fix efi chainloader on network root.
* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Handle
	network devices.
	* grub-core/net/drivers/efi/efinet.c (grub_efinet_get_device_handle):
	New function.
2012-03-10 20:41:28 +01:00
Vladimir 'phcoder' Serbinenko
922aabf34b * grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Fix format
in dprintf.
2012-03-10 18:02:53 +01:00
Vladimir 'phcoder' Serbinenko
e8e0566b0c * grub-core/commands/videoinfo.c: Add TRANSLATORS comments.
* grub-core/commands/xnu_uuid.c: Likewise.
	* grub-core/loader/efi/appleloader.c: Likewise.
	* grub-core/script/execute.c: Likewise.
	* grub-core/script/main.c: Likewise.
	* util/grub-mkfont.c: Likewise.
2012-03-10 13:19:46 +01:00
Vladimir 'phcoder' Serbinenko
c9eb96b508 * grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Use
"out of memory" error messagge.
2012-03-10 13:10:07 +01:00
Vladimir 'phcoder' Serbinenko
807fb77c16 * grub-core/loader/i386/linux.c (prot_init_space): New variable.
(allocate_pages): Improve dprintf.
	(grub_cmd_linux): Fill prot_init_space. Fix improper usage of
	code32_start. Fill code32_start and kernel_alignment in params.
	(grub_cmd_initrd): Use prot_init_space.
2012-03-07 23:45:20 +01:00
Vladimir 'phcoder' Serbinenko
6e69da9ccb * grub-core/commands/videoinfo.c: Add TRANSLATORS comments.
* grub-core/commands/videotest.c: Likewise.
	* grub-core/loader/i386/linux.c: Likewise.
2012-03-06 15:04:33 +01:00
Vladimir 'phcoder' Serbinenko
1a11761f7d * grub-core/loader/i386/linux.c (allocate_pages): Fix handling of the
case when min_align = 0.
2012-03-05 01:35:58 +01:00
Vladimir 'phcoder' Serbinenko
1a2fd1e674 * include/grub/misc.h (ALIGN_UP_OVERHEAD): New define.
* grub-core/loader/i386/linux.c (grub_cmd_initrd): Align initrds at 4.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
2012-03-05 01:17:55 +01:00
Vladimir 'phcoder' Serbinenko
7c8d0ce7f4 * include/grub/i386/linux.h (linux_kernel_header): Fix init_size type.
* grub-core/loader/i386/linux.c (grub_cmd_linux): Differentiate between
	prot_size and prot_file_size.
2012-03-04 12:13:05 +01:00
Vladimir 'phcoder' Serbinenko
123f9c50eb Fix FTBFS on mips and ppc 2012-03-03 20:53:54 +01:00
Vladimir 'phcoder' Serbinenko
9be4c45dbe boot services avoid code based on the patch by Matthew Garrett 2012-03-03 20:06:41 +01:00
Vladimir 'phcoder' Serbinenko
8822a8a02b * grub-core/fs/zfs/zfsinfo.c (print_vdev_info): Add TRANSLATORS
comments.
	* grub-core/gdb/gdb.c (grub_cmd_gdbstub): Likewise.
	(GRUB_MOD_INIT): Likewise.
	* grub-core/loader/i386/linux.c (grub_cmd_linux): Clarify that it's
	VGA mode.
	* grub-core/net/net.c (grub_net_route_address): Add TRANSLATORS
	comments.
	* util/grub-install.in (usage): Likewise.
	Spell ID in whole letters.
	Add missing ending dot.
	Quote variables.
	* util/grub-reboot.in: Fix capitalisation.
	* util/grub-set-default.in: Likewise.
2012-03-02 11:53:50 +01:00