merge mainline into bootcheck

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-20 11:13:21 +01:00
commit 9f2b45cbb9
177 changed files with 5000 additions and 857 deletions

379
ChangeLog
View file

@ -1,3 +1,382 @@
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
Don't try to generate lists for kernel.img.
* conf/i386-efi.rmk (pkglib_PROGRAMS): New variable.
(pkglib_MODULES): Remove kernel.img.
(kernel_img_EXPORTS): Removed.
(kernel_img_RELOCATABLE): New variable.
* conf/x86_64-efi.rmk: Likewise.
* genmk.rb: Remove *_EXPORTS support and add *_RELOCATABLE support.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h (grub_sprintf): Removed. All users switched to
grub_xasprintf or grub_snprintf.
(grub_vsprintf): Likewise.
(grub_snprintf): New proto.
(grub_vsnprintf): Likewise.
(grub_xasprintf): Likewise.
(grub_xvasprintf): Likewise.
* kern/misc.c (grub_vprintf): Use grub_vsnprintf_real.
(grub_sprintf): Removed.
(grub_vsnprintf): New function.
(grub_snprintf): Likewise.
(grub_xvasprintf): Likewise.
(grub_xasprintf): Likewise.
(grub_vsprintf): Renamed to ...
(grub_vsnprintf_real): ...this. New argument max_len.
2010-01-20 BVK Chaitanya <bvk.groups@gmail.com>
* include/grub/script_sh.h (sourcecode): Remove const qualifier to
fix grub-script-check warning.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/font.h (grub_font_load): Fix prototype.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* conf/mips.rmk (kernel_img_HEADERS) [yeeloong]: Add pci.h.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/x86_64/at_keyboard.h: New file.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* loader/mips/linux.c: Include missing grub/i18n.h.
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* normal/menu.c (notify_execution_failure): Clarify error message.
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* commands/loadenv.c (check_blocklists): Use `grub_err_t' as
return value (and revert all return statements). Update users.
2010-01-20 Dan Merillat <debian@dan.merillat.org>
* kern/device.c (grub_device_iterate): Allocate new part_ent
structure based on sizeof (*p) rather than sizeof (p->next), to
account for structure padding.
* util/grub-probe.c (probe_raid_level): Return -1 immediately if
disk is NULL, which might happen for LVM physical volumes with no
LVM signature.
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* loader/mips/linux.c (grub_cmd_initrd)
(GRUB_MOD_INIT(linux)): Adjust and gettextize a few strings.
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* kern/mips/yeeloong/init.c (grub_video_sm712_init)
(grub_video_video_init, grub_video_bitmap_init)
(grub_font_manager_init, grub_term_gfxterm_init)
(grub_at_keyboard_init): New extern declarations.
(grub_machine_init): Initialize gfxterm and at_keyboard.
* kern/main.c (grub_main): Revert grub_printf delay kludge.
* util/grub-install.in: Revert embed of `at_keyboard.mod' and
`gfxterm.mod' into core image.
* conf/mips.rmk (pkglib_IMAGES, kernel_img_SOURCES)
(kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS)
(kernel_img_FORMAT): Copy to ...
* conf/mips-qemu-mips.rmk (pkglib_IMAGES, kernel_img_SOURCES)
(kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS)
(kernel_img_FORMAT): ... here, and ...
* conf/mips-yeeloong.rmk (pkglib_IMAGES, kernel_img_SOURCES)
(kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS)
(kernel_img_FORMAT): ... here.
(kernel_img_SOURCES): Add files necessary for output (gfxterm)
and input (at_keyboard) terminals in kernel.
(kernel_img_CFLAGS): Add `-DUSE_ASCII_FAILBACK'.
(pkglib_MODULES): Remove `pci.mod'.
(pci_mod_SOURCES, pci_mod_CFLAGS, pci_mod_LDFLAGS)
(sm712_mod_SOURCES, sm712_mod_CFLAGS, sm712_mod_LDFLAGS)
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): Remove variables.
2010-01-11 Felix Zielcke <fzielcke@z-51.de>
* po/POTFILES: Replace `term/i386/pc/serial.c' with `term/serial.c'.
2009-12-10 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/mips/libgcc.h: Only export symbols for functions
that libgcc provides.
2009-12-02 Vladimir Serbinenko <phcoder@gmail.com>
MIPS support.
* bus/bonito.c: New file.
* bus/pci.c (grub_pci_iterate): Use GRUB_PCI_NUM_BUS and
GRUB_PCI_NUM_DEVICES.
* term/i386/pc/serial.c: Move to ...
* term/serial.c: ... here. All users updated.
* util/i386/pc/grub-mkimage.c: Move to ...
* util/grub-mkrawimage.c: ... here. All users updated.
* term/i386/pc/at_keyboard.c: Move to ...
* term/at_keyboard.c: ... here. All users updated.
* conf/mips-qemu-mips.rmk: New file.
* conf/mips-yeeloong.rmk: Likewise.
* conf/mips.rmk: Likewise.
* configure.ac: New platforms mipsel-yeeloong, mips-qemu-mips and
mipsel-qemu-mips.
* disk/ata.c (grub_ata_device_initialize): Add GRUB_MACHINE_PCI_IO_BASE
to port addresses.
(grub_ata_pciinit): Support CS5536.
* font/font.c (grub_font_load): Use grub_file_t instead of filename.
* font/font_cmd.c (loadfont_command): Open file before passing it to
grub_font_load.
(pseudo_file_read): New function.
(pseudo_file_close): Likewise.
(pseudo_fs): New structure.
(load_font_module): New function.
(GRUB_MOD_INIT(font_manager)): Load embedded font.
* fs/cpio.c (grub_cpio_open): Handle partial matches correctly.
* genmk.rb: Strip .rel.dyn, .reginfo, .note and .comment.
* genmoddep.awk: Ignore __gnu_local_gp. It's defined by linker.
* include/grub/i386/at_keyboard.h: Split into ...
* include/grub/at_keyboard.h: ... this ...
* include/grub/i386/at_keyboard.h: ... and this.
* include/grub/dl.h (grub_arch_dl_init_linker) [_mips && !GRUB_UTIL]:
New prototype.
* include/grub/elfload.h (grub_elf32_size): New parameter. All users
updated.
(grub_elf64_size): Likewise.
* include/grub/font.h (grub_font_load): Use grub_file_t instead of
filename.
* include/grub/i386/io.h (grub_port_t): New type. All users updated.
* include/grub/i386/coreboot/serial.h: Rewritten.
* include/grub/i386/ieee1275/serial.h: Include
grub/i386/coreboot/serial.h instead of grub/i386/pc/serial.h.
* include/grub/i386/pc/serial.h: Moved from here ...
* include/grub/serial.h: ... to here. All users updated.
* include/grub/i386/pci.h (GRUB_MACHINE_PCI_IO_BASE): New definition.
(GRUB_PCI_NUM_BUS): Likewise.
(GRUB_PCI_NUM_DEVICES): Likewise.
(grub_pci_device_map_range): Add missing volatile keyword.
* include/grub/kernel.h (OBJ_TYPE_FONT): New enum value.
* include/grub/mips/at_keyboard.h: New file.
* include/grub/mips/cache.h: Likewise.
* include/grub/mips/io.h: Likewise.
* include/grub/mips/kernel.h: Likewise.
* include/grub/mips/libgcc.h: Likewise.
* include/grub/mips/pci.h: Likewise.
* include/grub/mips/qemu-mips/boot.h: Likewise.
* include/grub/mips/qemu-mips/kernel.h: Likewise.
* include/grub/mips/qemu-mips/loader.h: Likewise.
* include/grub/mips/qemu-mips/memory.h: Likewise.
* include/grub/mips/qemu-mips/serial.h: Likewise.
* include/grub/mips/qemu-mips/time.h: Likewise.
* include/grub/mips/relocator.h: Likewise.
* include/grub/mips/time.h: Likewise.
* include/grub/mips/types.h: Likewise.
* include/grub/mips/yeeloong/at_keyboard.h: Likewise.
* include/grub/mips/yeeloong/boot.h: Likewise.
* include/grub/mips/yeeloong/kernel.h: Likewise.
* include/grub/mips/yeeloong/loader.h: Likewise.
* include/grub/mips/yeeloong/memory.h: Likewise.
* include/grub/mips/yeeloong/pci.h: Likewise.
* include/grub/mips/yeeloong/serial.h: Likewise.
* include/grub/mips/yeeloong/time.h: Likewise.
* kern/dl.c (grub_dl_resolve_symbols): Handle STT_OBJECT correctly.
* kern/elf.c (grub_elf32_size): New parameter. All users
updated.
(grub_elf64_size): Likewise.
* kern/main.c (grub_main): Call grub_arch_dl_init_linker if necessary.
Load modules before saying "Welcome to GRUB!".
Call grub_refresh after saying "Welcome to GRUB!".
* kern/mips/cache.S: New file.
* kern/mips/cache_flush.S: Likewise.
* kern/mips/dl.c: Likewise.
* kern/mips/init.c: Likewise.
* kern/mips/qemu-mips/init.c: Likewise.
* kern/mips/startup.S: Likewise.
* kern/mips/yeeloong/init.c: Likewise.
* kern/term.c (grub_putcode): Handle NULL terminal.
(grub_getcharwidth): Likewise.
(grub_getkey): Likewise.
(grub_checkkey): Likewise.
(grub_getkeystatus): Likewise.
(grub_getxy): Likewise.
(grub_getwh): Likewise.
(grub_gotoxy): Likewise.
(grub_cls): Likewise.
(grub_setcolorstate): Likewise.
(grub_setcolor): Likewise.
(grub_getcolor): Likewise.
(grub_refresh): Likewise.
* lib/mips/relocator.c (JUMP_SIZEOF): Fix incorrect value.
(write_jump): Add hatch nop.
* lib/mips/relocator_asm.S: Use kern/mips/cache_flush.S.
* lib/mips/setjmp.S: New file.
* loader/mips/linux.c: Likewise.
* term/i386/pc/at_keyboard.c: Move from here ...
* term/at_keyboard.c: ... to here.
* term/i386/pc/serial.c: Moved from here ...
* term/serial.c: ... to here. All users updated.
(TEXT_HEIGHT): Set to 24 to fit linux terminal.
(serial_hw_io_addr): Use GRUB_MACHINE_SERIAL_PORTS.
(serial_translate_key_sequence): Avoid deadlock.
(grub_serial_getkey): Handle backspace.
(grub_serial_putchar): Fix newline handling.
* util/i386/pc/grub-mkimage.c: Move from here ...
* util/grub-mkrawimage.c: ... to here. All users updated.
(generate_image): New parameters 'font_path' and 'format'.
Support embedding font.
Use grub_host_to_target* instead of grub_cpu_to_le*.
(generate_image) [GRUB_MACHINE_MIPS]: Support ELF encapsulation.
(options) [GRUB_PLATFORM_IMAGE_DEFAULT]: New option "--format".
(options): New option "--font".
(usage): Likewise.
(main) [GRUB_PLATFORM_IMAGE_DEFAULT]: Handle "--format".
(main): Handle "--font".
* term/gfxterm.c (grub_virtual_screen): New member bg_color_display.
(grub_virtual_screen_setup): Set bg_color_display.
(redraw_screen_rect): Use bg_color_display instead of incorrect
bg_color.
(grub_gfxterm_cls): Likewise.
* util/elf/grub-mkimage.c (load_modules): New parameter 'config_path'.
Support embedding config file.
(add_segments): Likewise.
(options): New option "--config".
(main): Handle "--config".
* video/sm712.c: New file.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
Fix parallel builds.
* conf/common.rmk (font/font.c_DEPENDENCIES): New variable (makes
font.c depend on ascii.h).
2010-01-12 Carles Pina i Estany <carles@pina.cat>
* Makefile.in (DUSE_ASCII_FAILBACK): New macro.
2010-01-11 Carles Pina i Estany <carles@pina.cat>
* font/font.c (GENERATE_ASCII): Change the name to USE_ASCII_FAILBACK.
By default: disabled.
* Makefile.in (ascii.h): Remove the non-needed grub/bin2h size
parameter.
2010-01-10 Carles Pina i Estany <carles@pina.cat>
* font/font.c: Update copyright years.
* util/grub-mkfont.c (write_font_ascii_bitmap): Change comment format.
2010-01-10 Carles Pina i Estany <carles@pina.cat>
* font/font.c: Include `ascii.h'.
(ASCII_BITMAP_SIZE): New macro.
(ascii_font_glyph): Define.
(ascii_glyph_lookup): New function.
(grub_font_get_string_width): Change comment. If glyph not found, use
ascii_glyph_lookup.
(grub_font_get_glyph_with_fallback): If glyph not available returns
ascii_glyph_lookup.
* util/grub-mkfont.c (file_formats): New enum.
(options): Add `ascii-bitmaps' new option.
(usage): Add `asii-bitmaps' new option.
(write_font_ascii_bitmap): New function.
(write_font): Rename to ...
(write_font_p2): ... this. Remove print_glyphs call.
(main): Use file_format. Implement code for ranges if ascii-bitmaps is
used. Call print_glyphs.
* Makefile.in (pkgdata_DATA): Add `ascii.h'.
2010-01-14 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (bin_UTILITIES): Add `grub-bin2h'.
(grub_bin2h_SOURCES): New variable.
* util/bin2h.c: New file.
2010-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* include/multiboot.h: Resynced with spec.
* include/multiboot2.h: Likewise.
* loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap): Handle
GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE and GRUB_MACHINE_MEMORY_NVS.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/term.h (grub_term_register_input,
grub_term_register_output): Check return of terminal init()
routines, and abort if errors are raised.
* commands/terminal.c: Update copyright year.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* commands/terminal.c (grub_cmd_terminal_input)
(grub_cmd_terminal_output): Check return of terminal init()
routines, and abort if errors are raised.
2010-01-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i386/bsd.h: Fix include pathes.
2010-01-18 Vladimir Serbinenko <phcoder@gmail.com>
Add missing *BSD copyright headers.
* include/grub/aout.h: Add BSD licence.
* include/grub/i386/bsd.h: Parts under different licences moved to ...
* include/grub/i386/freebsd_linker.h: ... here,
* include/grub/i386/freebsd_reboot.h: ... here,
* include/grub/i386/netbsd_bootinfo.h: ... here,
* include/grub/i386/netbsd_reboot.h: ... here,
* include/grub/i386/openbsd_bootarg.h: ... here,
* include/grub/i386/openbsd_reboot.h: ... and here. Added appropriate
licence to each file.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* acinclude.m4: Remove `nop' assembly instruction; it's not
implemented by all architectures.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/efi/linux.c (grub_cmd_linux): Stop pretending we're
ELILO. This is no longer necessary.
2010-01-18 BVK Chaitanya <bvk.groups@gmail.com>
Added new tool, grub-scrit-check to verify grub.cfg syntax.
* util/grub-script-check.c: grub-script-check tool.
* conf/common.rmk: Make rules for grub-script-check.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
Fix annoying UI bug in rescue mode. Thanks to Tristan Gingold for
spotting it back in 2008. Shame on me for forgetting he did.
* kern/rescue_reader.c (grub_rescue_run): Skip zero-length lines.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_TEXT): ... this. Update all users.
(GRUB_VIDEO_TYPE_VLFB): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_VESA): ... this. Update all users.
(GRUB_VIDEO_TYPE_EFI): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_SIMPLE): ... this. Update all users.
2010-01-17 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/test.h: Add license header.

View file

@ -236,7 +236,7 @@ else
ifeq ($(enable_grub_mkfont),yes)
pkgdata_DATA += unicode.pf2 ascii.pf2
pkgdata_DATA += unicode.pf2 ascii.pf2 ascii.h
# Arrows and lines are needed to draw the menu, so we always include them
UNICODE_ARROWS=0x2190-0x2193
@ -247,6 +247,14 @@ unicode.pf2: $(FONT_SOURCE) grub-mkfont
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
ascii.h: ascii.bitmaps grub-bin2h
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1
endif
endif

View file

@ -18,7 +18,7 @@ AC_DEFUN(grub_PROG_TARGET_CC,
[AC_MSG_CHECKING([whether target compiler is working])
AC_CACHE_VAL(grub_cv_prog_target_cc,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
asm (".globl start; start: nop");
asm (".globl start; start:");
int main (void);
]], [[]])],
[grub_cv_prog_target_cc=yes],

90
bus/bonito.c Normal file
View file

@ -0,0 +1,90 @@
/* bonito.c - PCI bonito interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/pci.h>
#include <grub/misc.h>
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN];
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] =
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE,
GRUB_MACHINE_PCI_WIN_SIZE};
/* Usage counters. */
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN];
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] =
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR,
GRUB_MACHINE_PCI_WIN3_ADDR};
static inline void
write_bases (void)
{
int i;
grub_uint32_t reg = 0;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
& GRUB_MACHINE_PCI_WIN_MASK)
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
}
volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base, grub_size_t size)
{
int i;
grub_addr_t newbase;
/* First try already used registers. */
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
if (usage_win[i] && base_win[i] <= base
&& base_win[i] + sizes_win[i] > base + size)
{
usage_win[i]++;
return (void *)
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
}
/* Map new register. */
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
if (!usage_win[i] && newbase <= base
&& newbase + sizes_win[i] > base + size)
{
usage_win[i]++;
base_win[i] = newbase;
write_bases ();
return (void *)
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
}
grub_fatal ("Out of PCI windows.");
}
void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
volatile void *mem __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
int i;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
if (usage_win[i] && addr_win[i]
== (((grub_addr_t) mem) & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
{
usage_win[i]--;
return;
}
grub_fatal ("Tried to unmap not mapped region");
}

View file

@ -35,9 +35,9 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
grub_pci_id_t id;
grub_uint32_t hdr;
for (dev.bus = 0; dev.bus < 256; dev.bus++)
for (dev.bus = 0; dev.bus < GRUB_PCI_NUM_BUS; dev.bus++)
{
for (dev.device = 0; dev.device < 32; dev.device++)
for (dev.device = 0; dev.device < GRUB_PCI_NUM_DEVICES; dev.device++)
{
for (dev.function = 0; dev.function < 8; dev.function++)
{

View file

@ -111,11 +111,9 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
{
char *filename;
filename = grub_malloc (grub_strlen (prefix)
+ grub_strlen (p) + 2);
filename = grub_xasprintf ("%s/%s", prefix, p);
if (!filename)
return grub_errno;
grub_sprintf (filename, "%s/%s", prefix, p);
file = grub_file_open (filename);
grub_free (filename);
}

View file

@ -46,12 +46,10 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
char *command_help;
grub_uint32_t *unicode_command_help;
grub_uint32_t *unicode_last_position;
command_help = grub_malloc (grub_strlen (cmd->name) +
sizeof (" ") - 1 +
grub_strlen (summary_translated));
grub_sprintf(command_help, "%s %s", cmd->name, summary_translated);
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
if (!command_help)
return 1;
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
&unicode_last_position);

View file

@ -1,7 +1,7 @@
/* loadenv.c - command to load/save environment variable. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -196,7 +196,7 @@ free_blocklists (struct blocklist *p)
}
}
static int
static grub_err_t
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
grub_file_t file)
{
@ -219,8 +219,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
{
/* This might be actually valid, but it is unbelievable that
any filesystem makes such a silly allocation. */
grub_error (GRUB_ERR_BAD_FS, "malformed file");
return 0;
return grub_error (GRUB_ERR_BAD_FS, "malformed file");
}
}
@ -230,8 +229,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
if (total_length != grub_file_size (file))
{
/* Maybe sparse, unallocated sectors. No way in GRUB. */
grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
return 0;
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
}
/* One more sanity check. Re-read all sectors by blocklists, and compare
@ -249,16 +247,13 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
if (grub_disk_read (disk, p->sector - part_start,
p->offset, p->length, blockbuf))
return 0;
return grub_errno;
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
{
grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
return 0;
}
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
}
return 1;
return GRUB_ERR_NONE;
}
static int
@ -347,7 +342,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
if (! envblk)
goto fail;
if (! check_blocklists (envblk, head, file))
if (check_blocklists (envblk, head, file))
goto fail;
while (argc)

View file

@ -87,7 +87,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
int print_files_long (const char *filename,
const struct grub_dirhook_info *info)
{
char pathname[grub_strlen (dirname) + grub_strlen (filename) + 1];
char *pathname;
if ((! all) && (filename[0] == '.'))
return 0;
@ -97,9 +97,12 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
grub_file_t file;
if (dirname[grub_strlen (dirname) - 1] == '/')
grub_sprintf (pathname, "%s%s", dirname, filename);
pathname = grub_xasprintf ("%s%s", dirname, filename);
else
grub_sprintf (pathname, "%s/%s", dirname, filename);
pathname = grub_xasprintf ("%s/%s", dirname, filename);
if (!pathname)
return 1;
/* XXX: For ext2fs symlinks are detected as files while they
should be reported as directories. */
@ -131,8 +134,9 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
grub_uint32_t whole, fraction;
whole = grub_divmod64 (fsize, 100, &fraction);
grub_sprintf (buf, "%u.%02u%c", whole, fraction,
grub_human_sizes[units]);
grub_snprintf (buf, sizeof (buf),
"%u.%02u%c", whole, fraction,
grub_human_sizes[units]);
grub_printf ("%-12s", buf);
}
else

View file

@ -62,7 +62,7 @@ grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
if (cmd->state[0].set)
{
grub_sprintf (buf, "%x", value);
grub_snprintf (buf, sizeof (buf), "%x", value);
grub_env_set (cmd->state[0].arg, buf);
}
else

View file

@ -183,12 +183,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
{
char *filename;
filename = grub_malloc (grub_strlen (prefix) + sizeof ("/parttool.lst"));
filename = grub_xasprintf ("%s/parttool.lst", prefix);
if (filename)
{
grub_file_t file;
grub_sprintf (filename, "%s/parttool.lst", prefix);
file = grub_file_open (filename);
if (file)
{

View file

@ -33,7 +33,6 @@ void
FUNC_NAME (const char *key, const char *var, int no_floppy)
{
int count = 0;
char *buf = NULL;
grub_fs_autoload_hook_t saved_autoload;
auto int iterate_device (const char *name);
@ -48,24 +47,20 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
#ifdef DO_SEARCH_FILE
{
grub_size_t len;
char *p;
char *buf;
grub_file_t file;
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
p = grub_realloc (buf, len);
if (! p)
buf = grub_xasprintf ("(%s)%s", name, key);
if (! buf)
return 1;
buf = p;
grub_sprintf (buf, "(%s)%s", name, key);
file = grub_file_open (buf);
if (file)
{
found = 1;
grub_file_close (file);
}
grub_free (buf);
}
#else
{
@ -135,8 +130,6 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
else
grub_device_iterate (iterate_device);
grub_free (buf);
if (grub_errno == GRUB_ERR_NONE && count == 0)
grub_error (GRUB_ERR_FILE_NOT_FOUND, "no such device: %s", key);
}

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
* Copyright (C) 2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -112,10 +112,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
@ -152,10 +153,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
@ -269,10 +271,11 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
@ -310,10 +313,11 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}

View file

@ -61,7 +61,7 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
GRUB_MD_MD5->final (&ctx);
xnu_uuid = GRUB_MD_MD5->read (&ctx);
grub_sprintf (uuid_string,
grub_snprintf (uuid_string, sizeof (uuid_string),
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
(unsigned int) xnu_uuid[2], (unsigned int) xnu_uuid[3],

View file

@ -88,11 +88,35 @@ endif
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
bin_UTILITIES += grub-bin2h
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
# For grub-script-check.
bin_UTILITIES += grub-script-check
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
grub_script_check_SOURCES = gnulib/progname.c util/grub-script-check.c util/misc.c \
script/main.c script/script.c script/function.c script/lexer.c \
kern/handler.c kern/err.c kern/parser.c kern/list.c \
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c
# For the parser.
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
# For grub-script-check.
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_script_check_init.lst
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_script_check_init.h
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_script_check_init.c
# For grub-probe.
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
@ -576,7 +600,7 @@ sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Common Video Subsystem specific modules.
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \
png.mod font.mod gfxterm.mod video_fb.mod
png.mod gfxterm.mod video_fb.mod
# For video.mod.
video_mod_SOURCES = video/video.c
@ -613,7 +637,8 @@ png_mod_SOURCES = video/readers/png.c
png_mod_CFLAGS = $(COMMON_CFLAGS)
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For font.mod.
pkglib_MODULES += font.mod
font/font.c_DEPENDENCIES = ascii.h
font_mod_SOURCES = font/font_cmd.c font/font.c
font_mod_CFLAGS = $(COMMON_CFLAGS)
font_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -53,9 +53,11 @@ boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LI
boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
pkglib_IMAGES += kernel.img
kernel_img_SOURCES = kern/i386/qemu/startup.S \
@ -136,7 +138,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -173,7 +175,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/i386/datetime.c
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -30,13 +30,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
pkglib_PROGRAMS = kernel.img
pkglib_MODULES = chain.mod appleldr.mod \
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_RELOCATABLE = yes
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/term.c \

View file

@ -92,7 +92,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -122,7 +122,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/i386/datetime.c
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -84,10 +84,10 @@ bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup
# For grub-mkimage.
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
# For grub-setup.
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
@ -197,7 +197,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -293,7 +293,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/i386/datetime.c
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -6,7 +6,7 @@ cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += at_keyboard.mod
at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c
at_keyboard_mod_SOURCES = term/at_keyboard.c
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)

23
conf/mips-qemu-mips.rmk Normal file
View file

@ -0,0 +1,23 @@
# -*- makefile -*-
LINK_BASE = 0x80010000
target_machine=qemu-mips
COMMON_CFLAGS += -march=mips3
COMMON_ASFLAGS += -march=mips3
include $(srcdir)/conf/mips.mk
pkglib_IMAGES = kernel.img
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
kern/$(target_cpu)/$(target_machine)/init.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
symlist.c kern/$(target_cpu)/cache.S
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_FORMAT = binary

79
conf/mips-yeeloong.rmk Normal file
View file

@ -0,0 +1,79 @@
# -*- makefile -*-
LINK_BASE = 0x80200000
target_machine=yeeloong
COMMON_CFLAGS += -march=mips3
COMMON_ASFLAGS += -march=mips3
include $(srcdir)/conf/mips.mk
pkglib_IMAGES = kernel.img
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
kern/$(target_cpu)/$(target_machine)/init.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
kern/$(target_cpu)/cache.S \
\
term/at_keyboard.c \
font/font_cmd.c font/font.c io/bufio.c \
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
video/sm712.c bus/pci.c bus/bonito.c \
term/gfxterm.c commands/extcmd.c lib/arg.c \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_FORMAT = binary
# For ata.mod.
pkglib_MODULES += ata.mod
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
pkglib_MODULES += lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ata_pthru.mod.
pkglib_MODULES += ata_pthru.mod
ata_pthru_mod_SOURCES = disk/ata_pthru.c
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For mmap.mod.
pkglib_MODULES += mmap.mod
mmap_mod_SOURCES = mmap/mmap.c mmap/mips/yeeloong/uppermem.c
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For datetime.mod
pkglib_MODULES += datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
pkglib_MODULES += date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
pkglib_MODULES += datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in

82
conf/mips.rmk Normal file
View file

@ -0,0 +1,82 @@
# -*- makefile -*-
COMMON_ASFLAGS += -nostdinc
COMMON_CFLAGS += -ffreestanding -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
COMMON_LDFLAGS += -nostdlib
# Used by various components. These rules need to precede them.
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
symbol.h term.h time.h types.h loader.h partition.h \
msdos_partition.h machine/kernel.h handler.h list.h \
command.h machine/memory.h cpu/libgcc.h cpu/cache.h i18n.h
ifeq ($(platform), yeeloong)
kernel_img_HEADERS += pci.h
endif
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Scripts.
sbin_SCRIPTS =
bin_SCRIPTS =
# For grub-mkimage.
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
# Modules.
pkglib_MODULES = memdisk.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
pkglib_MODULES += serial.mod
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For relocator.mod.
pkglib_MODULES += relocator.mod
relocator_mod_SOURCES = lib/$(target_cpu)/relocator.c lib/$(target_cpu)/relocator_asm.S
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += linux.mod
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk

View file

@ -29,13 +29,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
pkglib_PROGRAMS = kernel.img
pkglib_MODULES = chain.mod appleldr.mod \
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_RELOCATABLE = yes
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \

View file

@ -52,6 +52,16 @@ fi
case "$target_cpu" in
i[[3456]]86) target_cpu=i386 ;;
sparc) target_cpu=sparc64 ;;
mipsel|mips64el)
target_cpu=mips;
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
;;
mips|mips64)
target_cpu=mips;
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
;;
esac
# Specify the platform (such as firmware).
@ -69,6 +79,7 @@ if test "x$with_platform" = x; then
powerpc-*) platform=ieee1275 ;;
powerpc64-*) platform=ieee1275 ;;
sparc64-*) platform=ieee1275 ;;
mips-*) platform=yeeloong ;;
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
esac
else
@ -95,6 +106,8 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mips-qemu-mips) ;;
mips-yeeloong) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
@ -125,6 +138,8 @@ case "$platform" in
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"

View file

@ -26,8 +26,8 @@
#include <grub/scsi.h>
/* At the moment, only two IDE ports are supported. */
static const int grub_ata_ioaddress[] = { 0x1f0, 0x170 };
static const int grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
static const grub_port_t grub_ata_ioaddress[] = { 0x1f0, 0x170 };
static const grub_port_t grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
static struct grub_ata_device *grub_ata_devices;
@ -347,8 +347,8 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
/* Setup the device information. */
dev->port = port;
dev->device = device;
dev->ioaddress = addr;
dev->ioaddress2 = addr2;
dev->ioaddress = addr + GRUB_MACHINE_PCI_IO_BASE;
dev->ioaddress2 = addr2 + GRUB_MACHINE_PCI_IO_BASE;
dev->next = NULL;
grub_ata_regset (dev, GRUB_ATA_REG_DISK, dev->device << 4);
@ -389,7 +389,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
static int NESTED_FUNC_ATTR
grub_ata_pciinit (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused)))
grub_pci_id_t pciid)
{
static int compat_use[2] = { 0 };
grub_pci_address_t addr;
@ -400,19 +400,34 @@ grub_ata_pciinit (grub_pci_device_t dev,
int regb;
int i;
static int controller = 0;
int cs5536 = 0;
int nports = 2;
/* Read class. */
addr = grub_pci_make_address (dev, 2);
class = grub_pci_read (addr);
/* AMD CS5536 Southbridge. */
if (pciid == 0x208f1022)
{
cs5536 = 1;
nports = 1;
}
/* Check if this class ID matches that of a PCI IDE Controller. */
if (class >> 16 != 0x0101)
if (!cs5536 && (class >> 16 != 0x0101))
return 0;
for (i = 0; i < 2; i++)
for (i = 0; i < nports; i++)
{
/* Set to 0 when the channel operated in compatibility mode. */
int compat = (class >> (8 + 2 * i)) & 1;
int compat;
/* We don't support non-compatibility mode for CS5536. */
if (cs5536)
compat = 0;
else
compat = (class >> (8 + 2 * i)) & 1;
rega = 0;
regb = 0;
@ -485,7 +500,6 @@ grub_ata_initialize (void)
return 0;
}
static void
grub_ata_setlba (struct grub_ata_device *dev, grub_disk_addr_t sector,
grub_size_t size)
@ -648,12 +662,14 @@ grub_ata_iterate (int (*hook) (const char *name))
for (dev = grub_ata_devices; dev; dev = dev->next)
{
char devname[5];
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
char devname[10];
if (dev->atapi)
continue;
grub_snprintf (devname, sizeof (devname),
"ata%d", dev->port * 2 + dev->device);
if (hook (devname))
return 1;
}
@ -668,8 +684,9 @@ grub_ata_open (const char *name, grub_disk_t disk)
for (dev = grub_ata_devices; dev; dev = dev->next)
{
char devname[5];
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
char devname[10];
grub_snprintf (devname, sizeof (devname),
"ata%d", dev->port * 2 + dev->device);
if (grub_strcmp (name, devname) == 0)
break;
}
@ -735,8 +752,9 @@ grub_atapi_iterate (int (*hook) (const char *name, int luns))
for (dev = grub_ata_devices; dev; dev = dev->next)
{
char devname[7];
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
char devname[10];
grub_snprintf (devname, sizeof (devname),
"ata%d", dev->port * 2 + dev->device);
if (! dev->atapi)
continue;
@ -808,8 +826,9 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
for (dev = grub_ata_devices; dev; dev = dev->next)
{
char devname[7];
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
char devname[10];
grub_snprintf (devname, sizeof (devname),
"ata%d", dev->port * 2 + dev->device);
if (!grub_strcmp (devname, name))
{

View file

@ -440,7 +440,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
for (d = fd_devices, count = 0; d; d = d->next, count++)
{
grub_sprintf (buf, "fd%d", count);
grub_snprintf (buf, sizeof (buf), "fd%d", count);
grub_dprintf ("efidisk", "iterating %s\n", buf);
if (hook (buf))
return 1;
@ -448,7 +448,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
for (d = hd_devices, count = 0; d; d = d->next, count++)
{
grub_sprintf (buf, "hd%d", count);
grub_snprintf (buf, sizeof (buf), "hd%d", count);
grub_dprintf ("efidisk", "iterating %s\n", buf);
if (hook (buf))
return 1;
@ -456,7 +456,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
for (d = cd_devices, count = 0; d; d = d->next, count++)
{
grub_sprintf (buf, "cd%d", count);
grub_snprintf (buf, sizeof (buf), "cd%d", count);
grub_dprintf ("efidisk", "iterating %s\n", buf);
if (hook (buf))
return 1;
@ -805,18 +805,10 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
return 0;
}
device_name = grub_malloc (grub_strlen (parent->name) + 1
+ grub_strlen (partition_name) + 1);
if (! device_name)
{
grub_free (partition_name);
grub_disk_close (parent);
return 0;
}
grub_sprintf (device_name, "%s,%s", parent->name, partition_name);
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
grub_free (partition_name);
grub_disk_close (parent);
return device_name;
}
else

View file

@ -56,7 +56,8 @@ grub_biosdisk_call_hook (int (*hook) (const char *name), int drive)
{
char name[10];
grub_sprintf (name, (drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
grub_snprintf (name, sizeof (name),
(drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
return hook (name);
}

View file

@ -556,7 +556,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
}
}
array->name = grub_malloc (13);
array->name = grub_xasprintf ("md%d", array->number);
if (! array->name)
{
grub_free (array->uuid);
@ -565,8 +565,6 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
return grub_errno;
}
grub_sprintf (array->name, "md%d", array->number);
grub_dprintf ("raid", "Found array %s (%s)\n", array->name,
scanner_name);

View file

@ -197,7 +197,6 @@ grub_scsi_iterate (int (*hook) (const char *name))
int scsi_iterate (const char *name, int luns)
{
char sname[40];
int i;
/* In case of a single LUN, just return `usbX'. */
@ -208,9 +207,13 @@ grub_scsi_iterate (int (*hook) (const char *name))
distinguish it. */
for (i = 0; i < luns; i++)
{
grub_sprintf (sname, "%s%c", name, 'a' + i);
char *sname;
sname = grub_xasprintf ("%s%c", name, 'a' + i);
if (!sname)
return 1;
if (hook (sname))
return 1;
grub_free (sname);
}
return 0;
}

View file

@ -200,11 +200,15 @@ grub_usbms_iterate (int (*hook) (const char *name, int luns))
for (p = grub_usbms_dev_list; p; p = p->next)
{
char devname[20];
grub_sprintf (devname, "usb%d", cnt);
char *devname;
devname = grub_xasprintf ("usb%d", cnt);
if (hook (devname, p->luns))
return 1;
{
grub_free (devname);
return 1;
}
grub_free (devname);
cnt++;
}

View file

@ -255,12 +255,11 @@ grub_efiemu_autocore (void)
suffix = grub_efiemu_get_default_core_name ();
filename = grub_malloc (grub_strlen (prefix) + grub_strlen (suffix) + 2);
filename = grub_xasprintf ("%s/%s", prefix, suffix);
if (! filename)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"couldn't allocate temporary space");
grub_sprintf (filename, "%s/%s", prefix, suffix);
err = grub_efiemu_load_file (filename);
grub_free (filename);

View file

@ -1,7 +1,7 @@
/* font.c - Font API and font file loader. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,6 +27,10 @@
#include <grub/video.h>
#include <grub/bitmap.h>
#ifdef USE_ASCII_FAILBACK
#include "ascii.h"
#endif
#ifndef FONT_DEBUG
#define FONT_DEBUG 0
#endif
@ -43,6 +47,7 @@ struct char_index_entry
#define FONT_WEIGHT_NORMAL 100
#define FONT_WEIGHT_BOLD 200
#define ASCII_BITMAP_SIZE 16
struct grub_font
{
@ -129,6 +134,48 @@ static struct grub_font null_font;
/* Flag to ensure module is initialized only once. */
static grub_uint8_t font_loader_initialized;
#ifdef USE_ASCII_FAILBACK
static struct grub_font_glyph *ascii_font_glyph[0x80];
#endif
static struct grub_font_glyph *
ascii_glyph_lookup (grub_uint32_t code)
{
#ifdef USE_ASCII_FAILBACK
static int ascii_failback_initialized = 0;
if (code >= 0x80)
return unknown_glyph;
if (ascii_failback_initialized == 0)
{
int current;
for (current = 0; current < 0x80; current++)
{
ascii_font_glyph[current] = grub_malloc(sizeof(struct grub_font_glyph)
+ ASCII_BITMAP_SIZE);
ascii_font_glyph[current]->width = 8;
ascii_font_glyph[current]->height = 16;
ascii_font_glyph[current]->offset_x = 0;
ascii_font_glyph[current]->offset_y = -2;
ascii_font_glyph[current]->device_width = 8;
grub_memcpy (ascii_font_glyph[current]->bitmap,
&ascii_bitmaps[(0x7f - current) * ASCII_BITMAP_SIZE],
ASCII_BITMAP_SIZE);
}
ascii_failback_initialized = 1;
}
return ascii_font_glyph[code];
#else
(void) code;
return unknown_glyph;
#endif
}
void
grub_font_loader_init (void)
{
@ -865,15 +912,17 @@ grub_font_get_string_width (grub_font_t font, const char *str)
}
/* Get the glyph for FONT corresponding to the Unicode code point CODE.
Returns a pointer to an glyph indicating there is no glyph available
if CODE does not exist in the font. The glyphs are cached once loaded. */
Returns the ASCII glyph for the code if no other fonts are available.
The glyphs are cached once loaded. */
struct grub_font_glyph *
grub_font_get_glyph (grub_font_t font, grub_uint32_t code)
{
struct grub_font_glyph *glyph;
glyph = grub_font_get_glyph_internal (font, code);
if (glyph == 0)
glyph = unknown_glyph;
{
glyph = ascii_glyph_lookup (code);
}
return glyph;
}
@ -968,8 +1017,8 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
if (best_glyph)
return best_glyph;
else
/* Glyph not available in any font. Return unknown glyph. */
return unknown_glyph;
/* Glyph not available in any font. Return ASCII failback. */
return ascii_glyph_lookup (code);
}

View file

@ -280,8 +280,10 @@ grub_cpio_open (grub_file_t file, const char *name)
/* Compare NAME and FN by hand in order to cope with duplicate
slashes. */
i = 1;
i = 0;
j = 0;
while (name[i] == '/')
i++;
while (1)
{
if (name[i] != fn[j])
@ -290,13 +292,16 @@ grub_cpio_open (grub_file_t file, const char *name)
if (name[i] == '\0')
break;
if (name[i] == '/' && name[i+1] == '/')
while (name[i] == '/' && name[i+1] == '/')
i++;
i++;
j++;
}
if (name[i] != fn[j])
goto no_match;
file->data = data;
file->size = data->size;
grub_free (fn);

View file

@ -875,12 +875,15 @@ grub_ext2_uuid (grub_device_t device, char **uuid)
data = grub_ext2_mount (disk);
if (data)
{
*uuid = grub_malloc (40 + sizeof ('\0'));
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]),
grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7]));
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->sblock.uuid[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]),
grub_be_to_cpu16 (data->sblock.uuid[3]),
grub_be_to_cpu16 (data->sblock.uuid[4]),
grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]),
grub_be_to_cpu16 (data->sblock.uuid[7]));
}
else
*uuid = NULL;

View file

@ -833,9 +833,9 @@ grub_fat_uuid (grub_device_t device, char **uuid)
data = grub_fat_mount (disk);
if (data)
{
*uuid = grub_malloc (sizeof ("xxxx-xxxx"));
grub_sprintf (*uuid, "%04x-%04x", (grub_uint16_t) (data->uuid >> 16),
(grub_uint16_t) data->uuid);
*uuid = grub_xasprintf ("%04x-%04x",
(grub_uint16_t) (data->uuid >> 16),
(grub_uint16_t) data->uuid);
}
else
*uuid = NULL;

View file

@ -1082,10 +1082,9 @@ grub_hfs_uuid (grub_device_t device, char **uuid)
data = grub_hfs_mount (device->disk);
if (data && data->sblock.num_serial != 0)
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial));
*uuid = grub_xasprintf ("%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial));
}
else
*uuid = NULL;

View file

@ -995,10 +995,9 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid)
data = grub_hfsplus_mount (disk);
if (data)
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->volheader.num_serial));
*uuid = grub_xasprintf ("%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->volheader.num_serial));
}
else
*uuid = NULL;

View file

@ -356,7 +356,8 @@ set_mac_env (grub_uint8_t *mac_addr, grub_size_t mac_len)
for (i = 0; i < mac_len; i++)
{
grub_sprintf (ptr, "%02x:", mac_addr[i] & 0xff);
grub_snprintf (ptr, sizeof (buf) - (ptr - buf),
"%02x:", mac_addr[i] & 0xff);
ptr += (sizeof ("XX:") - 1);
}
if (mac_len)
@ -483,8 +484,8 @@ set_ip_env (char *varname, grub_uint32_t ip)
{
char buf[sizeof ("XXX.XXX.XXX.XXX")];
grub_sprintf (buf, "%d.%d.%d.%d", (ip & 0xff),
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
grub_snprintf (buf, sizeof (buf), "%d.%d.%d.%d", (ip & 0xff),
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
grub_env_set (varname, buf);
}
@ -500,15 +501,13 @@ write_ip_env (grub_uint32_t *ip, const char *val)
return 0;
/* Normalize the IP. */
buf = grub_malloc (sizeof ("XXX.XXX.XXX.XXX"));
buf = grub_xasprintf ("%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
if (!buf)
return 0;
*ip = newip;
grub_sprintf (buf, "%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
return buf;
}
@ -544,11 +543,10 @@ grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)),
else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
buf = grub_xasprintf ("%d", size);
if (!buf)
return 0;
grub_sprintf (buf, "%d", size);
grub_pxe_blksize = size;
return buf;
@ -562,12 +560,10 @@ GRUB_MOD_INIT(pxe)
{
char *buf;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
buf = grub_xasprintf ("%d", grub_pxe_blksize);
if (buf)
{
grub_sprintf (buf, "%d", grub_pxe_blksize);
grub_env_set ("net_pxe_blksize", buf);
}
grub_env_set ("net_pxe_blksize", buf);
grub_free (buf);
set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);

View file

@ -840,16 +840,23 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
}
else
{
*uuid = grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh"));
grub_sprintf (*uuid, "%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
data->voldesc.modified.year[0], data->voldesc.modified.year[1],
data->voldesc.modified.year[2], data->voldesc.modified.year[3],
data->voldesc.modified.month[0], data->voldesc.modified.month[1],
data->voldesc.modified.day[0], data->voldesc.modified.day[1],
data->voldesc.modified.hour[0], data->voldesc.modified.hour[1],
data->voldesc.modified.minute[0], data->voldesc.modified.minute[1],
data->voldesc.modified.second[0], data->voldesc.modified.second[1],
data->voldesc.modified.hundredth[0], data->voldesc.modified.hundredth[1]);
*uuid = grub_xasprintf ("%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
data->voldesc.modified.year[0],
data->voldesc.modified.year[1],
data->voldesc.modified.year[2],
data->voldesc.modified.year[3],
data->voldesc.modified.month[0],
data->voldesc.modified.month[1],
data->voldesc.modified.day[0],
data->voldesc.modified.day[1],
data->voldesc.modified.hour[0],
data->voldesc.modified.hour[1],
data->voldesc.modified.minute[0],
data->voldesc.modified.minute[1],
data->voldesc.modified.second[0],
data->voldesc.modified.second[1],
data->voldesc.modified.hundredth[0],
data->voldesc.modified.hundredth[1]);
}
}
else

View file

@ -842,17 +842,16 @@ grub_jfs_uuid (grub_device_t device, char **uuid)
data = grub_jfs_mount (disk);
if (data)
{
*uuid = grub_malloc (40 + sizeof ('\0'));
grub_sprintf (*uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
data->sblock.uuid[0], data->sblock.uuid[1],
data->sblock.uuid[2], data->sblock.uuid[3],
data->sblock.uuid[4], data->sblock.uuid[5],
data->sblock.uuid[6], data->sblock.uuid[7],
data->sblock.uuid[8], data->sblock.uuid[9],
data->sblock.uuid[10], data->sblock.uuid[11],
data->sblock.uuid[12], data->sblock.uuid[13],
data->sblock.uuid[14], data->sblock.uuid[15]);
*uuid = grub_xasprintf ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x",
data->sblock.uuid[0], data->sblock.uuid[1],
data->sblock.uuid[2], data->sblock.uuid[3],
data->sblock.uuid[4], data->sblock.uuid[5],
data->sblock.uuid[6], data->sblock.uuid[7],
data->sblock.uuid[8], data->sblock.uuid[9],
data->sblock.uuid[10], data->sblock.uuid[11],
data->sblock.uuid[12], data->sblock.uuid[13],
data->sblock.uuid[14], data->sblock.uuid[15]);
}
else
*uuid = NULL;

View file

@ -1072,8 +1072,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
data = grub_ntfs_mount (disk);
if (data)
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%016llx", (unsigned long long) data->uuid);
*uuid = grub_xasprintf ("%016llx", (unsigned long long) data->uuid);
}
else
*uuid = NULL;

View file

@ -1335,12 +1335,15 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid)
data = grub_reiserfs_mount (disk);
if (data)
{
*uuid = grub_malloc (sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"));
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->superblock.uuid[0]), grub_be_to_cpu16 (data->superblock.uuid[1]),
grub_be_to_cpu16 (data->superblock.uuid[2]), grub_be_to_cpu16 (data->superblock.uuid[3]),
grub_be_to_cpu16 (data->superblock.uuid[4]), grub_be_to_cpu16 (data->superblock.uuid[5]),
grub_be_to_cpu16 (data->superblock.uuid[6]), grub_be_to_cpu16 (data->superblock.uuid[7]));
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->superblock.uuid[0]),
grub_be_to_cpu16 (data->superblock.uuid[1]),
grub_be_to_cpu16 (data->superblock.uuid[2]),
grub_be_to_cpu16 (data->superblock.uuid[3]),
grub_be_to_cpu16 (data->superblock.uuid[4]),
grub_be_to_cpu16 (data->superblock.uuid[5]),
grub_be_to_cpu16 (data->superblock.uuid[6]),
grub_be_to_cpu16 (data->superblock.uuid[7]));
}
else
*uuid = NULL;

View file

@ -732,12 +732,9 @@ grub_ufs_uuid (grub_device_t device, char **uuid)
data = grub_ufs_mount (disk);
if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0))
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%08x%08x",
(unsigned) grub_le_to_cpu32 (data->sblock.uuidhi),
(unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
}
*uuid = grub_xasprintf ("%08x%08x",
(unsigned) grub_le_to_cpu32 (data->sblock.uuidhi),
(unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
else
*uuid = NULL;

View file

@ -777,12 +777,15 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
data = grub_xfs_mount (disk);
if (data)
{
*uuid = grub_malloc (sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"));
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]),
grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7]));
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
grub_be_to_cpu16 (data->sblock.uuid[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]),
grub_be_to_cpu16 (data->sblock.uuid[3]),
grub_be_to_cpu16 (data->sblock.uuid[4]),
grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]),
grub_be_to_cpu16 (data->sblock.uuid[7]));
}
else
*uuid = NULL;

View file

@ -68,7 +68,7 @@ MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count}
ifneq ($(TARGET_APPLE_CC),1)
#{@name}: #{exe}
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $< $@
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@
else
ifneq (#{exe},kernel.exec)
#{@name}: #{exe} ./grub-macho2img
@ -132,13 +132,11 @@ clean-module-#{@name}.#{@rule_count}:
CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count}
ifneq ($(#{prefix}_EXPORTS),no)
clean-module-#{@name}-symbol.#{@rule_count}:
rm -f #{defsym}
CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count}
DEFSYMFILES += #{defsym}
endif
mostlyclean-module-#{@name}.#{@rule_count}:
rm -f #{deps_str}
@ -170,7 +168,6 @@ endif
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
ifneq ($(#{prefix}_EXPORTS),no)
ifneq ($(TARGET_APPLE_CC),1)
#{defsym}: #{pre_obj}
$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
@ -178,7 +175,6 @@ else
#{defsym}: #{pre_obj}
$(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
endif
endif
#{undsym}: #{pre_obj}
echo '#{mod_name}' > $@
@ -331,8 +327,15 @@ class Program
"CLEANFILES += #{@name} #{objs_str}
MOSTLYCLEANFILES += #{deps_str}
ifeq ($(#{prefix}_RELOCATABLE),yes)
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
$(STRIP) --strip-unneeded -K start -R .note -R .comment $@
else
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
$(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@
endif
" + objs.collect_with_index do |obj, i|
src = sources[i]
@ -344,6 +347,7 @@ MOSTLYCLEANFILES += #{deps_str}
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
-include #{dep}
"

View file

@ -29,7 +29,7 @@ FNR == 1 {
if ($1 in symtab) {
modtab[module] = modtab[module] " " symtab[$1];
}
else {
else if ($1 != "__gnu_local_gp") {
printf "%s in %s is not defined\n", $1, module >"/dev/stderr";
error++;
exit;

View file

@ -286,14 +286,19 @@ grub_gettext_init_ext (const char *lang)
/* Warning: if changing some paths in the below line, change the grub_malloc
contents below. */
grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang);
mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, lang);
if (!mo_file)
return;
fd_mo = grub_mofile_open (mo_file);
/* Will try adding .gz as well. */
if (fd_mo == NULL)
{
grub_sprintf (mo_file, "%s.gz", mo_file);
grub_free (mo_file);
mo_file = grub_xasprintf ("%s.gz", mo_file);
if (!mo_file)
return;
fd_mo = grub_mofile_open (mo_file);
}

View file

@ -76,7 +76,7 @@ grub_read_hook_datetime (struct grub_env_var *var,
return grub_get_weekday_name (&datetime);
}
grub_sprintf (buf, "%d", n);
grub_snprintf (buf, sizeof (buf), "%d", n);
break;
}
}

View file

@ -16,6 +16,38 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)exec.h 8.1 (Berkeley) 6/11/93
* $FreeBSD$
*/
#ifndef GRUB_AOUT_HEADER
#define GRUB_AOUT_HEADER 1

View file

@ -0,0 +1,54 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_AT_KEYBOARD_HEADER
#define GRUB_AT_KEYBOARD_HEADER 1
#define SHIFT_L 0x2a
#define SHIFT_R 0x36
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
#define KEYBOARD_COMMAND_READ 0x20
#define KEYBOARD_COMMAND_WRITE 0x60
#define KEYBOARD_COMMAND_REBOOT 0xfe
#define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275
#define OLPC_UP GRUB_TERM_UP
#define OLPC_DOWN GRUB_TERM_DOWN
#define OLPC_LEFT GRUB_TERM_LEFT
#define OLPC_RIGHT GRUB_TERM_RIGHT
#else
#define OLPC_UP '\0'
#define OLPC_DOWN '\0'
#define OLPC_LEFT '\0'
#define OLPC_RIGHT '\0'
#endif
#endif

View file

@ -98,8 +98,8 @@ struct grub_ata_device
/* IO addresses on which the registers for this device can be
found. */
int ioaddress;
int ioaddress2;
grub_port_t ioaddress;
grub_port_t ioaddress2;
/* Two devices can be connected to a single cable. Use this field
to select device 0 (commonly known as "master") or device 1

72
include/grub/cmos.h Normal file
View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CMOS_H
#define GRUB_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#include <grub/cpu/cmos.h>
#define GRUB_CMOS_INDEX_SECOND 0
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
#define GRUB_CMOS_INDEX_MINUTE 2
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
#define GRUB_CMOS_INDEX_HOUR 4
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
#define GRUB_CMOS_INDEX_MONTH 8
#define GRUB_CMOS_INDEX_YEAR 9
#define GRUB_CMOS_INDEX_STATUS_A 0xA
#define GRUB_CMOS_INDEX_STATUS_B 0xB
#define GRUB_CMOS_INDEX_STATUS_C 0xC
#define GRUB_CMOS_INDEX_STATUS_D 0xD
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
#define GRUB_CMOS_STATUS_B_24HOUR 2
#define GRUB_CMOS_STATUS_B_BINARY 4
static inline grub_uint8_t
grub_bcd_to_num (grub_uint8_t a)
{
return ((a >> 4) * 10 + (a & 0xF));
}
static inline grub_uint8_t
grub_num_to_bcd (grub_uint8_t a)
{
return (((a / 10) << 4) + (a % 10));
}
static inline grub_uint8_t
grub_cmos_read (grub_uint8_t index)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
return grub_inb (GRUB_CMOS_DATA_REG);
}
static inline void
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
#endif /* GRUB_CMOS_H */

View file

@ -116,4 +116,9 @@ grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
grub_err_t grub_arch_dl_check_header (void *ehdr);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#if defined (_mips) && ! defined (GRUB_UTIL)
#define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void);
#endif
#endif /* ! GRUB_DL_H */

View file

@ -46,12 +46,12 @@ grub_elf_t grub_elf_file (grub_file_t);
grub_err_t grub_elf_close (grub_elf_t);
int grub_elf_is_elf32 (grub_elf_t);
grub_size_t grub_elf32_size (grub_elf_t);
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
grub_size_t *);
int grub_elf_is_elf64 (grub_elf_t);
grub_size_t grub_elf64_size (grub_elf_t);
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
grub_size_t *);

View file

@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/video.h>
#include <grub/file.h>
/* Forward declaration of opaque structure grub_font.
Users only pass struct grub_font pointers to the font module functions,

View file

@ -19,40 +19,7 @@
#ifndef GRUB_CPU_AT_KEYBOARD_HEADER
#define GRUB_CPU_AT_KEYBOARD_HEADER 1
#define SHIFT_L 0x2a
#define SHIFT_R 0x36
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
#define KEYBOARD_REG_DATA 0x60
#define KEYBOARD_REG_STATUS 0x64
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
#define KEYBOARD_COMMAND_READ 0x20
#define KEYBOARD_COMMAND_WRITE 0x60
#define KEYBOARD_COMMAND_REBOOT 0xfe
#define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275
#define OLPC_UP GRUB_TERM_UP
#define OLPC_DOWN GRUB_TERM_DOWN
#define OLPC_LEFT GRUB_TERM_LEFT
#define OLPC_RIGHT GRUB_TERM_RIGHT
#else
#define OLPC_UP '\0'
#define OLPC_DOWN '\0'
#define OLPC_LEFT '\0'
#define OLPC_RIGHT '\0'
#endif
#endif

View file

@ -20,6 +20,13 @@
#define GRUB_BSD_CPU_HEADER 1
#include <grub/types.h>
#include <grub/i386/freebsd_reboot.h>
#include <grub/i386/netbsd_reboot.h>
#include <grub/i386/openbsd_reboot.h>
#include <grub/i386/freebsd_linker.h>
#include <grub/i386/netbsd_bootinfo.h>
#include <grub/i386/openbsd_bootarg.h>
enum bsd_kernel_types
{
@ -31,62 +38,15 @@ enum bsd_kernel_types
#define GRUB_BSD_TEMP_BUFFER 0x80000
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#define FREEBSD_B_DEVMAGIC 0xa0000000
#define FREEBSD_B_SLICESHIFT 20
#define FREEBSD_B_UNITSHIFT 16
#define FREEBSD_B_PARTSHIFT 8
#define FREEBSD_B_TYPESHIFT 0
#define FREEBSD_B_DEVMAGIC OPENBSD_B_DEVMAGIC
#define FREEBSD_B_SLICESHIFT OPENBSD_B_CTRLSHIFT
#define FREEBSD_B_UNITSHIFT OPENBSD_B_UNITSHIFT
#define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
#define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
#define FREEBSD_BOOTINFO_VERSION 1
#define FREEBSD_N_BIOS_GEOM 8
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#define FREEBSD_MODTYPE_KERNEL "elf kernel"
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
#define FREEBSD_MODTYPE_ELF_MODULE "elf module"
@ -113,44 +73,6 @@ struct grub_freebsd_bootinfo
grub_uint32_t bi_modulep;
} __attribute__ ((packed));
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bios_mmap
{
grub_uint64_t addr;
@ -162,97 +84,6 @@ struct grub_openbsd_bios_mmap
grub_uint32_t type;
};
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
void *bi_data[1];
};
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_MEMMAP 9
struct grub_netbsd_btinfo_common
{
int len;
int type;
};
struct grub_netbsd_btinfo_mmap_header
{
struct grub_netbsd_btinfo_common common;
grub_uint32_t count;
};
struct grub_netbsd_btinfo_mmap_entry
{
grub_uint64_t addr;
grub_uint64_t len;
#define NETBSD_MMAP_AVAILABLE 1
#define NETBSD_MMAP_RESERVED 2
#define NETBSD_MMAP_ACPI 3
#define NETBSD_MMAP_NVS 4
grub_uint32_t type;
};
struct grub_netbsd_btinfo_bootpath
{
struct grub_netbsd_btinfo_common common;
char bootpath[80];
};
struct grub_netbsd_btinfo_rootdevice
{
struct grub_netbsd_btinfo_common common;
char devname[16];
};
struct grub_netbsd_btinfo_bootdisk
{
struct grub_netbsd_btinfo_common common;
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
void grub_unix_real_boot (grub_addr_t entry, ...)
__attribute__ ((cdecl,noreturn));
grub_err_t grub_freebsd_load_elfmodule32 (grub_file_t file, int argc,

View file

@ -20,55 +20,9 @@
#define GRUB_CPU_CMOS_H 1
#include <grub/types.h>
#include <grub/i386/io.h>
#include <grub/cpu/io.h>
#define GRUB_CMOS_ADDR_REG 0x70
#define GRUB_CMOS_DATA_REG 0x71
#define GRUB_CMOS_INDEX_SECOND 0
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
#define GRUB_CMOS_INDEX_MINUTE 2
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
#define GRUB_CMOS_INDEX_HOUR 4
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
#define GRUB_CMOS_INDEX_MONTH 8
#define GRUB_CMOS_INDEX_YEAR 9
#define GRUB_CMOS_INDEX_STATUS_A 0xA
#define GRUB_CMOS_INDEX_STATUS_B 0xB
#define GRUB_CMOS_INDEX_STATUS_C 0xC
#define GRUB_CMOS_INDEX_STATUS_D 0xD
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
#define GRUB_CMOS_STATUS_B_24HOUR 2
#define GRUB_CMOS_STATUS_B_BINARY 4
static inline grub_uint8_t
grub_bcd_to_num (grub_uint8_t a)
{
return ((a >> 4) * 10 + (a & 0xF));
}
static inline grub_uint8_t
grub_num_to_bcd (grub_uint8_t a)
{
return (((a / 10) << 4) + (a % 10));
}
static inline grub_uint8_t
grub_cmos_read (grub_uint8_t index)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
return grub_inb (GRUB_CMOS_DATA_REG);
}
static inline void
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
#endif /* GRUB_CPU_CMOS_H */

View file

@ -1 +1,24 @@
#include <grub/i386/pc/serial.h>
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
#endif

View file

@ -0,0 +1,74 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: stable/8/sys/sys/linker.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_LINKER_CPU_HEADER
#define GRUB_FREEBSD_LINKER_CPU_HEADER 1
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#endif

View file

@ -0,0 +1,77 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
* $FreeBSD: stable/8/sys/sys/reboot.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_REBOOT_CPU_HEADER
#define GRUB_FREEBSD_REBOOT_CPU_HEADER 1
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#endif

View file

@ -1 +1 @@
#include <grub/i386/pc/serial.h>
#include <grub/i386/coreboot/serial.h>

View file

@ -21,6 +21,8 @@
#ifndef GRUB_IO_H
#define GRUB_IO_H 1
typedef unsigned short int grub_port_t;
static __inline unsigned char
grub_inb (unsigned short int port)
{

View file

@ -79,9 +79,9 @@ struct grub_e820_mmap
grub_uint32_t type;
} __attribute__((packed));
#define GRUB_VIDEO_TYPE_TEXT 0x01
#define GRUB_VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
#define GRUB_VIDEO_TYPE_EFI 0x70
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
#define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
/* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header

View file

@ -0,0 +1,112 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: bootinfo.h,v 1.16 2009/08/24 02:15:46 jmcneill Exp $ */
/*
* Copyright (c) 1997
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRUB_NETBSD_BOOTINFO_CPU_HEADER
#define GRUB_NETBSD_BOOTINFO_CPU_HEADER 1
#include <grub/types.h>
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_MEMMAP 9
struct grub_netbsd_btinfo_common
{
int len;
int type;
};
struct grub_netbsd_btinfo_mmap_header
{
struct grub_netbsd_btinfo_common common;
grub_uint32_t count;
};
struct grub_netbsd_btinfo_mmap_entry
{
grub_uint64_t addr;
grub_uint64_t len;
#define NETBSD_MMAP_AVAILABLE 1
#define NETBSD_MMAP_RESERVED 2
#define NETBSD_MMAP_ACPI 3
#define NETBSD_MMAP_NVS 4
grub_uint32_t type;
};
struct grub_netbsd_btinfo_bootpath
{
struct grub_netbsd_btinfo_common common;
char bootpath[80];
};
struct grub_netbsd_btinfo_rootdevice
{
struct grub_netbsd_btinfo_common common;
char devname[16];
};
struct grub_netbsd_btinfo_bootdisk
{
struct grub_netbsd_btinfo_common common;
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
void *bi_data[1];
};
#endif

View file

@ -0,0 +1,81 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: reboot.h,v 1.25 2007/12/25 18:33:48 perry Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
*/
#ifndef GRUB_NETBSD_REBOOT_CPU_HEADER
#define GRUB_NETBSD_REBOOT_CPU_HEADER 1
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
#endif

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: bootarg.h,v 1.11 2003/06/02 20:20:54 mickey Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GRUB_OPENBSD_BOOTARG_CPU_HEADER
#define GRUB_OPENBSD_BOOTARG_CPU_HEADER 1
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#endif

View file

@ -0,0 +1,79 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: reboot.h,v 1.13 2004/03/10 23:02:53 tom Exp $ */
/* $NetBSD: reboot.h,v 1.9 1996/04/22 01:23:25 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.2 (Berkeley) 7/10/94
*/
#ifndef GRUB_OPENBSD_REBOOT_CPU_HEADER
#define GRUB_OPENBSD_REBOOT_CPU_HEADER 1
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#endif

View file

@ -22,8 +22,11 @@
#include <grub/types.h>
#include <grub/i386/io.h>
#define GRUB_MACHINE_PCI_IO_BASE 0
#define GRUB_PCI_ADDR_REG 0xcf8
#define GRUB_PCI_DATA_REG 0xcfc
#define GRUB_PCI_NUM_BUS 256
#define GRUB_PCI_NUM_DEVICES 32
static inline grub_uint32_t
grub_pci_read (grub_pci_address_t addr)
@ -67,12 +70,12 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
}
static inline void *
static inline volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
grub_size_t size __attribute__ ((unused)))
{
return (void *) base;
return (volatile void *) base;
}
static inline void

View file

@ -26,7 +26,8 @@ enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG
OBJ_TYPE_CONFIG,
OBJ_TYPE_FONT
};
/* The module header. */

View file

@ -0,0 +1 @@
#include <grub/machine/at_keyboard.h>

27
include/grub/mips/cache.h Normal file
View file

@ -0,0 +1,27 @@
/* cache.h - Flush the processor's cache. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CPU_CACHE_H
#define GRUB_CPU_CACHE_H 1
#include <grub/symbol.h>
#include <grub/types.h>
void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type);
#endif

1
include/grub/mips/cmos.h Normal file
View file

@ -0,0 +1 @@
#include <grub/machine/cmos.h>

62
include/grub/mips/io.h Normal file
View file

@ -0,0 +1,62 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_IO_H
#define GRUB_IO_H 1
#include <grub/types.h>
typedef grub_addr_t grub_port_t;
static __inline unsigned char
grub_inb (grub_port_t port)
{
return *(volatile grub_uint8_t *) port;
}
static __inline unsigned short int
grub_inw (grub_port_t port)
{
return *(volatile grub_uint16_t *) port;
}
static __inline unsigned int
grub_inl (grub_port_t port)
{
return *(volatile grub_uint32_t *) port;
}
static __inline void
grub_outb (unsigned char value, grub_port_t port)
{
*(volatile grub_uint8_t *) port = value;
}
static __inline void
grub_outw (unsigned short int value, grub_port_t port)
{
*(volatile grub_uint16_t *) port = value;
}
static __inline void
grub_outl (unsigned int value, grub_port_t port)
{
*(volatile grub_uint32_t *) port = value;
}
#endif /* _SYS_IO_H */

View file

@ -0,0 +1,65 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#define GRUB_MOD_ALIGN 0x1
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_MACHINE_LINK_ALIGN 32
#define GRUB_KERNEL_CPU_RAW_SIZE 0x200
#define GRUB_KERNEL_CPU_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE 0xc
#define GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE 0x10
#define GRUB_KERNEL_CPU_PREFIX GRUB_KERNEL_CPU_RAW_SIZE
#define GRUB_KERNEL_CPU_DATA_END GRUB_KERNEL_CPU_RAW_SIZE + 0x48
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_KERNEL_CPU_RAW_SIZE
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_KERNEL_CPU_PREFIX
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_KERNEL_CPU_DATA_END
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_KERNEL_CPU_COMPRESSED_SIZE
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, elf"
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
#ifndef ASM_FILE
typedef enum {
GRUB_PLATFORM_IMAGE_RAW,
GRUB_PLATFORM_IMAGE_ELF
}
grub_platform_image_format_t;
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
#define GRUB_PLATFORM_IMAGE_ELF GRUB_PLATFORM_IMAGE_ELF
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif

View file

@ -0,0 +1,38 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
#ifdef HAVE___BSWAPSI2
void EXPORT_FUNC (__bswapsi2) (void);
#endif
#ifdef HAVE___BSWAPDI2
void EXPORT_FUNC (__bswapdi2) (void);
#endif

1
include/grub/mips/pci.h Normal file
View file

@ -0,0 +1 @@
#include <grub/machine/pci.h>

View file

View file

@ -0,0 +1,36 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

View file

@ -0,0 +1,54 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x80f00000
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif
#endif

View file

@ -0,0 +1,24 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0x140003f8 }
#endif

View file

@ -0,0 +1,34 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KERNEL_MACHINE_TIME_HEADER
#define KERNEL_MACHINE_TIME_HEADER 1
#include <grub/symbol.h>
#define GRUB_TICKS_PER_SECOND 1000
/* Return the real time in ticks. */
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
static inline void
grub_cpu_idle(void)
{
}
#endif /* ! KERNEL_MACHINE_TIME_HEADER */

View file

@ -0,0 +1,39 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_RELOCATOR_CPU_HEADER
#define GRUB_RELOCATOR_CPU_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
struct grub_relocator32_state
{
/* gpr[0] is ignored since it's hardwired to 0. */
grub_uint32_t gpr[32];
/* Register holding target $pc. */
int jumpreg;
};
void *grub_relocator32_alloc (grub_size_t size);
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
struct grub_relocator32_state state);
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
void grub_relocator32_free (void *relocator);
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View file

@ -0,0 +1,27 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2006,2007,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long grub_jmp_buf[11];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice));
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */

0
include/grub/mips/time.h Normal file
View file

38
include/grub/mips/types.h Normal file
View file

@ -0,0 +1,38 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2006,2007,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_TYPES_CPU_HEADER
#define GRUB_TYPES_CPU_HEADER 1
/* The size of void *. */
#define GRUB_TARGET_SIZEOF_VOID_P 4
/* The size of long. */
#define GRUB_TARGET_SIZEOF_LONG 4
#ifdef GRUB_CPU_MIPSEL
/* mipsEL is little-endian. */
#undef GRUB_TARGET_WORDS_BIGENDIAN
#elif defined (GRUB_CPU_MIPS)
/* mips is big-endian. */
#define GRUB_TARGET_WORDS_BIGENDIAN
#elif !defined (GRUB_SYMBOL_GENERATOR)
#error Neither GRUB_CPU_MIPS nor GRUB_CPU_MIPSEL is defined
#endif
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -0,0 +1,25 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_AT_KEYBOARD_HEADER
#define GRUB_MACHINE_AT_KEYBOARD_HEADER 1
#define KEYBOARD_REG_DATA 0xbfd00060
#define KEYBOARD_REG_STATUS 0xbfd00064
#endif

View file

View file

@ -0,0 +1,28 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CPU_CMOS_H
#define GRUB_CPU_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#define GRUB_CMOS_ADDR_REG 0xbfd00070
#define GRUB_CMOS_DATA_REG 0xbfd00071
#endif /* GRUB_CPU_CMOS_H */

View file

@ -0,0 +1,32 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

View file

@ -0,0 +1,68 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_MAX_TYPE 1
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 2
#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MACHINE_MEMORY_HOLE
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
grub_uint64_t grub_mmap_get_lower (void);
grub_uint64_t grub_mmap_get_upper (void);
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);
#endif
#endif

View file

@ -0,0 +1,105 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_PCI_H
#define GRUB_MACHINE_PCI_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#define GRUB_PCI_NUM_BUS 1
#define GRUB_PCI_NUM_DEVICES 16
#define GRUB_MACHINE_PCI_IO_BASE 0xbfd00000
#define GRUB_MACHINE_PCI_CONFSPACE 0xbfe80000
#define GRUB_MACHINE_PCI_CONF_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00118)
#define GRUB_MACHINE_PCI_IO_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00110)
#define GRUB_MACHINE_PCI_WIN_MASK_SIZE 6
#define GRUB_MACHINE_PCI_WIN_MASK ((1 << GRUB_MACHINE_PCI_WIN_MASK_SIZE) - 1)
/* We have 3 PCI windows. */
#define GRUB_MACHINE_PCI_NUM_WIN 3
/* Each window is 64MiB. */
#define GRUB_MACHINE_PCI_WIN_SHIFT 26
#define GRUB_MACHINE_PCI_WIN_OFFSET_MASK ((1 << GRUB_MACHINE_PCI_WIN_SHIFT) - 1)
#define GRUB_MACHINE_PCI_WIN_SIZE 0x04000000
/* Graphical acceleration takes 1 MiB away. */
#define GRUB_MACHINE_PCI_WIN1_SIZE 0x03f00000
#define GRUB_MACHINE_PCI_WIN1_ADDR 0xb0000000
#define GRUB_MACHINE_PCI_WIN2_ADDR 0xb4000000
#define GRUB_MACHINE_PCI_WIN3_ADDR 0xb8000000
static inline grub_uint32_t
grub_pci_read (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline grub_uint16_t
grub_pci_read_word (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline grub_uint8_t
grub_pci_read_byte (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline void
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
static inline void
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
static inline void
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base, grub_size_t size);
void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
volatile void *mem,
grub_size_t size __attribute__ ((unused)));
#endif /* GRUB_MACHINE_PCI_H */

View file

@ -0,0 +1,24 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0xbff003f8 }
#endif

View file

@ -0,0 +1,37 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* 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
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KERNEL_MACHINE_TIME_HEADER
#define KERNEL_MACHINE_TIME_HEADER 1
#include <grub/symbol.h>
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
/* Return the real time in ticks. */
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock);
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
static inline void
grub_cpu_idle(void)
{
}
#endif /* ! KERNEL_MACHINE_TIME_HEADER */

View file

@ -195,8 +195,13 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const char *condition,
const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
va_list args);
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args);
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,

View file

@ -112,7 +112,7 @@ struct grub_script_cmd_menuentry
struct grub_script_arglist *arglist;
/* The sourcecode the entry will be generated from. */
const char *sourcecode;
char *sourcecode;
/* Options. XXX: Not used yet. */
int options;

View file

@ -17,8 +17,8 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_SERIAL_MACHINE_HEADER
#define GRUB_SERIAL_MACHINE_HEADER 1
#ifndef GRUB_SERIAL_HEADER
#define GRUB_SERIAL_HEADER 1
/* Macros. */

Some files were not shown because too many files have changed in this diff Show more