Commit graph

196 commits

Author SHA1 Message Date
phcoder
fe00f472fc 2009-08-30 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
	loading of headers in some cases.
2009-08-30 19:28:01 +00:00
phcoder
552bf6c568 2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
NetBSD memory map support.

	* include/grub/i386/bsd.h (NETBSD_BTINFO_MEMMAP): New definition.
	(grub_netbsd_btinfo_mmap_header): New structure.
	(grub_netbsd_btinfo_mmap_entry): Likewise.
	* loader/i386/bsd.c (grub_netbsd_boot): Pass memory map.
2009-08-26 00:32:57 +00:00
phcoder
1ae2078cd8 2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
Enable bsd.mod on coreboot.

	* conf/i386-coreboot.rmk (pkglib_MODULES): Add bsd.mod.
	(bsd_mod_SOURCES): New variable.
	(bsd_mod_CFLAGS): Likewise.
	(bsd_mod_LDFLAGS): Likewise.
	(bsd_mod_ASFLAGS): Likewise.
	* loader/i386/bsd.c [!GRUB_MACHINE_PCBIOS]: Fix includes.
	(grub_bsd_get_device) [!GRUB_MACHINE_PCBIOS]: Set *biosdev to 0xff.
2009-08-25 23:18:48 +00:00
phcoder
beefc59841 2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
Cleanup NetBSD root support.

	* loader/i386/bsd.c (grub_netbsd_boot): Remove call to
	grub_bsd_get_device.
	Fix typo.
2009-08-25 19:57:18 +00:00
phcoder
dd103c4e04 2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
Fix OpenBSD and NetBSD support.

	* include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve
	memory address conflict.
	(OPENBSD_MMAP_ACPI): New definition.
	(OPENBSD_MMAP_NVS): Likewise.
	* loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI
	and OPENBSD_MMAP_NVS.
	Add memory map terminator
	Explicit cast when calling grub_unix_real_boot.
	(grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot.
2009-08-24 13:20:24 +00:00
phcoder
16c84d744c 2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
Let user specify NetBSD root device.

	* loader/i386/bsd.c (netbsd_root): New variable.
	(netbsd_opts): New option 'root'.
	(NETBSD_ROOT_ARG): New macro.
	(grub_netbsd_boot): Use 'netbsd_root'.
	(grub_bsd_unload): Free 'netbsd_root'.
	(grub_cmd_netbsd): Fill 'netbsd_root'.
2009-08-24 13:10:12 +00:00
phcoder
adb29902f3 2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
Support for 64-bit NetBSD.

	* loader/i386/bsd.c (grub_bsd_load_elf): Apply correct mask to entry
	point when booting non-FreeBSD.
2009-08-24 12:59:48 +00:00
phcoder
f5ae9f745f 2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
Support --no-smp and --no-acpi for NetBSD.

	* include/grub/i386/bsd.h (NETBSD_AB_NOSMP): New definition.
	(NETBSD_AB_NOACPI): Likewise.
	* loader/i386/bsd.c (netbsd_opts): New entries no-smp and no-acpi.
	(netbsd_flags): Add NETBSD_AB_NOSMP, NETBSD_AB_NOACPI.
2009-08-24 12:55:19 +00:00
phcoder
c11fded5f2 2009-08-23 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/bsd.c (freebsd_opts): Rewritten to use extcmd.
	(openbsd_opts): Likewise.
	(netbsd_opts): Likewise.
	(freebsd_flags): Added 0 terminator.
	(openbsd_flags): Likewise.
	(netbsd_flags): Likewise.
	(grub_bsd_parse_flags): Rewritten to use extcmd. All users updated.
	(grub_cmd_freebsd): Transformed into extended command.
	(grub_cmd_openbsd): Likewise.
	(grub_cmd_netbsd): Likewise.
	(cmd_freebsd): Changed type to grub_extcmd_t.
	(cmd_openbsd): Likewise.
	(cmd_netbsd): Likewise.
	(GRUB_MOD_INIT (bsd)): Register grub_cmd_freebsd, grub_cmd_netbsd and
	grub_cmd_openbsd as extended commands.
	(GRUB_MOD_FINI (bsd)): Use grub_unregister_extcmd for cmd_freebsd,
	cmd_netbsd and cmd_openbsd
2009-08-23 11:46:25 +00:00
robertmh
08aa61f0e2 2009-08-17 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (GRUB_ASSUME_LINUX_HAS_FB_SUPPORT)
        (DEFAULT_VIDEO_MODE): Remove macros.
        (grub_linux_boot): Remove assumption that Linux has FB support,
        and use "text" as default video mode.
2009-08-17 12:44:28 +00:00
phcoder
e1f39873bc 2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot.c (grub_multiboot): Don't pass filename to
	payload.
	(grub_module): Likewise.
2009-08-14 15:19:24 +00:00
phcoder
c166d79e62 2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot.c (grub_multiboot_unload): Don't free mbi and
	mbi->cmdline but free playground.
2009-08-14 15:15:33 +00:00
phcoder
d3539132cd 2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
Framebuffer split.

	* commands/i386/pc/vbetest.c (grub_cmd_vbetest): Restore video
	subsystem at the end.
	* conf/common.rmk (pkglib_MODULES): Add video_fb.mod.
	(video_fb_mod_SOURCES): New variable.
	(video_fb_mod_CFLAGS): Likewise.
	(video_fb_mod_LDFLAGS): Likewise.
	* conf/i386-pc.rmk (vbe_mod_SOURCES): Remove video/i386/pc/vbeblit.c,
	video/i386/pc/vbefill.c and video/i386/pc/vbeutil.c.
	* video/i386/pc/vbeblit.c: Moved from here ...
	* video/fb/fbblit.c: ..here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbefill.c: Moved from here ...
	* video/fb/fbfill.c: ..here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbeutil.c: Moved from here ...
	* video/fb/fbutil.c: ..here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbeblit.h: Moved from here ...
	* include/grub/fbblit.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbefill.h: Moved from here ...
	* include/grub/fbfill.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbeutil.h: Moved from here ...
	* include/grub/fbutil.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbe.h: Moved framebuffer part ...
	* include/grub/video_fb.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/video.h (GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER): Removed.
	(GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER): Likewise.
	(grub_video_adapter): Added 'get_info_and_fini'.
	(grub_video_get_info_and_fini): New prototype.
	(grub_video_set_mode): make modestring const char *.
	* loader/i386/linux.c (grub_linux_setup_video): Use
	grub_video_get_info_and_fini.
	(grub_linux_boot): Move modesetting just before booting.
	* loader/i386/pc/xnu.c (grub_xnu_set_video): Use
	grub_video_get_info_and_fini.
	* video/i386/pc/vbe.c: Moved framebuffer part ...
	* video/fb/video_fb.c: ... here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbe.c (grub_vbe_set_video_mode): Use
	grub_video_fbstd_colors and grub_video_fb_set_palette.
	(grub_video_vbe_init): Clear 'framebuffer' variable and use
	grub_video_fb_init.
	(grub_video_vbe_fini): Use grub_video_fb_fini.
	(grub_video_vbe_setup): Use framebuffer.render_target instead of
	render_target and use grub_video_fb_set_active_render_target and
	grub_video_fb_set_palette.
	(grub_video_vbe_set_palette): Use grub_video_fb_set_palette.
	(grub_video_vbe_set_viewport): Use grub_video_fb_set_viewport.
	(grub_video_vbe_adapter): Use framebuffer.
	* video/video.c (grub_video_get_info_and_fini): New function.
	(grub_video_set_mode): Make modestring const char *.
	(GRUB_MOD_INIT(video_video)): Don't set variables to 0 since these
	values are already initialised.
2009-08-14 12:41:58 +00:00
robertmh
81623db677 2009-08-10 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/bsd.h (KERNEL_TYPE_NONE, KERNEL_TYPE_FREEBSD)
        (KERNEL_TYPE_OPENBSD, KERNEL_TYPE_NETBSD): Convert to ...
        (bsd_kernel_types): ... this enum.

        * loader/i386/bsd.c (grub_cmd_freebsd_loadenv, grub_cmd_freebsd_module)
        (grub_cmd_freebsd_module_elf): Abort with "You need to load the
        kernel first." when `kernel_type' is set to KERNEL_TYPE_NONE.

        (grub_bsd_load_aout, grub_bsd_load, grub_cmd_freebsd_loadenv)
        (grub_cmd_freebsd_module, grub_cmd_freebsd_module_elf)
        (GRUB_MOD_INIT (bsd)): Fix capitalization in a few error
        messages.
2009-08-10 15:42:39 +00:00
robertmh
388a7c7593 2009-07-28 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Use ',' rather than ';' as
        separator for the suggested gfxpayload string (';' collides with the
        parser and needs escaping).
2009-07-28 21:40:34 +00:00
phcoder
3bb7abcfbf 2009-07-28 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot_helper.S (grub_multiboot_backward_relocator):
	Clear direction flag before jumping to OS.
	(grub_multiboot2_real_boot): Likewise.
2009-07-28 21:32:20 +00:00
proski
eab58da22c 2009-07-16 Pavel Roskin <proski@gnu.org>
* kern/mm.c (grub_zalloc): New function.
	(grub_debug_zalloc): Likewise.
	* include/grub/mm.h: Declare grub_zalloc() and
	grub_debug_zalloc().
	* util/misc.c (grub_zalloc): New function.
	* bus/usb/uhci.c (grub_uhci_pci_iter): Use grub_zalloc()
	instead of grub_malloc(), remove unneeded initializations.
	* bus/usb/usbhub.c (grub_usb_hub_add_dev): Likewise.
	* commands/extcmd.c (grub_extcmd_dispatcher): Likewise.
	* commands/parttool.c (grub_cmd_parttool): Likewise.
	* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Likewise.
	* disk/raid5_recover.c (grub_raid5_recover): Likewise.
	* disk/raid6_recover.c (grub_raid6_recover): Likewise.
	* disk/usbms.c (grub_usbms_finddevs): Likewise.
	* efiemu/mm.c (grub_efiemu_request_memalign): Likewise.
	* efiemu/pnvram.c (grub_efiemu_pnvram): Likewise.
	(grub_cmd_efiemu_pnvram): Likewise.
	* fs/i386/pc/pxe.c (grub_pxefs_open): Likewise.
	* fs/iso9660.c (grub_iso9660_mount): Likewise.
	(grub_iso9660_iterate_dir): Likewise.
	* fs/jfs.c (grub_jfs_opendir): Likewise.
	* fs/ntfs.c (list_file): Likewise.
	(grub_ntfs_mount): Likewise.
	* kern/disk.c (grub_disk_open): Likewise.
	* kern/dl.c (grub_dl_load_core): Likewise.
	* kern/elf.c (grub_elf_file): Likewise.
	* kern/env.c (grub_env_context_open): Likewise.
	(grub_env_set): Likewise.
	(grub_env_set_data_slot): Likewise.
	* kern/file.c (grub_file_open): Likewise.
	* kern/fs.c (grub_fs_blocklist_open): Likewise.
	* loader/i386/multiboot.c (grub_module): Likewise.
	* loader/xnu.c (grub_xnu_create_key): Likewise.
	(grub_xnu_create_value): Likewise.
	* normal/main.c (grub_normal_add_menu_entry): Likewise.
	(read_config_file): Likewise.
	* normal/menu_entry.c (make_screen): Likewise.
	* partmap/sun.c (sun_partition_map_iterate): Likewise.
	* script/sh/lexer.c (grub_script_lexer_init): Likewise.
	* script/sh/script.c (grub_script_parse): Likewise.
	* video/bitmap.c (grub_video_bitmap_create): Likewise.
	* video/readers/jpeg.c (grub_video_reader_jpeg): Likewise.
	* video/readers/png.c (grub_png_output_byte): Likewise.
	(grub_video_reader_png): Likewise.
2009-07-16 22:14:09 +00:00
phcoder
59ade63d27 2009-07-16 Vladimir Serbinenko <phcoder@gmail.com>
Make FreeBSD accept zpool.cache

	* loader/i386/bsd.c (grub_freebsd_add_meta_module): spoof filename if
	type is /boot/zfs/zpool.cache
2009-07-15 22:51:47 +00:00
robertmh
b09db61ddd 2009-06-29 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): New macro.

        * loader/i386/linux.c [__i386__] (grub_linux_boot): Simplify inline
        assembly in final jump, using register constraints.

        (grub_linux_boot): For text mode, initialize `have_vga' using
        GRUB_VIDEO_TYPE_TEXT rather than 0 (this changes its value to 1).

        Initialize `video_cursor_x' and `video_cursor_y' as late as possible,
        right before the final jump.

        Set `video_mode' to 0x3.

        Document initialization of `video_page', `video_mode' and
        `video_ega_bx'.
2009-06-29 17:19:35 +00:00
robertmh
c6fe4d5328 2009-06-29 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c [__i386__] (grub_linux_boot): Simplify inline
        assembly in final jump, using register constraints.
2009-06-29 15:55:42 +00:00
robertmh
28333ad04f 2009-06-29 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/linux.h (GRUB_LINUX_FLAG_QUIET): New macro.
        * loader/i386/linux.c (grub_cmd_linux): Recognize "quiet" option,
        and set GRUB_LINUX_FLAG_QUIET appropiately.
2009-06-29 12:20:56 +00:00
robertmh
ad760f81b0 2009-06-27 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (grub_linux_boot): Fix uninitialized use of
        `err'.
2009-06-27 17:37:07 +00:00
robertmh
87a4623bda 2009-06-27 Robert Millan <rmh.grub@aybabtu.com>
Revert r2338.

        * loader/i386/linux.c (grub_cmd_linux): Don't call grub_error when
        file can't be opened.  grub_file_open() is already supposed to set
        grub_errno / grub_errmsg appropiately.
        * loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
2009-06-27 12:21:18 +00:00
proski
c402ab1734 2009-06-26 Pavel Roskin <proski@gnu.org>
* include/grub/types.h: Define GRUB_TARGET_WORDSIZE.
	* include/grub/elf.h: Define symbols without "32" or "64" based
	on GRUB_TARGET_WORDSIZE.
	* include/grub/multiboot2.h: Use GRUB_TARGET_WORDSIZE.
	* efiemu/loadcore32.c: Redefine GRUB_TARGET_WORDSIZE, remove own
	ELF definitions.
	* efiemu/loadcore64.c: Likewise.
	* loader/i386/bsd32.c: Likewise.
	* loader/i386/bsd64.c: Likewise.
	* kern/dl.c: Remove own ELF definitions.
	* util/i386/efi/grub-mkimage.c: Likewise.
2009-06-27 03:01:42 +00:00
phcoder
3f3ec72b38 2009-06-21 Vladimir Serbinenko <phcoder@gmail.com>
Load BSD ELF modules

	* conf/i386-pc.rmk (bsd_mod_SOURCES): Add loader/i386/bsd32.c
	and loader/i386/bsd64.c
	* include/grub/i386/bsd.h (FREEBSD_MODTYPE_MODULE): Remove
	(FREEBSD_MODTYPE_ELF_MODULE): New definition
	(FREEBSD_MODTYPE_ELF_MODULE_OBJ): Likewise
	(grub_freebsd_load_elfmodule32): New declaration
	(grub_freebsd_load_elfmoduleobj64): Likewise
	(grub_freebsd_load_elf_meta32): Likewise
	(grub_freebsd_load_elf_meta64): Likewise
	(grub_freebsd_add_meta): Likewise
	(grub_freebsd_add_meta_module): Likewise
	* loader/i386/bsd.c (grub_freebsd_add_meta): Make global
	(grub_freebsd_add_meta_module): Likewise and move module-specific
	parts to grub_cmd_freebsd and grub_cmd_freebsd_module
	(grub_cmd_freebsd): Add elf-kernel specific parts
	based on grub_freebsd_add_meta_module
	(grub_cmd_freebsd_module): Add type parsing moved from
	grub_freebsd_add_meta_module
	(grub_cmd_freebsd_module_elf): New function
	(cmd_freebsd_module_elf): New variable
	(GRUB_MOD_INIT): Register freebsd_module_elf
	* loader/i386/bsd32.c: New file
	* loader/i386/bsd64.c: Likewise
	* loader/i386/bsdXX.c: Likewise
	* kern/elf.c (grub_elf32_load): Let hook decide which pheaders to load
	(grub_elf64_load): Likewise
	* include/grub/elfload.h (grub_elf32_load_hook_t): New parameter do_load
	All users updated
	(grub_elf64_load_hook_t): Likewise
2009-06-21 15:48:10 +00:00
fzielcke
05b129e0d3 2009-06-17 Felix Zielcke <fzielcke@z-51.de>
* loader/i386/linux.c (grub_cmd_linux): Set grub_error if the
	file can't be found.
	* loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
2009-06-17 17:19:23 +00:00
phcoder
71c79a6b3b 2009-06-13 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot.c (grub_multiboot_get_bootdev): fix partition 
	handling
2009-06-13 21:09:11 +00:00
proski
3a4575d4ea 2009-06-11 Pavel Roskin <proski@gnu.org>
* loader/i386/bsd.c (grub_freebsd_boot): Rename `entry' to
	`entry_lo' to fix variable shadowing.
2009-06-11 21:48:48 +00:00
phcoder
63963d17d0 2009-06-11 Vladimir Serbinenko <phcoder@gmail.com>
Drivemap fixes

	* commands/i386/pc/drivemap.c (grub_get_root_biosnumber_drivemap):
	new function
	(grub_get_root_biosnumber_saved): new variable
	(GRUB_MOD_INIT): register grub_get_root_biosnumber_drivemap
	(GRUB_MOD_FINI): unregister grub_get_root_biosnumber_drivemap
	* commands/i386/pc/drivemap_int13h.S (grub_drivemap_handler): restore 
	%dx after the call if necessary
	* conf/common.rmk (pkglib_MODULES): remove boot.mod
	(boot_mod_SOURCES): remove
	(boot_mod_CFLAGS): remove
	(boot_mod_LDFLAGS): remove
	* conf/i386-coreboot.rmk (pkglib_MODULES): add boot.mod
	(boot_mod_SOURCES): new variable
	(boot_mod_CFLAGS): likewise
	(boot_mod_LDFLAGS): likewise
	* conf/i386-efi.rmk: likewise
	* conf/i386-ieee1275.rmk: likewise
	* conf/i386-pc.rmk: likewise
	* conf/powerpc-ieee1275.rmk: likewise
	* conf/sparc64-ieee1275.rmk: likewise
	* conf/x86_64-efi.rmk: likewise
	* include/grub/i386/pc/biosnum.h: new file
	* lib/i386/pc/biosnum.c: likewise
	* loader/i386/bsd.c (grub_bsd_get_device): use grub_get_root_biosnumber
	* loader/i386/multiboot.c (grub_multiboot_get_bootdev): likewise
	* loader/i386/pc/chainloader.c (grub_chainloader_cmd): likewise
2009-06-11 16:13:39 +00:00
proski
5c5215d5e2 2009-06-10 Pavel Roskin <proski@gnu.org>
* kern/file.c (grub_file_read): Use void pointer for the buffer.
	Adjust all callers.
2009-06-10 23:47:49 +00:00
fzielcke
b39f9d20a9 remove all trailing whitespace 2009-06-10 21:04:23 +00:00
proski
2763ac183d 2009-06-10 Pavel Roskin <proski@gnu.org>
* include/grub/multiboot2.h: Provide compatibility defines for
	multiboot2.h.
	* include/multiboot2.h: Include stdint.h only if needed, using
	angle brackets.
	* loader/i386/pc/multiboot2.c: Include multiboot2.h after
	grub/multiboot2.h.
	* loader/ieee1275/multiboot2.c: Likewise.
	* loader/multiboot2.c: Likewise.
	* loader/multiboot_loader.c: Likewise.
2009-06-10 20:11:12 +00:00
robertmh
9e172e3066 2009-06-08 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): When processing `vga=', use
        as fallback an equivalent option without depth.
2009-06-08 16:12:58 +00:00
phcoder
e93cdc3db1 2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Address in trampolines based on 32-bit registers when compiled
	with Apple's CC

	* loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers 
	for addresses
	* loader/i386/linux_trampoline.S [APPLE_CC]: likewise
2009-06-04 21:21:31 +00:00
phcoder
cc6c3ac1bf 2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Avoid clobbering %ebx/%rbx in inline assembly with Apple's CC

	* efiemu/runtime/efiemu.c (write_cmos): use %cl instead of %bl as
	temporary storage
	* include/grub/i386/tsc.h (grub_get_tsc): restore %rbx/%ebx when 
	using Apple's CC 
	(grub_cpu_is_tsc_supported): likewise
	* loader/i386/xnu.c (guessfsb): restore %rbx/%ebx in inline assembly
2009-06-04 20:10:51 +00:00
phcoder
3eb5ed4ec0 2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
gfxpayload support

	* commands/videotest.c (grub_cmd_videotest): use grub_video_set_mode
	* include/grub/video.h (GRUB_VIDEO_MODE_TYPE_PURE_TEXT): new definition
	(grub_video_setup): remove
	(grub_video_set_mode): new prototype
	* loader/i386/linux.c (DEFAULT_VIDEO_MODE): new definition
	(vid_mode): remove
	(linux_vesafb_res): compile only on PCBIOS
	(grub_linux_boot): support gfxpayload
	* loader/i386/pc/xnu.c (video_hook): new function
	(grub_xnu_set_video): support gfxpayload
	* term/gfxterm.c (DEFAULT_VIDEO_WIDTH): removed
	(DEFAULT_VIDEO_HEIGHT): likewise
	(DEFAULT_VIDEO_FLAGS): likewise
	(DEFAULT_VIDEO_MODE): new definition
	(video_hook): new function
	(grub_gfxterm_init): use grub_video_set_mode
	* util/grub.d/30_os-prober.in: remove explicit modesetting before 
	loading xnu
	* video/video.c (grub_video_setup): removed
	(grub_video_set_mode): new function based on grub_gfxterm_init and 
	grub_video_setup
2009-06-04 18:22:45 +00:00
phcoder
76f3b6e6b9 ident 2009-05-19 15:24:48 +00:00
phcoder
22f53a96fd 2009-05-17 Vladimir Serbinenko <phcoder@gmail.com>
trampoline for linux on 64-bit platform

	* conf/x86_64-efi.rmk (linux_mod_SOURCES): added 
	loader/i386/efi/linux_trampoline.S 
	* include/grub/x86_64/efi/loader.h (grub_linux_real_boot): removed 
	declration
	* kern/x86_64/efi/startup.S (grub_linux_real_boot): moved from here
	* loader/i386/linux_trampoline.S: moved here
	* loader/i386/efi/linux.c (allocate_pages): reserve space for trampoline
	(jumpvector): removed
	(grub_linux_trampoline_start): new declaration
	(grub_linux_trampoline_end): likewise
	(grub_linux_boot): use trampoline when on 64-bit platform
	* loader/i386/linux.c: likewise
2009-05-17 11:27:08 +00:00
proski
ac96388340 2009-05-13 Pavel Roskin <proski@gnu.org>
* loader/i386/multiboot.c (grub_multiboot): Cast mmap_addr to
	grub_uint32_t to avoid a warning.
2009-05-14 03:59:10 +00:00
proski
8090fc012a 2009-05-13 Pavel Roskin <proski@gnu.org>
* loader/i386/linux.c (allocate_pages): When assigning
	real_mode_mem, cast through grub_size_t to fix a warning.  The
	code already makes sure that the value would fit a pointer.
	(grub_linux_setup_video): Cast render_target->data to
	grub_size_t to fix a warning.
2009-05-14 03:48:08 +00:00
proski
0ab3a9a46d 2009-05-13 Pavel Roskin <proski@gnu.org>
* loader/i386/pc/multiboot2.c: Add necessary includes for
	grub_multiboot2_real_boot().
2009-05-13 20:52:35 +00:00
proski
238e871fff 2009-05-13 Pavel Roskin <proski@gnu.org>
* kernel/disk.c (grub_disk_read): Use void pointer for the
	buffer.
	(grub_disk_write): Use const void pointer for the buffer.
	Adjust all callers.  Remove unnecessary casts.
2009-05-13 18:58:38 +00:00
robertmh
74bfdd2f77 2009-05-04 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/linux.h (GRUB_LINUX_VID_MODE_VESA_START): Set
        to 0x300.
        * loader/i386/linux.c (vga_modes, linux_vesafb_res): Add a few
        resolutions.
        (linux_vesafb_modes): Add a lot of additional modes to the list (based
        on documentation from Wikipedia).
2009-05-04 20:21:33 +00:00
proski
4241d2b13a 2009-05-04 Pavel Roskin <proski@gnu.org>
* disk/ata.c: Spelling fixes.
	* disk/raid.c: Likewise.
	* disk/usbms.c: Likewise.
	* disk/dmraid_nvidia.c: Likewise.
	* kern/ieee1275/openfw.c: Likewise.
	* kern/ieee1275/init.c: Likewise.
	* kern/ieee1275/cmain.c: Likewise.
	* boot/i386/pc/cdboot.S: Likewise.
	* video/readers/png.c: Likewise.
	* video/i386/pc/vbe.c: Likewise.
	* fs/udf.c: Likewise.
	* fs/hfs.c: Likewise.
	* fs/reiserfs.c: Likewise.
	* efiemu/runtime/efiemu.c: Likewise.
	* efiemu/main.c: Likewise.
	* efiemu/mm.c: Likewise.
	* include/grub/elf.h: Likewise.
	* include/grub/xnu.h: Likewise.
	* include/grub/usbdesc.h: Likewise.
	* include/grub/usb.h: Likewise.
	* include/grub/script_sh.h: Likewise.
	* include/grub/lib/LzmaEnc.h: Likewise.
	* include/grub/efiemu/efiemu.h: Likewise.
	* include/grub/command.h: Likewise.
	* normal/menu.c: Likewise.
	* normal/main.c: Likewise.
	* normal/datetime.c: Likewise.
	* bus/usb/uhci.c: Likewise.
	* mmap/i386/uppermem.c: Likewise.
	* mmap/mmap.c: Likewise.
	* commands/acpi.c: Likewise.
	* commands/test.c: Likewise.
	* partmap/apple.c: Likewise.
	* font/font.c: Likewise.
	* loader/sparc64/ieee1275/linux.c: Likewise.
	* loader/macho.c: Likewise.
	* loader/i386/bsd_trampoline.S: Likewise.
	* loader/i386/bsd.c: Likewise.
	* loader/xnu.c: Likewise.
	* term/i386/pc/vesafb.c: Likewise.
	* term/usb_keyboard.c: Likewise.
	* util/resolve.c: Likewise.
	* util/getroot.c: Likewise.
2009-05-04 20:06:05 +00:00
robertmh
7c1d00cdc4 2009-05-04 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c [GRUB_MACHINE_PCBIOS] (grub_cmd_linux): Fix
        build error.
2009-05-04 18:59:12 +00:00
robertmh
b01f05482b 2009-05-04 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Make "vga=" compatibility
        parameter only available on BIOS.
2009-05-04 18:40:33 +00:00
robertmh
112972a96d 2009-05-04 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/linux.c (GRUB_ASSUME_LINUX_HAS_FB_SUPPORT): New macro.
        (grub_linux_boot): Don't check for `linux_vesafb_modes' bounds (this
        is done by grub_cmd_linux() now).
        [! GRUB_ASSUME_LINUX_HAS_FB_SUPPORT]: If "vga=" parameter wasn't set,
        restore video to text mode.
        (grub_cmd_linux): Default `vid_mode' initialization to 0, which
        indicates lack of "vga=" parameter.  "vga=0" is mapped to
        `GRUB_LINUX_VID_MODE_NORMAL'.
2009-05-04 18:04:09 +00:00
phcoder
c405ba08ed missing files from previous commit 2009-05-03 10:14:19 +00:00
phcoder
cef17233d4 2009-05-03 Bean <bean123ch@gmail.com> Vladimir Serbinenko <phcoder@gmail.com>
FreeBSD 64-bit support

	* conf/i386-pc.rmk (bsd_mod_SOURCES): add loader/i386/bsd_helper.S 
	and loader/i386/bsd_trampoline.S
	(bsd_mod_ASFLAGS): new variable
	* include/grub/i386/bsd.h (FREEBSD_MODINFOMD_SMAP): new definition
	(FREEBSD_MODTYPE_KERNEL64): likewise
	(grub_bsd64_trampoline_start): likewise
	(grub_bsd64_trampoline_end): likewise
	(grub_bsd64_trampoline_selfjump): likewise
	(grub_bsd64_trampoline_gdt): likewise
	* include/grub/i386/loader.h (grub_unix_real_boot): moved from here ...
	* include/grub/i386/bsd.h (grub_unix_real_boot): ... moved here
	* kern/i386/loader.S (grub_unix_real_boot): moved from here ...
	* loader/i386/bsd_helper.S (grub_unix_real_boot): moved here
	* include/grub/gpt_partition.h (grub_gpt_partentry): Corrected the type 
	of "attrib" member
	* loader/i386/bsd_pagetable.c: new file
	* loader/i386/bsd_trampoline.S: likewise
	* loader/i386/bsd.c (ALIGN_QWORD): new macro
	(ALIGN_VAR): likewise
	(entry_hi): new variable
	(kern_end_mdofs): likewise
	(is_64bit): likewise
	(grub_freebsd_add_meta): use ALIGN_VAR
	(grub_e820_mmap): new declaration
	(grub_freebsd_add_mmap): new function
	(grub_freebsd_add_meta_module): support 64 bit kernels
	(grub_freebsd_list_modules): use ALIGN_VAR
	(gdt_descriptor): new declaration
	(grub_freebsd_boot): support 64 bit kernels
	(grub_bsd_elf64_hook): new function
	(grub_bsd_load_elf): support elf64
2009-05-03 09:03:31 +00:00
phcoder
bbee0f2b56 2009-05-03 Vladimir Serbinenko <phcoder@gmail.com>
xnu support

	* conf/i386-efi.rmk (kernel_mod_HEADERS): added i386/pit.h
	(pkglib_MODULES): add xnu.mod
	(xnu_mod_SOURCES): new variable
	(xnu_mod_CFLAGS): likewise
	(xnu_mod_LDFLAGS): likewise
	(xnu_mod_ASFLAGS): likewise
	* conf/i386-pc.rmk: likewise
	* conf/x86_64-efi.rmk: likewise
	* include/grub/efi/efi.h (grub_efi_finish_boot_services): 
	new declaration
	* include/grub/i386/macho.h: new file
	* include/grub/i386/xnu.h: likewise
	* include/grub/macho.h: likewise
	* include/grub/machoload.h: likewise
	* include/grub/x86_64/macho.h: likewise
	* include/grub/x86_64/xnu.h: likewise
	* include/grub/xnu.h: likewise
	* kern/efi/efi.c (grub_efi_finish_boot_services): new function
	* kern/efi/mm.c (MAX_HEAP_SIZE): increase
	* loader/i386/efi/xnu.c: new file
	* loader/i386/pc/xnu.c: likewise
	* loader/i386/xnu.c: likewise
	* loader/i386/xnu_helper.S: likewise
	* loader/macho.c: likewise
	* loader/xnu.c: likewise
	* loader/xnu_resume.c: likewise
	* util/grub-dumpdevtree: likewise
	* include/grub/i386/pit.h: include grub/err.h
	(grub_pit_wait): export
	* util/grub.d/30_os-prober.in: support Darwin/Mac OS X
2009-05-02 23:19:20 +00:00
phcoder
09d842b9c6 2009-05-02 Vladimir Serbinenko <phcoder@gmail.com>
Mmap services

	* loader/i386/efi/linux.c (grub_linux_boot): use grub_mmap_iterate
	* loader/i386/linux.c (find_mmap_size): likewise
	(allocate_pages): likewise
	* loader/i386/multiboot.c (grub_get_multiboot_mmap_len): likewise
	(grub_fill_multiboot_mmap): likewise
	(grub_multiboot): use grub_mmap_get_lower and grub_mmap_get_upper
	* loader/i386/pc/linux.c (grub_cmd_linux): use grub_mmap_get_lower
	* include/grub/i386/bsd.h (OPENBSD_MMAP_AVAILABLE): new definition
	(OPENBSD_MMAP_RESERVED): likewise
	* include/grub/i386/pc/memory.h: include grub/memory.h
	(grub_lower_mem): removed
	(grub_upper_mem): likewise
	(GRUB_MACHINE_MEMORY_ACPI): new definition
	(GRUB_MACHINE_MEMORY_NVS): likewise
	(GRUB_MACHINE_MEMORY_MAX_TYPE): likewise
	(GRUB_MACHINE_MEMORY_HOLE): likewise
	(grub_machine_mmap_register): likewise
	(grub_machine_mmap_unregister): likewise
	(grub_machine_get_upper): likewise
	(grub_machine_get_lower): likewise
	(grub_machine_get_post64): likewise
	* include/grub/i386/efi/memory.h: new file
	* include/grub/x86_64/efi/memory.h: likewise
	* include/grub/efi/memory.h: likewise
	* conf/i386-pc.rmk (pkglib_MODULES): added mmap.mod
	(mmap_mod_SOURCES): new variable
	(mmap_mod_LDFLAGS): likewise
	(mmap_mod_ASFLAGS): likewise
	* conf/i386-coreboot.rmk: likewise
	* conf/i386-ieee1275.rmk: likewise
	* conf/i386-efi.rmk: likewise
	* conf/x86_64-efi.rmk: likewise
	* include/grub/types.h (UINT_TO_PTR): new macro
	(PTR_TO_UINT32): likewise
	(PTR_TO_UINT64): likewise
	* include/grub/memory.h: new file
	* mmap/i386/pc/mmap.c: likewise
	* mmap/i386/pc/mmap_helper.S: likewise
	* mmap/i386/uppermem.c: likewise
	* mmap/mmap.c: likewise
	* mmap/efi/mmap.c: likewise
	* kern/i386/coreboot/init.c (grub_machine_init): don't use 
	grub_upper_mem
	* kern/i386/pc/init.c (grub_lower_mem): removed variable
	(grub_upper_mem): likewise
	(grub_machine_init): don't use grub_upper_mem,
	make grub_lower_mem local
	* loader/i386/bsd.c (grub_openbsd_boot): use grub_mmap_get_lower,
	grub_mmap_iterate and grub_mmap_get_upper
	(grub_netbsd_boot): use grub_mmap_get_lower and grub_mmap_get_upper
2009-05-02 21:46:34 +00:00
bean
d558e6b5ac 2009-05-02 Bean <bean123ch@gmail.com>
* conf/common.rmk (grub_script.tab.c): Change normal/parser.y to
	script/sh/parser.y.
	(pkglib_MODULES): Add normal.mod and sh.mod.
	(normal_SOURCES): New variable.
	(normal_mod_CFLAGS): Likewise.
	(normal_mod_LDFLAGS): Likewise.
	(sh_mod_SOURCES): Likewise.
	(sh_mod_CFLAGS): Likewise.
	(sh_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (normal/lexer.c_DEPENDENCIES): Changed to
	script/sh/lexer.c_DEPENDENCIES.
	(kernel_img_SOURCES): Remove kern/rescue.c, and kern/reader.c,
	kern/rescue_reader.c and kern/rescue_parser.c.
	(kernel_img_HEADERS): Remove rescue.h, add reader.h.
	(grub_emu_SOURCES): Change source files.
	(pkglib_MODULES): Remove normal.mod.
	(normal_SOURCES): Removed.
	(normal_mod_CFLAGS): Likewise.
	(normal_mod_LDFLAGS): Likewise.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1276.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/sparc64-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/command.h (grub_command_execute): New inline function.

	* include/grub/menu.h (grub_menu_entry): Removed commands field.

	* include/grub/normal.h: Remove <grub/setjmp.h>.
	(grub_fs_module_list): Moved to normal/autofs.c.
	(grub_exit_env): Removed.
	(grub_command_execute): Likewise.
	(grub_normal_menu_addentry): Renamed to grub_menu_addentry, removed
	parameter script.
	(read_command_list): New function declaration.
	(read_fs_list): Likewise.

	* include/parser.h: Include <grub/reader.h>.
	(grub_parser_split_cmdline): Change type of getline parameter.
	(grub_parser): New structure.
	(grub_parser_class): New variable.
	(grub_parser_execute): New function declaration.
	(grub_register_rescue_parser): Likewise.
	(grub_parser_register): New inline function.
	(grub_parser_unregister): Likewise.
	(grub_parser_get_current): Likewise.
	(grub_parser_set_current): Likewise.

	* include/grub/reader.h: New file.
	* kern/reader.c: Likewise.
	* kern/rescue_parser.c: Likewise.
	* kern/rescue_reader.c: Likewise.
	* normal/autofs.c: Likewise.
	* normal/dyncmd.c: Likewise.

	* include/grub/rescue.h: Removed.
	* normal/command.h: Likewise.

	* include/grub/script.h: Moved to ...
	* include/grub/script_sh.h: ... Moved here.
	* normal/execute.c: Moved to ...
	* script/sh/execute.c: ... Moved here.
	* normal/function.c: Moved to ...
	* script/sh/function.c: ... Moved here.
	* normal/lexer.c: Moved to ...
	* script/sh/lexer.c: ... Moved here.
	* normal/parser.y: Moved to ...
	* script/sh/parser.y: ... Moved here.
	* normal/script.c: Moved to ...
	* script/sh/script.c: ... Moved here.

	* normal/main.c: Remove <grub/rescue.h> and <grub/script.h>, include
	<grub/reader.h>.
	(grub_exit_env): Removed.
	(fs_module_list): Moved to normal/autofs.c.
	(grub_file_getline): Don't handle comment here.
	(free_menu): Skip removed field entry->commands.
	(grub_normal_menu_addentry): Removed as grub_menu_entry, removed
	script parameter.
	(read_config_file): Removed nested parameter, change getline function.
	(grub_enter_normal_mode): Removed.
	(grub_dyncmd_dispatcher): Moved to normal/dyncmd.c.
	(read_command_list): Likewise.
	(autoload_fs_module): Moved to normal/autofs.c.
	(read_fs_list): Likewise.
	(reader_nested): New variable.
	(grub_normal_execute): Run parser.sh to switch to sh parser.
	(grub_cmd_rescue): Removed.
	(cmd_normal): Removed.
	(grub_cmd_normal): Unregister itself at the beginning. Don't register
	rescue command.
	(grub_cmdline_run): New function.
	(grub_normal_reader_init): Likewise.
	(grub_normal_read_line): Likewise.
	(grub_env_write_pager): Likewise.
	(cmdline): New variable.
	(grub_normal_reader): Likewise.
	(GRUB_MOD_INIT): Register normal reader and set as current, register
	pager hook, register normal command with grub_register_command_prio,
	so that it won't show up in command.lst.
	(GRUB_MOD_FINI): Unregister normal reader, unhook pager, clear
	grub_fs_autoload_hook.

	* normal/menu.c: Remove <grub/script.h>, add <grub/command.h>.
	(grub_menu_execute_entry): Replace grub_script_execute with
	grub_parser_execute, change parameter to grub_command_execute.

	* normal/menu_text.c: Remove <grub/script.h>.

	* normal/menu_entry.c: Remove <grub/script.h>, add <grub/command.h>
	and <grub/parser.h>.
	(run): Change editor_getline to use new parser interface. Change
	parameter to grub_command_execute.

	* kern/main.c: Remove <grub/rescue.h>, include <grub/command.h>,
	<grub/reader.h> and <grub/parser.h>.
	(grub_load_normal_mode): Execute normal command.
	(grub_main): Call grub_register_core_commands,
	grub_register_rescue_parser and grub_register_rescue_reader, use
	grub_reader_loop to enter input loop.

	* kern/parser.c (grub_parser_spli_cmdline): Change type of getline
	parameter.
	(grub_parser_class): New variable.
	(grub_parser_execute): New function.

	* loader/i386/multiboot.c: Remove <grub/rescue.h>.
	* loader/multiboot2.c: Likewise.
	* loader/sparc64/ieee1275/linux.c: Likewise.

	* util/grub-emu.c (read_command_list): New dummy function.
2009-05-02 19:49:34 +00:00
robertmh
6c67de152c 2009-05-02 Robert Millan <rmh.grub@aybabtu.com>
* normal/menu_text.c  (grub_wait_after_message): Print a newline
        after waiting for user input.

        * loader/i386/linux.c: Include `<grub/normal.h>'.
        (grub_cmd_linux): Improve the error message about `ask' mode, by
        waiting for user input so it's not missed (we can do this, since
        user requested interaction).
2009-05-02 15:24:28 +00:00
robertmh
cba416eb0d 2009-04-13 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Don't pass `vga=ask' parameter
        to Linux, simply abort telling the user it's no longer supported.
2009-04-13 14:38:10 +00:00
bean
e7e6862a4c 2009-04-10 Bean <bean123ch@gnail.com>
* include/grub/efi/api.h (grub_efi_configuration_table): Add packed
	attribute, otherwise the size would be wrong for i386 platform.

	* include/grub/pci.h (grub_pci_read_word): New inline function.
	(grub_pci_read_byte): Likewise.
	(grub_pci_write): Likewise.
	(grub_pci_write_word): Likewise.
	(grub_pci_write_byte): Likewise.

	* include/grub/pci.h (grub_pci_iteratefunc_t): Add NESTED_FUNC_ATTR.

	* loader/i386/efi/linux.c (fake_bios_data): Moved to loadbios module.
	(find_framebuf): Scan pci to locate the frame buffer address.

	* commands/efi/fixvideo.c: New file.

	* commands/efi/loadbios.c: Likewise.

	* commands/memrw.c: Likewise.

	* util/grub-dumpbios.in: Likewise.

	* conf/common.rmk (grub-dumpbios): New utility.
	(pkglib_MODULES): New module memrw.mod.
	(memrw_mod_SOURCE): New macro.
	(memrw_mod_CFLAGS): Likewise.
	(memrw_mod_LDFLAGS): Likewise.

	* conf/i386-efi.rmk (pkglig_MODULES): New module loadbios.mod and
	fixvideo.mod.
	(loadbios_mod_SOURCE): New macro.
	(loadbios_mod_CFLAGS): Likewise.
	(loadbios_mod_LDFLAGS): Likewise.
	(fixvideo_mod_SOURCE): Likewise.
	(fixvideo_mod_CFLAGS): Likewise.
	(fixvideo_mod_LDFLAGS): Likewise.

	* conf/x86_64.rmk (pkglig_MODULES): New module loadbios.mod and
	fixvideo.mod.
	(loadbios_mod_SOURCE): New macro.
	(loadbios_mod_CFLAGS): Likewise.
	(loadbios_mod_LDFLAGS): Likewise.
	(fixvideo_mod_SOURCE): Likewise.
	(fixvideo_mod_CFLAGS): Likewise.
	(fixvideo_mod_LDFLAGS): Likewise.
2009-04-10 15:33:34 +00:00
proski
1007d1f562 2009-04-06 Pavel Roskin <proski@gnu.org>
* include/grub/misc.h (ARRAY_SIZE): New macro.
	* include/grub/i386/linux.h (GRUB_LINUX_VID_MODE_VESA_START):
	New macro.
	* loader/i386/linux.c (allocate_pages): Use free_pages().
	(grub_linux_unload): Don't use free_pages().
	(grub_linux_boot): Prevent accessing linux_vesafb_modes with a
	wrong index.  Treat all other modes as text modes.
	(grub_cmd_linux): Initialize vid_mode unconditionally to
	GRUB_LINUX_VID_MODE_NORMAL.  Recognize and support "vga=ask".
2009-04-07 00:48:57 +00:00
okuji
6842cec424 Undo r2063. 2009-04-04 09:22:35 +00:00
bean
838c454296 2009-04-04 Bean <bean123ch@gnail.com>
* include/grub/efi/api.h (grub_efi_configuration_table): Add packed
	attribute, otherwise the size would be wrong for i386 platform.

	* include/grub/pci.h (grub_pci_read_word): New inline function.
	(grub_pci_read_byte): Likewise.
	(grub_pci_write): Likewise.
	(grub_pci_write_word): Likewise.
	(grub_pci_write_byte): Likewise.

	* include/grub/pci.h (grub_pci_iteratefunc_t): Add NESTED_FUNC_ATTR.

	* loader/i386/efi/linux.c (fake_bios_data): Moved to loadbios module.
	(find_framebuf): Scan pci to locate the frame buffer address.

	* commands/efi/fixvideo.c: New file.

	* commands/efi/loadbios.c: Likewise.

	* commands/memrw.c: Likewise.

	* util/grub-dumpbios.in: Likewise.

	* conf/common.rmk (grub-dumpbios): New utility.
	(pkglib_MODULES): New module memrw.mod.
	(memrw_mod_SOURCE): New macro.
	(memrw_mod_CFLAGS): Likewise.
	(memrw_mod_LDFLAGS): Likewise.

	* conf/i386-efi.rmk (pkglig_MODULES): New module loadbios.mod and
	fixvideo.mod.
	(loadbios_mod_SOURCE): New macro.
	(loadbios_mod_CFLAGS): Likewise.
	(loadbios_mod_LDFLAGS): Likewise.
	(fixvideo_mod_SOURCE): Likewise.
	(fixvideo_mod_CFLAGS): Likewise.
	(fixvideo_mod_LDFLAGS): Likewise.

	* conf/x86_64.rmk (pkglig_MODULES): New module loadbios.mod and
	fixvideo.mod.
	(loadbios_mod_SOURCE): New macro.
	(loadbios_mod_CFLAGS): Likewise.
	(loadbios_mod_LDFLAGS): Likewise.
	(fixvideo_mod_SOURCE): Likewise.
	(fixvideo_mod_CFLAGS): Likewise.
	(fixvideo_mod_LDFLAGS): Likewise.
2009-04-04 08:08:01 +00:00
okuji
54ad95559e 2009-04-04 Yoshinori K. Okuji <okuji@enbug.org>
* loader/i386/efi/linux.c (fake_bios_data): Use grub_dprintf
    instead of grub_printf.
2009-04-03 20:19:36 +00:00
robertmh
7a6bf9f220 2009-04-03 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_linux_setup_video): Fill
        `params->{red,green,blue,reserved}_{mask_size,field_pos}' with
        values from `mode info' structure instead of hardcoded
        values.
2009-04-03 20:03:39 +00:00
robertmh
92f33540d8 2009-03-30 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Check for zImage before
        checking for abi version.  Improve error messages on BIOS to notify
        user about `linux16' command.
2009-03-30 22:22:31 +00:00
robertmh
9c323f0961 2009-03-29 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Parse "vga=" parameter and
        set `vid_mode' accordingly.
        (grub_linux_boot): Process `vid_mode' and set video mode.
2009-03-29 19:52:35 +00:00
robertmh
a9368fd30c 2009-03-28 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add `linux16.mod'.
        (linux16_mod_SOURCES, linux16_mod_CFLAGS, linux16_mod_LDFLAGS): New
        variables.  Use 16-bit loader.
        (linux_mod_SOURCES, linux_mod_CFLAGS, linux_mod_LDFLAGS): Use 32-bit
        loader.
        * kern/i386/loader.S (grub_linux_boot): Rename to ...
        (grub_linux16_boot): ... this.  Update all users.
        * loader/i386/linux.c (grub_linux32_boot): Rename to ...
        (grub_linux_boot): ... this.  Update all users.

        * loader/i386/pc/linux.c (GRUB_MOD_INIT(linux)): Rename to ...
        (GRUB_MOD_INIT(linux16)): ... this.  Rename `linux' and `initrd'
        commands to `linux16' and `initrd16'.
        (GRUB_MOD_FINI(linux)): Rename to ...
        (GRUB_MOD_FINI(linux16)): ... this.
2009-03-28 12:53:16 +00:00
robertmh
c04d6e0548 2009-03-22 Vladimir Serbinenko <phcoder@gmail.com>
Move multiboot helper out of kernel

        * conf/i386-pc.rmk (multiboot_mod_SOURCES): Add
        `loader/i386/multiboot_helper.S'.
        * conf/i386-coreboot.rmk: Likewise
        * conf/i386-ieee1275.rmk: Likewise

        * kern/i386/loader.S: Move multiboot helpers from here...
        * loader/i386/multiboot_helper.S: ...moved here
        * include/grub/i386/loader.h: Move declarations of multiboot
        helpers from here...
        * include/grub/i386/multiboot.h: ...moved here
        * loader/i386/multiboot.c: Added include of grub/cpu/multiboot.h
2009-03-22 12:28:00 +00:00
robertmh
2274cc8fc9 2009-03-21 Vladimir Serbinenko <phcoder@gmail.com>
Bugfixes in multiboot for bugs uncovered by solaris kernel.

        * loader/i386/multiboot_elfxx.c (grub_multiboot_load_elf): Corrected
        limit detection.
        Use vaddr of correct segment for entry_point.
2009-03-21 23:02:12 +00:00
bean
b1b797cb1b 2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
	<grub/normal.h> and <grub/arg.h>.
	(grub_cmd_blocklist): Use the new command interface.
	(GRUB_MOD_INIT): Likewise.
	(GRUB_MOD_FINI): Likewise.
	* commands/boot.c: Likewise.
	* commands/cat.c: Likewise.
	* commands/cmp.c: Likewise.
	* commands/configfile.c: Likewise.
	* commands/crc.c: Likewise.
	* commands/echo.c: Likewise.
	* commands/halt.c: Likewise.
	* commands/handler.c: Likewise.
	* commands/hdparm.c: Likewise.
	* commands/help.c: Likewise.
	* commands/hexdump.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/ls.c: Likewise.
	* commands/lsmmap.c: Likewise.
	* commands/lspci.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/read.c: Likewise.
	* commands/reboot.c: Likewise.
	* commands/search.c: Likewise.
	* commands/sleep.c: Likewise.
	* commands/test.c: Likewise.
	* commands/usbtest.c: Likewise.
	* commands/videotest.c: Likewise.
	* commands/i386/cpuid.c: Likewise.
	* commands/i386/pc/halt.c: Likewise.
	* commands/i386/pc/play.c: Likewise.
	* commands/i386/pc/pxecmd.c: Likewise.
	* commands/i386/pc/vbeinfo.c: Likewise.
	* commands/i386/pc/vbetest.c: Likewise.
	* commands/ieee1275/suspend.c: Likewise.
	* disk/loopback.c: Likewise.
	* font/font_cmd.c: Likewise.
	* hello/hello.c: Likewise.
	* loader/efi/appleloader.c: Likewise.
	* loader/efi/chainloader.c: Likewise.
	* loader/i386/bsd.c: Likewise.
	* loader/i386/efi/linux.c: Likewise.
	* loader/i386/ieee1275/linux.c: Likewise.
	* loader/i386/linux.c: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/powerpc/ieee1275/linux.c: Likewise.
	* loader/multiboot_loader.c: Likewise.
	* term/gfxterm.c: Likewise.
	* term/i386/pc/serial.c: Likewise.
	* term/terminfo.c: Likewise.

	* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
	* term/i386/pc/vga.c: Likewise.
	* video/readers/jpeg.c: Likewise.
	* video/readers/png.c: Likewise.
	* video/readers/tga.c: Likewise.

	* util/grub-fstest (cmd_loopback): Removed.
	(cmd_blocklist): Likewise.
	(cmd_ls): Likewise.
	(grub_register_command): Likewise.
	(grub_unregister_command): Likewise.
	(execute_command): Use grub_command_find to locate command and execute
	it.

	* include/grub/efi/chainloader.h: Removed.
	* loader/efi/chainloader_normal.c: Likewise.
	* loader/i386/bsd_normal.c: Likewise.
	* loader/i386/pc/chainloader_normal.c: Likewise.
	* loader/i386/pc/multiboot_normal.c: Likewise.
	* loader/linux_normal.c: Likewise.
	* loader/multiboot_loader_normal.c: Likewise.
	* loader/powerpc/ieee1275/linux_normal.c: Likewise.

	* gencmdlist.sh: Scan new registration command grub_register_extcmd
	and grub_register_command_p1.

	* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
	kern/command.c, lib/arg.c and commands/extcmd.c.
	(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
	(minicmd_mod_SOURCES): New variable.
	(minicmd_mod_CFLAGS): Likewise.
	(minicmd_mod_LDFLAGS): Likewise.
	(extcmd_mod_SOURCES): Likewise.
	(extcmd_mod_CFLAGS): Likewise.
	(extcmd_mod_LDFLAGS): Likewise.
	(boot_mod_SOURCES): Removed.
	(boot_mod_CFLAGS): Likewise.
	(boot_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
	kern/corecmd.c.
	(kernel_img_HEADERS): Add command.h.
	(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
	commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
	and lib/arg.c.
	(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
	_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
	remove the corresponding normal mode command.
	(normal_mod_SOURCES): Remove normal/arg.c.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/arg.h: Move from here ...
	* include/grub/lib/arg.h: ... to here.

	* normal/arg.c: Move from here ...
	* lib/arg.c: ... to here.

	* commands/extcmd.c: New file.
	* commands/minicmd.c: Likewise.
	* include/grub/command.h: Likewise.
	* include/grub/extcmd.h: Likewise.
	* kern/command.c: Likewise.
	* kern/corecmd.c: Likewise.

	* kern/list.c (grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(grub_prio_list_insert): Likewise.

	* kern/rescue.c (grub_rescue_command): Removed.
	(grub_rescue_command_list): Likewise.
	(grub_rescue_register_command): Likewise.
	(grub_rescue_unregister_command): Likewise.
	(grub_rescue_cmd_boot): Move to minicmd.c
	(grub_rescue_cmd_help): Likewise.
	(grub_rescue_cmd_info): Likewise.
	(grub_rescue_cmd_boot): Likewise.
	(grub_rescue_cmd_testload): Likewise.
	(grub_rescue_cmd_dump): Likewise.
	(grub_rescue_cmd_rmmod): Likewise.
	(grub_rescue_cmd_lsmod): Likewise.
	(grub_rescue_cmd_exit): Likewise.
	(grub_rescue_print_devices): Moved to corecmd.c.
	(grub_rescue_print_files): Likewise.
	(grub_rescue_cmd_ls): Likewise.
	(grub_rescue_cmd_insmod): Likewise.
	(grub_rescue_cmd_set): Likewise.
	(grub_rescue_cmd_unset): Likewise.
	(attemp_normal_mode): Use grub_command_find to get normal module.
	(grub_enter_rescue_mode): Use grub_register_core_commands to register
	commands, remove grub_rescue_regiter_command calls.

	* normal/command.c (grub_regiser_command): Removed.
	(grub_unregister_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(rescue_command): Likewise.
	(export_command): Moved to corecmd.c.
	(set_command): Removed.
	(unset_command): Likewise.
	(insmod_command): Likewise.
	(rmmod_command): Likewise.
	(lsmod_command): Likewise.
	(grub_command_init): Likewise.

	* normal/completion.c (iterate_command): Use cmd->prio to check for
	active command.
	(complete_arguments): Use grub_extcmd_t structure to find options.
	(grub_normal_do_completion): Change function grub_iterate_commands to
	grub_command_iterate.

	* normal/execute.c (grub_script_execute_cmd): No need to parse
	argument here.

	* normal/main.c (grub_dyncmd_dispatcher): New function.
	(read_command_list): Register unload commands as dyncmd.
	(grub_cmd_normal): Use new command interface, register rescue,
	unregister normal at entry, register normal, unregister rescue at exit.

	* include/grub/list.h (grub_list_test_t): New type.
	(grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(GRUB_AS_NAMED_LIST_P): New macro.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	(GRUB_PRIO_LIST_PRIO_MASK): New constant.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
	(grub_prio_list): New structure.
	(grub_prio_list_insert): New function.
	(grub_prio_list_remove): New inline function.

	* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
	(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Likewise.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
	(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
	(grub_command): Likewise.
	(grub_register_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(grub_command_init): Likewise.
	(grub_arg_parse): Likewise.
	(grub_arg_show_help): Likewise.

	* include/grub/rescue.h (grub_rescue_register_command): Removed.
	(grub_rescue_unregister_command): Likewise.

	* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
	grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
	grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.

	* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
	grub_rescue_cmd_initrd.
	* include/grub/i386/loader.h: Likewise.
	* include/grub/x86_64/loader.h: Likewise.

	* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
robertmh
14aad8072c 2009-03-18 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c: Include `<grub/video.h>' and
        `<grub/i386/pc/vbe.h>'..
        (grub_linux_setup_video): New function.  Loosely based on the EFI one.
        (grub_linux32_boot): Attempt to configure video settings with
        grub_linux_setup_video().
        (grub_rescue_cmd_linux): Set noreturn=0 in grub_loader_set, in order
        to avoid grub_console_fini() which would step out of graphical mode
        unconditionally.
2009-03-18 10:21:28 +00:00
robertmh
6394042e02 2009-03-11 Robert Millan <rmh@aybabtu.com>
* loader/i386/multiboot_elfxx.c
        (CONCAT(grub_multiboot_load_elf, XX)): Do not reject ET_DYN files.
2009-03-11 21:27:01 +00:00
robertmh
1ca7fc96f7 2009-03-11 Robert Millan <rmh@aybabtu.com>
* loader/i386/multiboot.c (code_size): New variable.
        (grub_multiboot): Define offsets by adding to `code_size' rather
        than substracting from `grub_multiboot_payload_size'.  Provide
        4-byte alignment to MBI and others by increasing
        `boot_loader_name_length' appropiately.

        * loader/i386/multiboot_elfxx.c
        (CONCAT(grub_multiboot_load_elf, XX)): Initialize `code_size'.
2009-03-10 23:47:51 +00:00
robertmh
aa9f3bffbd 2009-03-08 Robert Millan <rmh@aybabtu.com>
Make loader/i386/linux.c usable on i386-pc again.

        * kern/i386/pc/init.c (grub_machine_init): Disable addition of low
        memory to heap.
        * loader/i386/linux.c [GRUB_MACHINE_PCBIOS] (allocate_pages): Remove
        `#error' stanza.
2009-03-08 12:46:27 +00:00
bean
d8b3b60eea 2009-03-07 Bean <bean123ch@gmail.com>
* loader/i386/efi/linux.c (grub_rescue_cmd_initrd): Fix a bug in initrd
	allocation.
2009-03-07 10:50:43 +00:00
robertmh
f501677cb2 2009-03-03 Robert Millan <rmh@aybabtu.com>
Move more components to the relocation area, and fix mbi pointer
        handling to use the destination rather than the origin (thanks to
        Vladimir Serbinenko for spotting).

        * loader/i386/multiboot.c (mbi_dest): New variable.
        (grub_multiboot_boot): Use `mbi_dest' instead of `mbi'.
        (grub_multiboot): Put cmdline, boot_loader_name and mbi in the
        relocation area.
2009-03-03 19:00:41 +00:00
bean
9902d04725 2009-03-01 Bean <bean123ch@gmail.com>
* include/grub/efi/api.h (GRUB_EFI_MPS_TABALE_GUID): New constant.
	(GRUB_EFI_ACPI_TABLE_GUID): Likewise.
	(GRUB_EFI_ACPI_20_TABLE_GUID): Likewise.
	(GRUB_EFI_SMBIOS_TABLE_GUID): Likewise.

	* loader/i386/efi/linux.c (acpi_guid): New variable.
	(acpi_guid): Likewise.
	(EBDA_SEG_ADDR): New constant.
	(LOW_MEM_ADDR): Likewise.
	(FAKE_EBDA_SEG): Likewise.
	(fake_bios_data): New function.
	(grub_linux_boot): Call fake_bios_data.
2009-03-01 17:57:57 +00:00
robertmh
8a31787ff5 2009-02-27 Robert Millan <rmh@aybabtu.com>
Factorize elf32 / elf64 code in Multiboot loader.  This will
        prevent it from getting out of sync again.

        * loader/i386/multiboot.c (grub_multiboot_is_elf32,
        grub_multiboot_load_elf32, grub_multiboot_is_elf64,
        grub_multiboot_load_elf64): Move from here ...
        * loader/i386/multiboot_elfxx.c (grub_multiboot_is_elf,
        grub_multiboot_load_elf): ... to here (new file).
2009-02-27 23:04:46 +00:00
robertmh
4b6bf4f97c 2009-02-27 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Move from here ...
        * loader/i386/multiboot.c: ... to here.  Update all users.
2009-02-27 21:19:00 +00:00
bean
6e09b8b72e 2009-02-24 Bean <bean123ch@gmail.com>
* configure.ac: Check for -mcmodel=large in x86_64 target.

	* include/grub/efi/api.h (efi_call_10): New macro.
	(efi_wrap_10): New function.

	* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
	(GRUB_PE32_REL_BASED_HIGH): Likewise.
	(GRUB_PE32_REL_BASED_LOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
	(GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
	(GRUB_PE32_REL_BASED_SECTION): Likewise.
	(GRUB_PE32_REL_BASED_REL): Likewise.
	(GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
	(GRUB_PE32_REL_BASED_DIR64): Likewise.
	(GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

	* kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed relocation
	issue.

	* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix.
	(efi_wrap_10): New function.

	* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

	* loader/efi/appleloader.c (devpath_5): Add support for late 2008
	MB/MBP model (NV chipset).
	(devdata_devs): Add devpath_5 to the list.

	* load/i386/efi/linux.c (video_base): Remove variable.
	(RGB_MASK): New macro.
	(RGB_MAGIC): Likewise.
	(LINE_MIN): Likewise.
	(LINE_MAX): Likewise.
	(FBTEST_STEP): Likewise.
	(FBTEST_COUNT): Likewise.
	(fb_list): New variable.
	(grub_find_video_card): Remove function.
	(find_framebuf): New function.
	(grub_linux_setup_video): Use find_framebuf to get frame buffer and
	line length.

	* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation
	problem for x86_64.
2009-02-24 13:19:46 +00:00
robertmh
a455f472aa 2009-02-22 Robert Millan <rmh@aybabtu.com>
* include/multiboot.h (MULTIBOOT_INFO_ALIGN): New macro.
        * loader/i386/pc/multiboot.c (grub_multiboot): Include the MBI
        in our relocation, instead of using it directly from heap.  Also
        use `MULTIBOOT_INFO_ALIGN' to ensure it is aligned.
2009-02-22 00:44:22 +00:00
robertmh
f36cc10867 2009-01-10 Robert Millan <rmh@aybabtu.com>
Update a few copyright years which we forgot to do in 2008 (only for
            files whose changes made in 2008 were copyright-significant)

            * Makefile.in: Add 2008 to Copyright line.
            * disk/ieee1275/ofdisk.c: Likewise.
            * disk/efi/efidisk.c: Likewise.
            * kern/dl.c: Likewise.
            * kern/sparc64/ieee1275/init.c: Likewise.
            * kern/mm.c: Likewise.
            * kern/efi/mm.c: Likewise.
            * boot/i386/pc/boot.S: Likewise.
            * genfslist.sh: Likewise.
            * fs/iso9660.c: Likewise.
            * fs/hfs.c: Likewise.
            * fs/jfs.c: Likewise.
            * fs/minix.c: Likewise.
            * fs/ufs.c: Likewise.
            * gensymlist.sh.in: Likewise.
            * genkernsyms.sh.in: Likewise.
            * include/grub/misc.h: Likewise.
            * include/grub/types.h: Likewise.
            * include/grub/symbol.h: Likewise.
            * include/grub/elf.h: Likewise.
            * include/grub/kernel.h: Likewise.
            * include/grub/disk.h: Likewise.
            * include/grub/dl.h: Likewise.
            * include/grub/i386/linux.h: Likewise.
            * include/grub/i386/pc/biosdisk.h: Likewise.
            * include/grub/efi/api.h: Likewise.
            * include/grub/efi/pe32.h: Likewise.
            * include/grub/util/misc.h: Likewise.
            * normal/execute.c: Likewise.
            * normal/arg.c: Likewise.
            * normal/completion.c: Likewise.
            * normal/lexer.c: Likewise.
            * normal/parser.y: Likewise.
            * normal/misc.c: Likewise.
            * commands/i386/pc/vbeinfo.c: Likewise.
            * commands/hexdump.c: Likewise.
            * commands/terminal.c: Likewise.
            * commands/ls.c: Likewise.
            * commands/help.c: Likewise.
            * partmap/pc.c: Likewise.
            * loader/efi/chainloader.c: Likewise.
            * loader/multiboot_loader.c: Likewise.
            * loader/i386/pc/multiboot2.c: Likewise.
            * term/efi/console.c: Likewise.
            * term/i386/pc/serial.c: Likewise.
            * util/lvm.c: Likewise.
            * util/console.c: Likewise.
            * util/i386/efi/grub-mkimage.c: Likewise.
            * util/raid.c: Likewise.
2009-01-10 13:07:44 +00:00
robertmh
40f9faa4de Move comment text to `#error' stanza. 2008-11-20 20:25:30 +00:00
robertmh
e94045a110 * loader/i386/linux.c (allocate_pages): Fix a warning. 2008-11-20 20:22:04 +00:00
robertmh
9290711060 * loader/i386/linux.c (grub_rescue_cmd_initrd): Implement a few needed
constraints to initrd allocation (based on code from
        loader/i386/pc/linux.c).  Without them, initrd was allocated too high
        for Linux to find it.
2008-11-19 12:11:44 +00:00
robertmh
ebaaf49b02 2008-11-19 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Fix a typo.
2008-11-19 12:05:20 +00:00
robertmh
2f2a344257 Add #error instance with comment to explain why this
loader isn't currently usable on PC/BIOS.
2008-11-14 20:18:07 +00:00
robertmh
10fc3eb9a7 2008-11-14 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):
        Redefine to match with GRUB_MEMORY_MACHINE_UPPER_START (0x100000).  We
        don't want to mess with lower memory, because it is used in the Linux
        loader.

        * loader/i386/linux.c (allocate_pages): Allocate `real_mode_mem' in
        an appropiate place in lower memory, between 0x10000 and 0x90000,
        like loader/i386/efi/linux.c does.  Linux often panics if real_mode_mem
        is in our heap (probably as a result of it being corrupted during
        decompression).
2008-11-14 19:04:26 +00:00
bean
556f377582 2008-11-03 Bean <bean123ch@gmail.com>
* kern/elf.c (grub_elf32_load): Revert to previous code.
	(grub_elf64_load): Likewise.

	* loader/i386/bsd.c (grub_bsd_elf32_hook): Change return address.
2008-11-03 13:08:21 +00:00
robertmh
89d5ffcfd1 2008-09-08 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Skip
        segments when their filesz is zero (grub_file_read() interprets
        zero-size as "read untill EOF", which results in memory corruption).
        Use `lowest_segment' rather than 0 for calculating the current
        segment load address.
2008-09-08 19:10:16 +00:00
robertmh
783d0f484f 2008-09-07 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (mmap_addr, mmap_length): Remove
        variables.
        (grub_multiboot): Move `mbi' allocation upwards, so that mmap address
        and length can be stored directly in the `mbi->mmap_addr' and
        `mbi->mmap_length' struct fields.
2008-09-07 17:13:00 +00:00
robertmh
93d5cbf809 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_get_multiboot_mmap_len): Fix
        declaration.
        (grub_multiboot): Fix a few warnings.
2008-08-31 20:43:03 +00:00
robertmh
21751d508a 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Update comment not to say that
        boot_device support is unimplemented.
2008-08-31 19:25:41 +00:00
robertmh
e27a75c58f 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Update comment not to say that a.out
        or memory map support are unimplemented.
2008-08-31 19:12:02 +00:00
robertmh
c9baafe713 2008-08-21 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c: New file.  Implements generic 32-bit Linux
        loader.
        * conf/i386-coreboot.rmk (_linux_mod_SOURCES): Replace
        `loader/i386/pc/linux.c' with `loader/i386/linux.c'.
2008-08-21 13:18:07 +00:00
robertmh
dd6bd6abb9 2008-08-18 Robert Millan <rmh@aybabtu.com>
Unify (identical) linux_normal.c files.
        * loader/i386/efi/linux_normal.c: Move from here ...
        * loader/linux_normal.c: ... to here.  Update all users.
        * loader/i386/pc/linux_normal.c: Delete.  Update all users.
        * loader/i386/ieee1275/linux_normal.c: Likewise.
2008-08-18 13:46:31 +00:00
robertmh
7f42f83e87 2008-08-18 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/linux.h (LINUX_LOADER_ID_LILO)
        (LINUX_LOADER_ID_LOADLIN, LINUX_LOADER_ID_BOOTSECT)
        (LINUX_LOADER_ID_SYSLINUX, LINUX_LOADER_ID_ETHERBOOT)
        (LINUX_LOADER_ID_ELILO, LINUX_LOADER_ID_GRUB, LINUX_LOADER_ID_UBOOT)
        (LINUX_LOADER_ID_XEN, LINUX_LOADER_ID_GUJIN, LINUX_LOADER_ID_QEMU):
        New macros.
        (GRUB_LINUX_CL_OFFSET, GRUB_LINUX_CL_END_OFFSET): Move from here ...
        * loader/i386/pc/linux.c (GRUB_LINUX_CL_OFFSET)
        (GRUB_LINUX_CL_END_OFFSET): ... to here.
        * loader/i386/efi/linux.c (GRUB_EFI_CL_OFFSET): Rename to ...
        (GRUB_LINUX_CL_OFFSET): ... this.  Update all users.
        (GRUB_EFI_CL_END_OFFSET): Rename to ...
        (GRUB_LINUX_CL_END_OFFSET): ... this.  Update all users.
        (grub_rescue_cmd_linux): Macroify `type_of_loader' initialization.
        Initialize `params->video_cursor_x' and `params->video_cursor_y'
        portably using grub_getxy().
        Replace `-EFI' with `-bzImage' in boot message.
2008-08-18 13:01:01 +00:00
robertmh
deceb3ecd3 2008-08-17 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pc/mmap.c'.

        * include/grub/i386/pc/init.h (GRUB_MACHINE_MEMORY_AVAILABLE)
        (GRUB_MACHINE_MEMORY_RESERVED): New macros.
        (grub_machine_mmap_iterate): New function declaration.
        * include/grub/multiboot.h (struct grub_multiboot_mmap_entry): New
        structure.
        (GRUB_MMAP_MEMORY_AVAILABLE, GRUB_MMAP_MEMORY_RESERVED): New
        macros.

        * kern/i386/pc/init.c (grub_machine_init): Replace hardcoded region
        type check value with `GRUB_MACHINE_MEMORY_AVAILABLE'.
        Move e820 parsing from here ...
        * kern/i386/pc/mmap.c: New file.
        (grub_machine_mmap_iterate): ... to here.

        * include/grub/i386/coreboot/memory.h: Remove `<grub/err.h>'.
        (GRUB_LINUXBIOS_MEMORY_AVAILABLE): Rename (for consistency) to ...
        (GRUB_MACHINE_MEMORY_AVAILABLE): ... this.  Update all users.
        (grub_available_iterate): Redeclare to return `void', and redeclare
        its hook to use grub_uint64_t as addr and size parameters, and rename
        to ...
        (grub_machine_mmap_iterate): ... this.  Update all users.

        * kern/i386/coreboot/mmap.c (grub_mmap_iterate): Simplify parser loop
        to make it more readable.  Rename to ...
        (grub_machine_mmap_iterate): ... this.

        * loader/i386/pc/multiboot.c (mmap_addr, mmap_length): New variables.
        (grub_get_multiboot_mmap_len, grub_fill_multiboot_mmap): New functions.
        (grub_multiboot): Allocate an extra region after the payload, and fill
        it with a Multiboot memory map.  Adjust a.out loader to calculate size
        with the extra space.
        (grub_multiboot_load_elf32): Adjust elf32 loader to calculate size
        with the extra space.
2008-08-17 16:32:18 +00:00
robertmh
371458b576 2008-08-12 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
        of the relocation code from here ...
        (grub_multiboot): ... to here.
        (forward_relocator, backward_relocator): Move from here ...
        * kern/i386/loader.S (grub_multiboot_forward_relocator)
        (grub_multiboot_backward_relocator): ... to here.
        (grub_multiboot_real_boot): Use %edx for entry offset.  Put Multiboot
        magic in %eax.  Use %ebp for jumping (so %edx is not trashed).
        * include/grub/i386/loader.h (grub_multiboot_forward_relocator)
        (grub_multiboot_forward_relocator_end)
        (grub_multiboot_backward_relocator)
        (grub_multiboot_backward_relocator_end): New variables.
2008-08-12 15:40:26 +00:00
robertmh
a9053f8f5d 2008-08-04 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Fix misc
        warnings introduced in my last commit.
2008-08-04 09:30:36 +00:00
robertmh
93808428ce 2008-08-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Add a pair
        of informational grub_dprintf() calls.
2008-08-02 15:51:12 +00:00
robertmh
a927cc7383 2008-08-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (playground, forward_relocator)
        (backward_relocator): New variables.  Used to allocate and relocate
        the payload, respectively.
        (grub_multiboot_load_elf32): Load into heap instead of requested
        address, install the appropiate relocator code in each bound of
        the payload, and set the entry point such that
        grub_multiboot_real_boot() will jump to one of them.

        * kern/i386/loader.S (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): New variables.
        (grub_multiboot_real_boot): Set cpu context to what the relocator
        expects, and jump to the relocator instead of the payload.

        * include/grub/i386/loader.h (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): Export.
2008-08-02 12:12:14 +00:00
robertmh
3d8383e7a5 2008-07-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): When loading
        ELF segments, use a macro for arbitrarily accessing any of them instead
        of preparing a pointer that allows access to one at a time.
        (grub_multiboot_load_elf64): Likewise.
2008-07-31 20:48:40 +00:00
bean
2001169405 2008-07-17 Bean <bean123ch@gmail.com>
* conf/i386/efi.rmk (pkglib_MODULES): add pci.mod and lspci.mod.
	(appleldr_mod_SOURCE): New variavle.
	(appleldr_mod_CFLAGS): Likewise.
	(appleldr_mod_LDFLAGS): Likewise.
	(pci_mod_SOURCES): Likewise.
	(pci_mod_CFLAGS): Likewise.
	(pci_mod_LDFLAGS): Likewise.
	(lspci_mod_SOURCES): Likewise.
	(lspci_mod_CFLAGS): Likewise.
	(lspci_mod_LDFLAGS): Likewise.

	* conf/x86_64-efi.rmk: New file.

	* disk/efi/efidisk.c (grub_efidisk_read): Wrap efi calls with efi_call_N
	macro.
	(grub_efidisk_write): Likewise.

	* include/efi/api.h (efi_call_0): New macro.
	(efi_call_1): Likewise.
	(efi_call_2): Likewise.
	(efi_call_3): Likewise.
	(efi_call_4): Likewise.
	(efi_call_5): Likewise.
	(efi_call_6): Likewise.

	* include/grub/efi/chainloader.h (grub_chainloader_cmd): Rename to
	grub_rescue_cmd_chainloader.

	* include/grub/efi/pe32.h (GRUB_PE32_MACHINE_X86_64): New macro.
	(grub_pe32_optional_header): Change some fields based on i386 or
	x86_64 platform.
	(GRUB_PE32_PE32_MAGIC): Likewise.

	* include/grub/efi/uga_draw.h: New file.

	* include/grub/elf.h (STN_ABS): New constant.
	(R_X86_64_NONE): Relocation constant for x86_64.
	(R_X86_64_64): Likewise.
	(R_X86_64_PC32): Likewise.
	(R_X86_64_GOT32): Likewise.
	(R_X86_64_PLT32): Likewise.
	(R_X86_64_COPY): Likewise.
	(R_X86_64_GLOB_DAT): Likewise.
	(R_X86_64_JUMP_SLOT): Likewise.
	(R_X86_64_RELATIVE): Likewise.
	(R_X86_64_GOTPCREL): Likewise.
	(R_X86_64_32): Likewise.
	(R_X86_64_32S): Likewise.
	(R_X86_64_16): Likewise.
	(R_X86_64_PC16): Likewise.
	(R_X86_64_8): Likewise.
	(R_X86_64_PC8): Likewise.

	* include/grub/i386/efi/pci.h: New file.

	* include/grub/i386/linux.h (GRUB_LINUX_EFI_SIGNATURE):
	Change it value based on platform.
	(GRUB_LINUX_EFI_SIGNATURE_0204): New constant.
	(GRUB_E820_RAM): Likewise.
	(GRUB_E820_RESERVED): Likewise.
	(GRUB_E820_ACPI): Likewise.
	(GRUB_E820_NVS): Likewise.
	(GRUB_E820_EXEC_CODE): Likewise.
	(GRUB_E820_MAX_ENTRY): Likewise.
	(grub_e820_mmap): New structure.
	(linux_kernel_header): Change the efi field according to different
	kernel version, also field from linux_kernel_header.

	* include/grub/kernel.h (grub_module_info): Add padding for x86_64.

	* include/grub/pci.h (GRUB_PCI_ADDR_SPACE_MASK): New constant.
	(GRUB_PCI_ADDR_SPACE_MEMORY): Likewise.
	(GRUB_PCI_ADDR_SPACE_IO): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_MASK): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_32): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_1M): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_64): Likewise.
	(GRUB_PCI_ADDR_MEM_PREFETCH): Likewise.
	(GRUB_PCI_ADDR_MEM_MASK): Likewise.
	(GRUB_PCI_ADDR_IO_MASK): Likewise.

	* include/grub/x86_64/efi/kernel.h: New file.

	* include/grub/x86_64/efi/loader.h: Likewise.

	* include/grub/x86_64/efi/machine.h: Likewise.

	* include/grub/x86_64/efi/pci.h: Likewise.

	* include/grub/x86_64/efi/time.h: Likewise.

	* include/grub/x86_64/linux.h: Likewise.

	* include/grub/x86_64/setjmp.h: Likewise.

	* include/grub/x86_64/time.h: Likewise.

	* include/grub/x86_64/types.h: Likewise.

	* kern/dl.c (GRUB_CPU_SIZEOF_VOID_P): Changed to
	 GRUB_TARGET_SIZEOF_VOID_P.

	* kern/efi/efi.c (grub_efi_locate_protocol): Wrap efi calls.
	(grub_efi_locate_handle): Likewise.
	(grub_efi_open_protocol): Likewise.
	(grub_efi_set_text_mode): Likewise.
	(grub_efi_stall): Likewise.
	(grub_exit): Likewise.
	(grub_reboot): Likewise.
	(grub_halt): Likewise.
	(grub_efi_exit_boot_services): Likewise.
	(grub_get_rtc): Likewise.

	* kern/efi/mm.c (MEMORY_MAP_SIZE): Change to 0x3000 for new models.
	(GRUB_CPU_SIZEOF_VOID_P): Changed to GRUB_TARGET_SIZEOF_VOID_P.
	(grub_efi_allocate_pages): Wrap efi calls.
	(grub_efi_free_pages): Wrap efi calls.
	(grub_efi_get_memory_map): Wrap efi calls.

	* kern/x86_64/dl.c: New file.

	* kern/x86_64/efi/callwrap.S: Likewise.

	* kern/x86_64/efi/startup.S: Likewise.

	* loader/efi/appleloader.c: Likewise.

	* loader/efi/chainloader.c (cmdline): New variable.
	(grub_chainloader_unload): Wrap efi calls.
	(grub_chainloader_boot): Likewise.
	(grub_rescue_cmd_chainloader): Wrap efi calls, handle
	command line.

	* loader/efi/chainloader_normal.c (chainloader_command):
	Change grub_chainloader_cmd to grub_rescue_cmd_chainloader, pass
	command line.

	* loader/i386/efi/linux.c (allocate_pages): Change allocation
	method.
	(grub_e820_add_region): New function.
	(grub_linux_boot): Construct e820 map from efi map, handle x86_64
	booting.
	(grub_find_video_card): New function.
	(grub_linux_setup_video): New function.
	(grub_rescue_cmd_linux): Probe for video information.

	* normal/x86_64/setjmp.S: New file.

	* term/efi/console.c (map_char): New function.
	(grub_console_putchar): Map unicode char.
	(grub_console_checkkey): Wrap efi calls.
	(grub_console_getkey): Likewise.
	(grub_console_getwh): Likewise.
	(grub_console_gotoxy): Likewise.
	(grub_console_cls): Likewise.
	(grub_console_setcolorstate): Likewise.
	(grub_console_setcursor): Likewise.

	* util/i386/efi/grub-mkimage.c: Add support for x86_64.
2008-07-17 09:50:26 +00:00