grub/grub-core/kern/i386/pc/init.c

248 lines
6.2 KiB
C
Raw Normal View History

2002-12-27 08:53:07 +00:00
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
2002-12-27 08:53:07 +00:00
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.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/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is free software: you can redistribute it and/or modify
2002-12-27 08:53:07 +00:00
* it under the terms of the GNU General Public License as published by
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.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/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* the Free Software Foundation, either version 3 of the License, or
2002-12-27 08:53:07 +00:00
* (at your option) any later version.
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.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/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is distributed in the hope that it will be useful,
2002-12-27 08:53:07 +00:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.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/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2002-12-27 08:53:07 +00:00
*/
#include <grub/kernel.h>
#include <grub/mm.h>
#include <grub/machine/boot.h>
#include <grub/i386/floppy.h>
#include <grub/machine/memory.h>
#include <grub/machine/console.h>
#include <grub/machine/kernel.h>
2010-04-10 12:35:26 +00:00
#include <grub/machine/int.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/loader.h>
#include <grub/env.h>
2005-01-04 Hollis Blanchard <hollis@penguinppc.org> * TODO: Add note about endianness in grub-mkimage. * boot/powerpc/ieee1275/crt0.S (note): Remove unused .note section. * conf/powerpc-ieee1275.rmk (bin_UTILITIES): Add grub-mkimage. (grub_mkimage_SOURCES): New target. * include/grub/kernel.h (grub_start_addr): Remove variable. (grub_end_addr): Likewise. (grub_total_module_size): Likewise. (grub_kernel_image_size): Likewise. (GRUB_MODULE_MAGIC): New constant. (grub_module_info): New structure. (grub_arch_modules_addr): New prototype. (grub_get_end_addr): Remove prototype. * include/grub/i386/pc/kernel.h (grub_end_addr): New prototype. * include/grub/powerpc/ieee1275/kernel.h: New file. * include/grub/util/misc.h (grub_util_get_fp_size): New prototype. (grub_util_read_at): Likewise. (grub_util_write_image_at): Likewise. * kern/main.c (grub_get_end_addr): Remove function. (grub_load_modules): Call grub_arch_modules_addr instead of using grub_end_addr. Look for a grub_module_info struct in memory. Use the grub_module_info fields instead of calling grub_get_end_addr as loop conditions. Move grub_add_unused_region code here. (grub_add_unused_region): Remove function. * kern/i386/pc/init.c: Include grub/cache.h. (grub_machine_init): Remove call to grub_get_end_addr. Remove one call to add_mem_region. (grub_arch_modules_addr): New function. * kern/powerpc/ieee1275/init.c (grub_end_addr): Remove variable. (grub_total_module_size): Likewise. Include grub/machine/kernel.h. (grub_arch_modules_addr): New function. * util/grub-emu.c (grub_end_addr): Remove variable. (grub_total_module_size): Likewise. (grub_arch_modules_addr): New function. * util/misc.c: Include unistd.h. (grub_util_get_fp_size): New function. (grub_util_read_at): Likewise. (grub_util_write_image_at): Likewise. (grub_util_read_image): Call grub_util_read_at. (grub_util_write_image): Call grub_util_write_image_at. * util/i386/pc/grub-mkimage.c (generate_image): Allocate additional memory in kernel_img for a struct grub_module_info. Fill in that grub_module_info. * util/powerpc/ieee1275/grub-mkimage.c: New file.
2005-01-04 14:01:45 +00:00
#include <grub/cache.h>
#include <grub/time.h>
2008-08-05 Colin D Bennett <colin@gibibit.com> High resolution timer support. Implemented for x86 CPUs using TSC. Extracted generic grub_millisleep() so it's linked in only as needed. This requires a Pentium compatible CPU; if the RDTSC instruction is not supported, then it falls back on the generic grub_get_time_ms() implementation that uses the machine's RTC. * conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c', `kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'. * conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'. * conf/x86_64-efi.rml (kernel_mod_SOURCES): Add `kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'. * conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add `kern/generic/millisleep.c'. * conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise. * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'. * kern/generic/rtc_get_time_ms.c: New file. * kern/generic/millisleep.c: New file. * kern/misc.c: Don't include <kern/time.h> anymore. (grub_millisleep_generic): Removed. * commands/sleep.c (grub_interruptible_millisleep): Uses grub_get_time_ms() instead of grub_get_rtc(). * include/grub/i386/tsc.h (grub_get_tsc): New file. New inline function. (grub_cpu_is_cpuid_supported): New inline function. (grub_cpu_is_tsc_supported): New inline function. (grub_tsc_init): New function prototype. (grub_tsc_get_time_ms): New function prototype. * kern/i386/tsc.c (grub_get_time_ms): New file. * include/grub/time.h: Include <grub/types.h. (grub_millisleep_generic): Removed. (grub_get_time_ms): New prototype. (grub_install_get_time_ms): New prototype. (grub_rtc_get_time_ms): New prototype. * kern/time.c (grub_get_time_ms): New function. (grub_install_get_time_ms): New function. * kern/i386/efi/init.c: Include <grub/cpu/tsc.h>. Don't include <grub/time.h> anymore. (grub_millisleep): Removed. (grub_machine_init): Call grub_tsc_init. * kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC get_time_ms() implementation. * kern/sparc64/ieee1275/init.c (grub_millisleep): Removed. (ieee1275_get_time_ms): New function. (grub_machine_init): Install get_time_ms() implementation. * kern/i386/pc/init.c: Include <grub/cpu/tsc.h>. (grub_machine_init): Call grub_tsc_init(). (grub_millisleep): Removed. * kern/ieee1275/init.c (grub_millisleep): Removed. (grub_machine_init): Install ieee1275_get_time_ms() implementation. (ieee1275_get_time_ms): New function. (grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the real work.
2008-08-05 11:54:37 +00:00
#include <grub/cpu/tsc.h>
#include <grub/machine/time.h>
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
struct mem_region
{
grub_addr_t addr;
grub_size_t size;
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
};
#define MAX_REGIONS 32
static struct mem_region mem_regions[MAX_REGIONS];
static int num_regions;
void (*grub_pc_net_config) (char **device, char **path);
/*
* return the real time in ticks, of which there are about
* 18-20 per second
*/
grub_uint64_t
grub_rtc_get_time_ms (void)
{
struct grub_bios_int_registers regs;
regs.eax = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x1a, &regs);
return ((regs.ecx << 16) | (regs.edx & 0xffff)) * 55ULL;
}
2011-07-02 12:09:36 +00:00
void
grub_machine_get_bootlocation (char **device, char **path)
2003-01-06 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h. (setup): Configure the installed partition information and the dl prefix. * loader/i386/pc/chainloader.c (my_mod): New variable. (pupa_chainloader_unload): New function. (pupa_rescue_cmd_chainloader): Refer itself. (PUPA_MOD_INIT): Save its own module in MY_MOD. * kern/i386/pc/startup.S (install_partition): Removed. (version_string): Likewise. (config_file): Likewise. (pupa_install_dos_part): New variable. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_chainloader_real_boot): Call pupa_dl_unload_all. * kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h and pupa/misc.h. (make_install_device): New function. (pupa_machine_init): Set the dl prefix. * kern/rescue.c: Include pupa/rescue.h and pupa/dl.h. (buf): Renamed to ... (linebuf): ... this. (pupa_rescue_cmd_prefix): New function. (pupa_rescue_cmd_insmod): Likewise. (pupa_rescue_cmd_rmmod): Likewise. (pupa_rescue_cmd_lsmod): Likewise. (pupa_enter_rescue_mode): Register new commands: prefix, insmod, rmmod and lsmod. * kern/mm.c (pupa_memalign): If failed even after invalidating disk caches, unload unneeded modules and retry. * kern/misc.c (pupa_memmove): New function. (pupa_memcpy): Removed. (pupa_strcpy): New function. (pupa_itoa): Made static. * kern/dl.c (pupa_dl_iterate): New function. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_unload): Return if succeeded or not. (pupa_dl_unload_unneeded): New function. (pupa_dl_unload_all): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): New function. * include/pupa/i386/pc/kernel.h: Include pupa/types.h. (PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro. (PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise. (PUPA_KERNEL_MACHINE_PREFIX): Likewise. (pupa_install_dos_part): Declared. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_boot_drive): Likewise. * include/pupa/types.h: Fix a typo. * include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to pupa_memmove. (pupa_memmove): Declared. (pupa_strcpy): Likewise. * include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now pupa_mod_init takes one argument, its own module. (pupa_dl_unload_unneeded): Declared. (pupa_dl_unload_all): Likewise. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_iterate): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): Declared. * fs/fat.c [!PUPA_UTIL] (my_mod): New variable. (pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being unloaded. (pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded. (pupa_fat_close) [!PUPA_UTIL]: Unrefer itself. * configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith, -Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
2003-01-06 00:01:35 +00:00
{
2011-07-02 12:09:36 +00:00
char *ptr;
grub_uint8_t boot_drive, dos_part, bsd_part;
boot_drive = (grub_boot_device >> 24);
dos_part = (grub_boot_device >> 16);
bsd_part = (grub_boot_device >> 8);
2009-06-10 21:04:23 +00:00
2011-07-02 12:09:36 +00:00
/* No hardcoded root partition - make it from the boot drive and the
partition number encoded at the install time. */
if (boot_drive == GRUB_BOOT_MACHINE_PXE_DL)
{
if (grub_pc_net_config)
grub_pc_net_config (device, path);
2011-07-02 12:09:36 +00:00
return;
}
2009-06-10 21:04:23 +00:00
2011-07-02 12:09:36 +00:00
/* XXX: This should be enough. */
#define DEV_SIZE 100
*device = grub_malloc (DEV_SIZE);
ptr = *device;
grub_snprintf (*device, DEV_SIZE,
"%cd%u", (boot_drive & 0x80) ? 'h' : 'f',
boot_drive & 0x7f);
2011-07-02 12:09:36 +00:00
ptr += grub_strlen (ptr);
if (dos_part != 0xff)
2011-07-02 12:09:36 +00:00
grub_snprintf (ptr, DEV_SIZE - (ptr - *device),
",%u", dos_part + 1);
2011-07-02 12:09:36 +00:00
ptr += grub_strlen (ptr);
if (bsd_part != 0xff)
2011-07-02 12:09:36 +00:00
grub_snprintf (ptr, DEV_SIZE - (ptr - *device), ",%u",
bsd_part + 1);
2011-07-02 12:09:36 +00:00
ptr += grub_strlen (ptr);
*ptr = 0;
2003-01-06 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h. (setup): Configure the installed partition information and the dl prefix. * loader/i386/pc/chainloader.c (my_mod): New variable. (pupa_chainloader_unload): New function. (pupa_rescue_cmd_chainloader): Refer itself. (PUPA_MOD_INIT): Save its own module in MY_MOD. * kern/i386/pc/startup.S (install_partition): Removed. (version_string): Likewise. (config_file): Likewise. (pupa_install_dos_part): New variable. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_chainloader_real_boot): Call pupa_dl_unload_all. * kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h and pupa/misc.h. (make_install_device): New function. (pupa_machine_init): Set the dl prefix. * kern/rescue.c: Include pupa/rescue.h and pupa/dl.h. (buf): Renamed to ... (linebuf): ... this. (pupa_rescue_cmd_prefix): New function. (pupa_rescue_cmd_insmod): Likewise. (pupa_rescue_cmd_rmmod): Likewise. (pupa_rescue_cmd_lsmod): Likewise. (pupa_enter_rescue_mode): Register new commands: prefix, insmod, rmmod and lsmod. * kern/mm.c (pupa_memalign): If failed even after invalidating disk caches, unload unneeded modules and retry. * kern/misc.c (pupa_memmove): New function. (pupa_memcpy): Removed. (pupa_strcpy): New function. (pupa_itoa): Made static. * kern/dl.c (pupa_dl_iterate): New function. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_unload): Return if succeeded or not. (pupa_dl_unload_unneeded): New function. (pupa_dl_unload_all): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): New function. * include/pupa/i386/pc/kernel.h: Include pupa/types.h. (PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro. (PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise. (PUPA_KERNEL_MACHINE_PREFIX): Likewise. (pupa_install_dos_part): Declared. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_boot_drive): Likewise. * include/pupa/types.h: Fix a typo. * include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to pupa_memmove. (pupa_memmove): Declared. (pupa_strcpy): Likewise. * include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now pupa_mod_init takes one argument, its own module. (pupa_dl_unload_unneeded): Declared. (pupa_dl_unload_all): Likewise. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_iterate): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): Declared. * fs/fat.c [!PUPA_UTIL] (my_mod): New variable. (pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being unloaded. (pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded. (pupa_fat_close) [!PUPA_UTIL]: Unrefer itself. * configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith, -Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
2003-01-06 00:01:35 +00:00
}
2002-12-27 08:53:07 +00:00
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
/* Add a memory region. */
static void
add_mem_region (grub_addr_t addr, grub_size_t size)
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
{
if (num_regions == MAX_REGIONS)
/* Ignore. */
return;
mem_regions[num_regions].addr = addr;
mem_regions[num_regions].size = size;
num_regions++;
}
/* Compact memory regions. */
static void
compact_mem_regions (void)
{
int i, j;
/* Sort them. */
for (i = 0; i < num_regions - 1; i++)
for (j = i + 1; j < num_regions; j++)
if (mem_regions[i].addr > mem_regions[j].addr)
{
struct mem_region tmp = mem_regions[i];
mem_regions[i] = mem_regions[j];
mem_regions[j] = tmp;
}
/* Merge overlaps. */
for (i = 0; i < num_regions - 1; i++)
if (mem_regions[i].addr + mem_regions[i].size >= mem_regions[i + 1].addr)
{
j = i + 1;
2009-06-10 21:04:23 +00:00
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
if (mem_regions[i].addr + mem_regions[i].size
< mem_regions[j].addr + mem_regions[j].size)
mem_regions[i].size = (mem_regions[j].addr + mem_regions[j].size
- mem_regions[i].addr);
grub_memmove (mem_regions + j, mem_regions + j + 1,
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
(num_regions - j - 1) * sizeof (struct mem_region));
i--;
num_regions--;
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
}
}
Replace grub_module_iterate with FOR_MODULES. * grub-core/disk/memdisk.c (GRUB_MOD_INIT): Switched to new interface. * grub-core/kern/efi/efi.c (grub_arch_modules_addr): Renamed to... (grub_efi_modules_addr): ...this. * grub-core/kern/efi/init.c (grub_modbase): New variable. (grub_efi_init): Set grub_modbase. * grub-core/kern/emu/main.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. * grub-core/kern/i386/coreboot/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/i386/pc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/ieee1275/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/main.c (grub_module_iterate): Remove. (grub_modules_get_end): Use grub_modbase. (grub_load_modules): Use FOR_MODULES. (grub_load_config): Likewise. * grub-core/kern/mips/arc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * include/grub/efi/efi.h (grub_efi_modules_addr): New declaration. * include/grub/kernel.h (grub_arch_modules_addr): Removed. (grub_module_iterate): Likewise. (grub_modbase): New variable declaration. (FOR_MODULES): New macro.
2011-10-16 13:23:29 +00:00
grub_addr_t grub_modbase;
Remove redundant grub_kernel_image_size. * grub-core/kern/i386/coreboot/init.c (grub_machine_init): Use _edata and _start. * grub-core/kern/i386/coreboot/startup.S: Move multiboot header after the small code. It moves it only by few bytes but simplifies the code. * grub-core/kern/i386/pc/init.c (grub_machine_init): Use _edata and _start. * grub-core/kern/i386/pc/startup.S: Use _edata and _start. (grub_kernel_image_size): Removed. * grub-core/kern/i386/qemu/startup.S: Use _edata and _start. (grub_kernel_image_size): Removed. [APPLE_CC]: Remove apple compiler support. i386-qemu port can't be compiled with Apple toolchain. * grub-core/kern/sparc64/ieee1275/crt0.S: Remove leftover fields. * include/grub/i386/pc/kernel.h (grub_kernel_image_size): Removed. * include/grub/i386/qemu/kernel.h (grub_kernel_image_size): Removed. (grub_total_module_size): Likewise. * include/grub/offsets.h (GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE): Removed. (GRUB_KERNEL_I386_PC_COMPRESSED_SIZE): Put it lower. (GRUB_KERNEL_I386_PC_INSTALL_DOS_PART): Likewise. (GRUB_KERNEL_I386_PC_INSTALL_BSD_PART): Likewise. (GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY): Likewise. (GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE): Removed. (GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE): Likewise. (GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE): Likewise. * include/grub/sparc64/ieee1275/kernel.h (grub_kernel_image_size): Removed. (grub_total_module_size): Removed. * util/grub-mkimage.c (image_target_desc): Remove image_size. (image_targets): Likewise. Set .compressed_size to no field on sparc. (generate_image): Remove kernel_image_size handling.
2011-10-20 06:13:00 +00:00
extern grub_uint8_t _start[], _edata[];
Replace grub_module_iterate with FOR_MODULES. * grub-core/disk/memdisk.c (GRUB_MOD_INIT): Switched to new interface. * grub-core/kern/efi/efi.c (grub_arch_modules_addr): Renamed to... (grub_efi_modules_addr): ...this. * grub-core/kern/efi/init.c (grub_modbase): New variable. (grub_efi_init): Set grub_modbase. * grub-core/kern/emu/main.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. * grub-core/kern/i386/coreboot/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/i386/pc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/ieee1275/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/main.c (grub_module_iterate): Remove. (grub_modules_get_end): Use grub_modbase. (grub_load_modules): Use FOR_MODULES. (grub_load_config): Likewise. * grub-core/kern/mips/arc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * include/grub/efi/efi.h (grub_efi_modules_addr): New declaration. * include/grub/kernel.h (grub_arch_modules_addr): Removed. (grub_module_iterate): Likewise. (grub_modbase): New variable declaration. (FOR_MODULES): New macro.
2011-10-16 13:23:29 +00:00
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
/* Helper for grub_machine_init. */
static int
mmap_iterate_hook (grub_uint64_t addr, grub_uint64_t size,
grub_memory_type_t type,
void *data __attribute__ ((unused)))
{
/* Avoid the lower memory. */
if (addr < GRUB_MEMORY_MACHINE_UPPER_START)
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
{
if (size <= GRUB_MEMORY_MACHINE_UPPER_START - addr)
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
return 0;
size -= GRUB_MEMORY_MACHINE_UPPER_START - addr;
addr = GRUB_MEMORY_MACHINE_UPPER_START;
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
}
/* Ignore >4GB. */
if (addr <= 0xFFFFFFFF && type == GRUB_MEMORY_AVAILABLE)
{
grub_size_t len;
len = (grub_size_t) ((addr + size > 0xFFFFFFFF)
? 0xFFFFFFFF - addr
: size);
add_mem_region (addr, len);
}
return 0;
}
2002-12-27 08:53:07 +00:00
void
grub_machine_init (void)
2002-12-27 08:53:07 +00:00
{
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
int i;
#if 0
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
int grub_lower_mem;
#endif
grub_addr_t modend;
2009-06-10 21:04:23 +00:00
grub_modbase = GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR + (_edata - _start);
Replace grub_module_iterate with FOR_MODULES. * grub-core/disk/memdisk.c (GRUB_MOD_INIT): Switched to new interface. * grub-core/kern/efi/efi.c (grub_arch_modules_addr): Renamed to... (grub_efi_modules_addr): ...this. * grub-core/kern/efi/init.c (grub_modbase): New variable. (grub_efi_init): Set grub_modbase. * grub-core/kern/emu/main.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. * grub-core/kern/i386/coreboot/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/i386/pc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/ieee1275/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/main.c (grub_module_iterate): Remove. (grub_modules_get_end): Use grub_modbase. (grub_load_modules): Use FOR_MODULES. (grub_load_config): Likewise. * grub-core/kern/mips/arc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * include/grub/efi/efi.h (grub_efi_modules_addr): New declaration. * include/grub/kernel.h (grub_arch_modules_addr): Removed. (grub_module_iterate): Likewise. (grub_modbase): New variable declaration. (FOR_MODULES): New macro.
2011-10-16 13:23:29 +00:00
2002-12-27 08:53:07 +00:00
/* Initialize the console as early as possible. */
grub_console_init ();
2009-06-10 21:04:23 +00:00
/* This sanity check is useless since top of GRUB_MEMORY_MACHINE_RESERVED_END
is used for stack and if it's unavailable we wouldn't have gotten so far.
*/
#if 0
2010-04-10 12:35:26 +00:00
grub_lower_mem = grub_get_conv_memsize () << 10;
2009-06-10 21:04:23 +00:00
2002-12-27 08:53:07 +00:00
/* Sanity check. */
if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END)
grub_fatal ("too small memory");
#endif
/* FIXME: This prevents loader/i386/linux.c from using low memory. When our
heap implements support for requesting a chunk in low memory, this should
no longer be a problem. */
#if 0
2002-12-27 08:53:07 +00:00
/* Add the lower memory into free memory. */
if (grub_lower_mem >= GRUB_MEMORY_MACHINE_RESERVED_END)
add_mem_region (GRUB_MEMORY_MACHINE_RESERVED_END,
grub_lower_mem - GRUB_MEMORY_MACHINE_RESERVED_END);
#endif
2009-06-10 21:04:23 +00:00
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
grub_machine_mmap_iterate (mmap_iterate_hook, NULL);
2009-06-10 21:04:23 +00:00
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
compact_mem_regions ();
modend = grub_modules_get_end ();
2003-01-17 Yoshinori K. Okuji <okuji@enbug.org> * include/pupa/i386/pc/linux.h: New file. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/chainloader.c (pupa_chainloader_boot_sector): Removed. (pupa_chainloader_unload): Return PUPA_ERR_NONE. (pupa_rescue_cmd_chainloader): Read the image to 0x7C00 instead of PUPA_CHAINLOADER_BOOT_SECTOR. * kern/i386/pc/startup.S: Include pupa/machine/linux.h. (pupa_linux_prot_size): New variable. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): New function. (pupa_linux_boot_bzimage): Likewise. * kern/i386/pc/init.c (struct mem_region): New structure. (MAX_REGIONS): New macro. (mem_regions): New variable. (num_regions): Likewise. (pupa_os_area_addr): Likewise. (pupa_os_area_size): Likewise. (pupa_lower_mem): Likewise. (pupa_upper_mem): Likewise. (add_mem_region): New function. (compact_mem_regions): Likewise. (pupa_machine_init): Set PUPA_LOWER_MEM and PUPA_UPPER_MEM to the size of the conventional memory and that of so-called upper memory (before the first memory hole). Instead of adding each found region to free memory, use add_mem_region and add them after removing overlaps. Also, add only 1/4 of the upper memory to free memory. The rest is used for loading OS images. Maybe this is ad hoc, but this makes it much easier to relocate OS images when booting. * kern/rescue.c (pupa_rescue_cmd_module): Removed. (pupa_enter_rescue_mode): Don't register initrd and module. * kern/mm.c: Include pupa/dl.h. * kern/main.c: Include pupa/file.h and pupa/device.h. * kern/loader.c (pupa_loader_load_module_func): Removed. (pupa_loader_load_module): Likewise. * kern/dl.c (pupa_dl_load): Use the suffix ``.mod'' instead of ``.o''. * include/pupa/i386/pc/loader.h (pupa_linux_prot_size): Declared. (pupa_linux_tmp_addr): Likewise. (pupa_linux_real_addr): Likewise. (pupa_linux_boot_zimage): Likewise. (pupa_linux_boot_bzimage): Likewise. * include/pupa/i386/pc/init.h (pupa_lower_mem): Declared. (pupa_upper_mem): Likewise. (pupa_gate_a20): Don't export, because turning off Gate A20 in a module is too dangerous. * include/pupa/loader.h (pupa_os_area_addr): Declared. (pupa_os_area_size): Likewise. (pupa_loader_set): Remove the first argument. Loader doesn't manage modules or initrd any longer. (pupa_loader_load_module): Removed. * conf/i386-pc.rmk (pkgdata_MODULES): Added linux.mod. (linux_mod_SOURCES): New variable. (linux_mod_CFLAGS): Likewise.
2003-01-17 02:52:05 +00:00
for (i = 0; i < num_regions; i++)
{
grub_addr_t beg = mem_regions[i].addr;
grub_addr_t fin = mem_regions[i].addr + mem_regions[i].size;
if (modend && beg < modend)
beg = modend;
if (beg >= fin)
continue;
grub_mm_init_region ((void *) beg, fin - beg);
}
2009-06-10 21:04:23 +00:00
2008-08-05 Colin D Bennett <colin@gibibit.com> High resolution timer support. Implemented for x86 CPUs using TSC. Extracted generic grub_millisleep() so it's linked in only as needed. This requires a Pentium compatible CPU; if the RDTSC instruction is not supported, then it falls back on the generic grub_get_time_ms() implementation that uses the machine's RTC. * conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c', `kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'. * conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'. * conf/x86_64-efi.rml (kernel_mod_SOURCES): Add `kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'. * conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add `kern/generic/millisleep.c'. * conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise. * conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'. * kern/generic/rtc_get_time_ms.c: New file. * kern/generic/millisleep.c: New file. * kern/misc.c: Don't include <kern/time.h> anymore. (grub_millisleep_generic): Removed. * commands/sleep.c (grub_interruptible_millisleep): Uses grub_get_time_ms() instead of grub_get_rtc(). * include/grub/i386/tsc.h (grub_get_tsc): New file. New inline function. (grub_cpu_is_cpuid_supported): New inline function. (grub_cpu_is_tsc_supported): New inline function. (grub_tsc_init): New function prototype. (grub_tsc_get_time_ms): New function prototype. * kern/i386/tsc.c (grub_get_time_ms): New file. * include/grub/time.h: Include <grub/types.h. (grub_millisleep_generic): Removed. (grub_get_time_ms): New prototype. (grub_install_get_time_ms): New prototype. (grub_rtc_get_time_ms): New prototype. * kern/time.c (grub_get_time_ms): New function. (grub_install_get_time_ms): New function. * kern/i386/efi/init.c: Include <grub/cpu/tsc.h>. Don't include <grub/time.h> anymore. (grub_millisleep): Removed. (grub_machine_init): Call grub_tsc_init. * kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC get_time_ms() implementation. * kern/sparc64/ieee1275/init.c (grub_millisleep): Removed. (ieee1275_get_time_ms): New function. (grub_machine_init): Install get_time_ms() implementation. * kern/i386/pc/init.c: Include <grub/cpu/tsc.h>. (grub_machine_init): Call grub_tsc_init(). (grub_millisleep): Removed. * kern/ieee1275/init.c (grub_millisleep): Removed. (grub_machine_init): Install ieee1275_get_time_ms() implementation. (ieee1275_get_time_ms): New function. (grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the real work.
2008-08-05 11:54:37 +00:00
grub_tsc_init ();
2006-04-25 Yoshinori K. Okuji <okuji@enbug.org> A new machine-specific function "grub_machine_set_prefix" is defined. This is called after loading modules, so that a prefix initialization can use modules. Also, this change adds an intensive debugging feature for the memory manager via the configure option "--enable-mm-debug". * partmap/gpt.c (gpt_partition_map_iterate): Add one more into PART.LEN. * kern/sparc64/ieee1275/init.c (abort): Removed. (grub_stop): Likewise. (grub_exit): New function. (grub_set_prefix): Renamed to ... (grub_machine_set_prefix): ... this. (grub_machine_init): Do not call grub_set_prefix. * kern/powerpc/ieee1275/init.c (grub_set_prefix): Renamed to ... (grub_machine_set_prefix): ... this. (grub_machine_init): Do not call grub_set_prefix. * kern/i386/pc/init.c (grub_machine_set_prefix): New function. (grub_machine_init): Do not set the prefix here. * kern/i386/efi/init.c (grub_machine_set_prefix): New function. * kern/efi/init.c: Include grub/mm.h. (grub_efi_set_prefix): New function. * kern/efi/efi.c (grub_exit): Call grub_efi_fini. (grub_efi_get_filename): New function. (grub_print_device_path): Renamed to ... (grub_efi_print_device_path): ... this. * kern/mm.c [MM_DEBUG] (grub_malloc): Undefined. [MM_DEBUG] (grub_realloc): Likewise. [MM_DEBUG] (grub_free): Likewise. [MM_DEBUG] (grub_memalign): Likewise. [MM_DEBUG] (grub_mm_debug): New variable. [MM_DEBUG] (grub_debug_malloc): New function. [MM_DEBUG] (grub_debug_free): New function. [MM_DEBUG] (grub_debug_realloc): New function. [MM_DEBUG] (grub_debug_memalign): New function. * kern/misc.c (grub_abort): Print a newline to distinguish the message. * kern/main.c (grub_main): Call grub_machine_set_prefix and grub_set_root_dev after loading modules. This is necessary when setting a prefix depends on modules. * include/grub/efi/efi.h (grub_print_device_path): Renamed to ... (grub_efi_print_device_path): ... this. (grub_efi_get_filename): New prototype. (grub_efi_set_prefix): Likewise. * include/grub/efi/disk.h: Include grub/efi/api.h, grub/symbol.h and grub/disk.h. (grub_efidisk_get_device_handle): New prototype. (grub_efidisk_get_device_name): Likewise. * include/grub/mm.h: Include config.h. (MM_DEBUG): Removed. [MM_DEBUG && !GRUB_UTIL] (grub_mm_debug): New prototype. [MM_DEBUG && !GRUB_UTIL] (grub_malloc): New macro. [MM_DEBUG && !GRUB_UTIL] (grub_realloc): Likewise. [MM_DEBUG && !GRUB_UTIL] (grub_memalign): Likewise. [MM_DEBUG && !GRUB_UTIL] (grub_free): Likewise. [MM_DEBUG && !GRUB_UTIL] (grub_debug_malloc): New prototype. [MM_DEBUG && !GRUB_UTIL] (grub_debug_realloc): New prototype. [MM_DEBUG && !GRUB_UTIL] (grub_debug_memalign): New prototype. [MM_DEBUG && !GRUB_UTIL] (grub_debug_free): New prototype. * include/grub/kernel.h (grub_machine_set_prefix): New prototype. * disk/efi/efidisk.c: Include grub/partition.h. (iterate_child_devices): New function. (add_device): First, compare only last device path nodes, so that devices are sorted by the types. (grub_efidisk_get_device_handle): New function. (grub_efidisk_get_device_name): Likewise. * configure.ac (--enable-mm-debug): New option to enable the memory manager debugging feature. This makes the binary much bigger, so is disabled by default.
2006-04-25 20:08:31 +00:00
}
2003-01-06 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h. (setup): Configure the installed partition information and the dl prefix. * loader/i386/pc/chainloader.c (my_mod): New variable. (pupa_chainloader_unload): New function. (pupa_rescue_cmd_chainloader): Refer itself. (PUPA_MOD_INIT): Save its own module in MY_MOD. * kern/i386/pc/startup.S (install_partition): Removed. (version_string): Likewise. (config_file): Likewise. (pupa_install_dos_part): New variable. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_chainloader_real_boot): Call pupa_dl_unload_all. * kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h and pupa/misc.h. (make_install_device): New function. (pupa_machine_init): Set the dl prefix. * kern/rescue.c: Include pupa/rescue.h and pupa/dl.h. (buf): Renamed to ... (linebuf): ... this. (pupa_rescue_cmd_prefix): New function. (pupa_rescue_cmd_insmod): Likewise. (pupa_rescue_cmd_rmmod): Likewise. (pupa_rescue_cmd_lsmod): Likewise. (pupa_enter_rescue_mode): Register new commands: prefix, insmod, rmmod and lsmod. * kern/mm.c (pupa_memalign): If failed even after invalidating disk caches, unload unneeded modules and retry. * kern/misc.c (pupa_memmove): New function. (pupa_memcpy): Removed. (pupa_strcpy): New function. (pupa_itoa): Made static. * kern/dl.c (pupa_dl_iterate): New function. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_unload): Return if succeeded or not. (pupa_dl_unload_unneeded): New function. (pupa_dl_unload_all): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): New function. * include/pupa/i386/pc/kernel.h: Include pupa/types.h. (PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro. (PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise. (PUPA_KERNEL_MACHINE_PREFIX): Likewise. (pupa_install_dos_part): Declared. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_boot_drive): Likewise. * include/pupa/types.h: Fix a typo. * include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to pupa_memmove. (pupa_memmove): Declared. (pupa_strcpy): Likewise. * include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now pupa_mod_init takes one argument, its own module. (pupa_dl_unload_unneeded): Declared. (pupa_dl_unload_all): Likewise. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_iterate): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): Declared. * fs/fat.c [!PUPA_UTIL] (my_mod): New variable. (pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being unloaded. (pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded. (pupa_fat_close) [!PUPA_UTIL]: Unrefer itself. * configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith, -Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
2003-01-06 00:01:35 +00:00
void
grub_machine_fini (int flags)
{
if (flags & GRUB_LOADER_FLAG_NORETURN)
grub_console_fini ();
grub_stop_floppy ();
}