merge ia64-emu into ia64

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-02 23:55:50 +01:00
commit 7edf63fce6
45 changed files with 882 additions and 102 deletions

View File

@ -69,6 +69,7 @@ Makefile
mod-*.c
missing
*.pf2
*.pp
po/*.mo
po/grub.pot
stamp-h
@ -91,7 +92,10 @@ texinfo.tex
grub-core/lib/libgcrypt-grub
**/.deps-util
**/.deps-core
**/.dirstamp
Makefile.util.am
grub-core/Makefile.core.am
grub-core/Makefile.gcry.am
grub-core/Makefile.gcry.def
grub-core/*.module
grub-core/*.pp

118
ChangeLog
View File

@ -1,3 +1,121 @@
2010-09-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/misc.c: Don't add abort alias in utils.
Reported by: echoline.
2010-09-03 BVK Chaitanya <bvk.groups@gmail.com>
Add missing files into "make dist" tarball for other platforms.
* gentpl.py (script): Use dist_noinst_DATA instead of EXTRA_DIST.
* conf/Makefile.common (dist_noinst_DATA): New variable.
* conf/Makefile.extra-dist: Added missing make dist files.
* grub-core/Makefile.core.def: Likewise.
2010-09-03 Vladimir Serbinenko <phcoder@gmail.com>
Compress grub_prefix.
* grub-core/boot/i386/pc/lnxboot.S: Use
GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE.
* grub-core/kern/i386/pc/startup.S: Move grub_prefix to compressed part.
* include/grub/offsets.h: Rename GRUB_MACHINE_DATA_END to
GRUB_MACHINE_PREFIX_END. All users updated.
(GRUB_KERNEL_I386_PC_PREFIX): Set to GRUB_KERNEL_I386_PC_RAW_SIZE.
(GRUB_KERNEL_I386_PC_PREFIX_END): Set to GRUB_KERNEL_I386_PC_PREFIX
+ 0x40.
(GRUB_KERNEL_I386_PC_RAW_SIZE): Decrease.
* util/grub-mkimage.c (image_target_desc): Change data_end to
prefix_end. All users updated.
2010-09-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/bsd.c (grub_freebsd_boot): Set %ebp to sane
value.
(grub_openbsd_boot): Likewise.
(grub_netbsd_boot): Likewise.
* grub-core/loader/i386/xnu.c (grub_xnu_boot_resume): Likewise.
(grub_xnu_boot): Likewise.
2010-09-02 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Clean LIBS variable after tests.
2010-09-02 Colin Watson <cjwatson@ubuntu.com>
* INSTALL: Document that libdevmapper needs to be 1.02.34 or later.
2010-09-02 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Check for dm_log_with_errno_init in libdevmapper and
echo if libdevmapper will be used.
2010-09-02 Ian Turner <Ian.Turner@deshaw.com>
* grub-core/fs/i386/pc/pxe.c (grub_pxefs_read): Keep the blocksize
constant for the same file.
2010-09-02 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/i386/multiboot_mmap.c: Remove leftover include.
2010-09-02 Colin Watson <cjwatson@ubuntu.com>
* .bzrignore: Add *.pp, **/.dirstamp, grub-core/*.module, and
grub-core/*.pp.
2010-09-02 Colin Watson <cjwatson@ubuntu.com>
Zero %ebp and %edi when entering Linux's 32-bit entry point, as
required by the boot protocol.
* include/grub/i386/relocator.h (struct grub_relocator32_state): Add
ebp and edi members.
* grub-core/lib/i386/relocator.c (grub_relocator_boot): Handle
state.ebp and state.edi.
* grub-core/lib/i386/relocator32.S (grub_relocator32_start): Set
%ebp and %edi according to grub_relocator32_ebp and
grub_relocator32_edi respectively.
* grub-core/loader/i386/linux.c (grub_linux_boot): Zero state.ebp
and state.edi.
2010-09-02 Vladimir Serbinenko <phcoder@gmail.com>
Add i386-pc-pxe image target.
* util/grub-mkimage.c (image_target_desc): New enum value
IMAGE_I386_PC_PXE.
(image_targets): New target i386-pc-pxe.
(generate_image): Handle i386-pc-pxe image.
2010-09-02 Vladimir Serbinenko <phcoder@gmail.com>
Fix grub_pxe_scan.
* grub-core/fs/i386/pc/pxe.c (grub_pxe_pxenv): Put correct type bangpxe.
(grub_pxe_scan): Fix types and pxe_rm_entry computation.
All users updated.
* include/grub/i386/pc/pxe.h (grub_pxe_bangpxe): New struct.
(grub_pxe_pxenv): Correct type.
2010-09-01 Colin Watson <cjwatson@ubuntu.com>
* NEWS: Document most of the important changes since 1.98.
2010-09-01 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.in (usage): Tidy up usage output (and hence
generated manual page) a little.
2010-09-01 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi: Add myself as an author.
2010-09-01 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.util.def (libgrub.a): Add missing sunpc.
Reported by: Seth Goldberg.
2010-08-30 Vladimir Serbinenko <phcoder@gmail.com>
Interrupt wrapping and code simplifications.

6
ChangeLog.ia64-emu Normal file
View File

@ -0,0 +1,6 @@
2008-01-28 Tristan Gingold <gingold@free.fr>
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* grub-core/lib/ia64/setjmp.S: New file (from glibc).
* grub-core/lib/ia64/longjmp.S: New file (from glibc).
* grub-core/lib/setjmp.S [__ia64__]: include ia64/setjmp.S.

View File

@ -21,7 +21,7 @@ configuring the GRUB.
On GNU/Linux, you also need:
* libdevmapper (recommended)
* libdevmapper 1.02.34 or later (recommended)
To build grub-emu, you need:

View File

@ -88,6 +88,7 @@ library = {
common = grub-core/partmap/gpt.c;
common = grub-core/partmap/msdos.c;
common = grub-core/partmap/sun.c;
common = grub-core/partmap/sunpc.c;
common = grub-core/script/function.c;
common = grub-core/script/lexer.c;
common = grub-core/script/main.c;

89
NEWS
View File

@ -1,9 +1,98 @@
New in 1.99:
* New relocator. Allows for more kernel support and more
straightforward loader writing.
* Handle USB pendrives exposed as floppies.
* New Automake-based build system.
* Add `sendkey' command (i386-pc only).
* ZFS support in `grub-install' and `grub-mkconfig'. Note: complete
functionality requires external ZFS implementation (available from
grub-extras).
* Support 1.x versions of mdadm metadata.
* Fix corruption when reading Reiserfs directory entries.
* Bidirectional text and diacritics support.
* Skip LVM snapshots.
* MIPS Yeeloong firmware port.
* Change grub-mkdevicemap to emit /dev/disk/by-id/ names where possible
on GNU/Linux.
* Add `grub-mkconfig' support for Xen with Linux.
* Add `grub-mkconfig' support for initrd images on Fedora 13.
* Support >3GiB and <16MiB RAM in i386-qemu.
* Add support for Cirrus 5446 and Bochs video cards.
* Load more appropriate video drivers automatically in `grub-mkconfig'.
* USB improvements, including hotplugging/hotunplugging, hub support,
and USB serial support.
* AMD Geode CS5536 support.
* Extensive updates to the Texinfo documentation.
* Add `grub-probe' support for the btrfs filesystem, permitting / to
reside on btrfs as long as /boot is on a filesystem natively supported
by GRUB.
* Handle symbolic links under /dev/mapper on GNU/Linux.
* Handle installation across multiple partition table types.
* Add `cmostest' command (i386/x86_64 only).
* Add support for DM-RAID disk devices on GNU/Linux.
* Remove `grub-mkisofs'. `grub-mkrescue' now uses GNU xorriso to build
CD images.
* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms.
* Unify `grub-mkimage' source code across platforms.
* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver.
* Add menu hotkey support.
* Add support for the nilfs2 filesystem.
* `grub-probe' and `grub-mkconfig' support for NetBSD.
* Support setting a background image in `grub-mkconfig'.
* Support multiple terminals in `grub-mkconfig'.
* Regexp support.
* MIPS multiboot2 support.
* Multiboot2 tag support.
* sunpc partition table support.
* Add a number of new language features to GRUB script: `for', `while',
`until', `elif', function parameters, `break', `continue', and
`shift'.
* Support nested partition tables. GRUB now prefers to name partitions
in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'.
* Speed up consecutive hostdisk operations on the same device.
* Compile parts of `grub-emu' as modules.
New in 1.98 - 2010-03-06:
* Multiboot on EFI support.

View File

@ -115,6 +115,7 @@ pkglib_SCRIPTS =
noinst_PROGRAMS =
grubconf_SCRIPTS =
noinst_LIBRARIES =
dist_noinst_DATA =
TESTS =
EXTRA_DIST =

View File

@ -5,6 +5,11 @@ EXTRA_DIST += gentpl.py
EXTRA_DIST += Makefile.tpl
EXTRA_DIST += Makefile.util.def
EXTRA_DIST += unicode
EXTRA_DIST += util/import_gcry.py
EXTRA_DIST += util/import_unicode.py
EXTRA_DIST += docs/man
EXTRA_DIST += docs/grub.cfg
@ -26,8 +31,8 @@ EXTRA_DIST += grub-core/genterminallist.sh
EXTRA_DIST += grub-core/genparttoollist.sh
EXTRA_DIST += grub-core/genemuinitheader.sh
EXTRA_DIST += grub-core/lib/libgcrypt/cipher
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/efiemu -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib/posix_wrap -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib/libgcrypt_wrap -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')

View File

@ -544,7 +544,7 @@ CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
fi
# Check for libgcc symbols
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3)
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib"
@ -824,12 +824,23 @@ fi
if test x"$device_mapper_excuse" = x ; then
# Check for device-mapper library.
AC_CHECK_LIB([devmapper], [dm_task_create],
[LIBDEVMAPPER="-ldevmapper"
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
[Define to 1 if you have the devmapper library.])],
AC_CHECK_LIB([devmapper], [dm_task_create], [],
[device_mapper_excuse="need devmapper library"])
fi
if test x"$device_mapper_excuse" = x ; then
# Check for device-mapper library.
AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
[],
[device_mapper_excuse="need devmapper library"])
fi
if test x"$device_mapper_excuse" = x ; then
LIBDEVMAPPER="-ldevmapper";
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
[Define to 1 if you have the devmapper library.])
fi
AC_SUBST([LIBDEVMAPPER])
AC_CHECK_LIB([zfs], [libzfs_init],
@ -844,6 +855,8 @@ AC_CHECK_LIB([nvpair], [nvlist_print],
[Define to 1 if you have the NVPAIR library.])],)
AC_SUBST([LIBNVPAIR])
LIBS=""
pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
AC_SUBST(pkglibrootdir)
@ -945,6 +958,11 @@ else
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
fi
fi
if test x"$device_mapper_excuse" = x ; then
echo With devmapper support: Yes
else
echo With devmapper support: No "($device_mapper_excuse)"
fi
if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes
else

View File

@ -46,6 +46,7 @@ Invariant Sections.
@subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}.
@author Gordon Matzigkeit
@author Yoshinori K. Okuji
@author Colin Watson
@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll

View File

@ -478,7 +478,7 @@ chmod a+x [+ name +]
""")
r += gvar_add("CLEANFILES", "[+ name +]")
r += gvar_add("EXTRA_DIST", platform_sources(platform))
r += gvar_add("dist_noinst_DATA", platform_sources(platform))
return r
def module_rules():

View File

@ -74,6 +74,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
if COND_i386_pc
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
@ -140,7 +141,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.h
@ -148,11 +148,9 @@ endif
if COND_powerpc_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
endif
if COND_sparc64_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
endif

View File

@ -148,6 +148,7 @@ kernel = {
mips_yeeloong = term/at_keyboard.c;
mips_yeeloong = term/serial.c;
mips_yeeloong = video/sm712.c;
extra_dist = video/sm712_init.c;
powerpc_ieee1275 = kern/ieee1275/init.c;
powerpc_ieee1275 = kern/powerpc/cache.S;
@ -168,6 +169,7 @@ kernel = {
emu = kern/emu/misc.c;
emu = kern/emu/mm.c;
emu = kern/emu/time.c;
emu = kern/emu/cache.c;
videoinkernel = lib/arg.c;
videoinkernel = term/gfxterm.c;
@ -1058,6 +1060,9 @@ module = {
powerpc = lib/powerpc/relocator_asm.S;
powerpc = lib/powerpc/relocator.c;
extra_dist = lib/i386/relocator_common.S;
extra_dist = kern/powerpc/cache_flush.S;
enable = mips;
enable = powerpc;
enable = x86;

View File

@ -185,7 +185,7 @@ real_code_2:
call LOCAL(move_memory)
/* Check for multiboot signature. */
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE)
jz 1f
movl (ramdisk_image - start), %esi

View File

@ -41,7 +41,7 @@ struct grub_pxe_disk_data
grub_uint32_t gateway_ip;
};
struct grub_pxenv *grub_pxe_pxenv;
struct grub_pxe_bangpxe *grub_pxe_pxenv;
static grub_uint32_t grub_pxe_your_ip;
static grub_uint32_t grub_pxe_default_server_ip;
static grub_uint32_t grub_pxe_default_gateway_ip;
@ -58,41 +58,47 @@ struct grub_pxe_data
static grub_uint32_t pxe_rm_entry = 0;
static struct grub_pxenv *
static struct grub_pxe_bangpxe *
grub_pxe_scan (void)
{
struct grub_bios_int_registers regs;
struct grub_pxenv *ret;
void *pxe;
struct grub_pxenv *pxenv;
struct grub_pxe_bangpxe *bangpxe;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
regs.ebx = 0;
regs.ecx = 0;
regs.eax = 0x5650;
regs.es = 0;
grub_bios_interrupt (0x1a, &regs);
if ((regs.eax & 0xffff) != 0x564e)
return NULL;
ret = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff));
if (grub_memcmp (ret->signature, GRUB_PXE_SIGNATURE, sizeof (ret->signature))
pxenv = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff));
if (grub_memcmp (pxenv->signature, GRUB_PXE_SIGNATURE,
sizeof (pxenv->signature))
!= 0)
return NULL;
if (ret->version < 0x201)
if (pxenv->version < 0x201)
return NULL;
pxe = (void *) ((((ret->pxe_ptr & 0xffff0000) >> 16) << 4)
+ (ret->pxe_ptr & 0xffff));
if (!pxe)
bangpxe = (void *) ((((pxenv->pxe_ptr & 0xffff0000) >> 16) << 4)
+ (pxenv->pxe_ptr & 0xffff));
if (!bangpxe)
return NULL;
/* !PXE */
if (*(grub_uint32_t *) pxe != 0x45585021)
if (grub_memcmp (bangpxe->signature, GRUB_PXE_BANGPXE_SIGNATURE,
sizeof (bangpxe->signature)) != 0)
return NULL;
pxe_rm_entry = ret->rm_entry;
return ret;
pxe_rm_entry = bangpxe->rm_entry;
return bangpxe;
}
static int
@ -321,7 +327,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
o.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = grub_pxe_blksize;
o.packet_size = data->block_size;
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o, pxe_rm_entry);
if (o.status)
{
@ -483,7 +489,7 @@ parse_dhcp_vendor (void *vend, int limit)
static void
grub_pxe_detect (void)
{
struct grub_pxenv *pxenv;
struct grub_pxe_bangpxe *pxenv;
struct grub_pxenv_get_cached_info ci;
struct grub_pxenv_boot_player *bp;

View File

@ -37,8 +37,8 @@
#define GRUB_MODULES_MACHINE_READONLY
#endif
#ifdef __ia64__
#include <grub/machine/misc.h>
#ifdef GRUB_MACHINE_EMU
#include <sys/mman.h>
#endif
@ -229,6 +229,46 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
{
unsigned i;
Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1;
#ifdef __ia64__
grub_size_t tramp;
grub_size_t got;
#endif
char *ptr;
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize))
{
tsize += ALIGN_UP (s->sh_size, s->sh_addralign);
if (talign < s->sh_addralign)
talign = s->sh_addralign;
}
#ifdef __ia64__
grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
tsize += ALIGN_UP (tramp, GRUB_ARCH_DL_TRAMP_ALIGN);
if (talign < GRUB_ARCH_DL_TRAMP_ALIGN)
talign = GRUB_ARCH_DL_TRAMP_ALIGN;
tsize += ALIGN_UP (got, GRUB_ARCH_DL_GOT_ALIGN);
if (talign < GRUB_ARCH_DL_GOT_ALIGN)
talign = GRUB_ARCH_DL_GOT_ALIGN;
#endif
#ifdef GRUB_MACHINE_EMU
if (talign < 8192 * 16)
talign = 8192 * 16;
tsize = ALIGN_UP (tsize, 8192 * 16);
#endif
mod->base = grub_memalign (talign, tsize);
if (!mod->base)
return grub_errno;
ptr = mod->base;
#ifdef GRUB_MACHINE_EMU
mprotect (mod->base, tsize, PROT_READ | PROT_WRITE | PROT_EXEC);
#endif
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff);
i < e->e_shnum;
@ -246,12 +286,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
{
void *addr;
addr = grub_memalign (s->sh_addralign, s->sh_size);
if (! addr)
{
grub_free (seg);
return grub_errno;
}
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, s->sh_addralign);
addr = ptr;
ptr += s->sh_size;
switch (s->sh_type)
{
@ -274,6 +311,14 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
mod->segment = seg;
}
}
#ifdef __ia64__
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
mod->tramp = ptr;
ptr += tramp;
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN);
mod->got = ptr;
ptr += got;
#endif
return GRUB_ERR_NONE;
}
@ -342,14 +387,29 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
case STT_FUNC:
sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod,
sym->st_shndx);
#ifdef __ia64__
{
/* FIXME: free descriptor once it's not used anymore. */
char **desc;
desc = grub_malloc (2 * sizeof (char *));
if (!desc)
return grub_errno;
desc[0] = (void *) sym->st_value;
desc[1] = mod->base;
if (grub_dl_register_symbol (name, (void *) desc, mod))
return grub_errno;
sym->st_value = (grub_addr_t) desc;
}
#endif
if (bind != STB_LOCAL)
if (grub_dl_register_symbol (name, (void *) sym->st_value, mod))
return grub_errno;
{
if (grub_dl_register_symbol (name, (void *) sym->st_value, mod))
return grub_errno;
}
if (grub_strcmp (name, "grub_mod_init") == 0)
mod->init = (void (*) (grub_dl_t)) sym->st_value;
mod->init = sym->st_value;
else if (grub_strcmp (name, "grub_mod_fini") == 0)
mod->fini = (void (*) (void)) sym->st_value;
mod->fini = sym->st_value;
break;
case STT_SECTION:
@ -374,7 +434,9 @@ static void
grub_dl_call_init (grub_dl_t mod)
{
if (mod->init)
(mod->init) (mod);
{
((void (*) (grub_dl_t)) mod->init) (mod);
}
}
static grub_err_t
@ -537,7 +599,7 @@ grub_dl_load_core (void *addr, grub_size_t size)
grub_dl_flush_cache (mod);
grub_dprintf ("modules", "module name: %s\n", mod->name);
grub_dprintf ("modules", "init function: %p\n", mod->init);
grub_dprintf ("modules", "init function: %" PRIxGRUB_ADDR "\n", mod->init);
grub_dl_call_init (mod);
if (grub_dl_add (mod))
@ -662,7 +724,9 @@ grub_dl_unload (grub_dl_t mod)
return 0;
if (mod->fini)
(mod->fini) ();
{
((void (*) (void)) mod->fini) ();
}
grub_dl_remove (mod);
grub_dl_unregister_symbols (mod);

View File

@ -10,6 +10,7 @@
#include "../mips/cache.S"
#elif defined(__powerpc__)
#include "../powerpc/cache.S"
#elif defined(__ia64__)
#else
#error "No target cpu type is defined"
#endif

View File

@ -0,0 +1,13 @@
#if defined(__ia64__)
#include <grub/cache.h>
void __clear_cache (char *beg, char *end);
void
grub_arch_sync_caches (void *address, grub_size_t len)
{
__clear_cache (address, (char *) address + len);
}
#endif

View File

@ -48,3 +48,13 @@ grub_emu_init (void)
{
grub_no_autoload = 1;
}
#ifdef __ia64__
void grub_arch_dl_get_tramp_got_size (const void *ehdr __attribute__ ((unused)),
grub_size_t *tramp, grub_size_t *got)
{
*tramp = 0;
*got = 0;
}
#endif

View File

@ -15,6 +15,8 @@
#include "../mips/dl.c"
#elif defined(__powerpc__)
#include "../powerpc/dl.c"
#elif defined(__ia64__)
#include "../ia64/dl.c"
#else
#error "No target cpu type is defined"
#endif

View File

@ -51,7 +51,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
/*
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).

View File

@ -51,7 +51,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
codestart:
movl %eax, EXT_C(grub_ieee1275_entry_fn)

View File

@ -16,7 +16,6 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/types.h>
#include <grub/multiboot.h>

View File

@ -100,14 +100,6 @@ VARIABLE(grub_install_dos_part)
.long 0xFFFFFFFF
VARIABLE(grub_install_bsd_part)
.long 0xFFFFFFFF
VARIABLE(grub_prefix)
/* to be filled by grub-mkimage */
/*
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
#ifdef APPLE_CC
bss_start:
@ -450,6 +442,16 @@ gate_a20_check_state:
*/
. = _start + GRUB_KERNEL_MACHINE_RAW_SIZE
. = _start + GRUB_KERNEL_MACHINE_PREFIX
VARIABLE(grub_prefix)
/* to be filled by grub-mkimage */
/*
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
/*
* grub_exit()

View File

@ -39,7 +39,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
codestart:
/* Relocate to low memory. First we figure out our location.

318
grub-core/kern/ia64/dl.c Normal file
View File

@ -0,0 +1,318 @@
/* dl.c - arch-dependent part of loadable module support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2005,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 <grub/dl.h>
#include <grub/elf.h>
#include <grub/misc.h>
#include <grub/err.h>
#include <grub/mm.h>
/* Check if EHDR is a valid ELF header. */
grub_err_t
grub_arch_dl_check_header (void *ehdr)
{
Elf_Ehdr *e = ehdr;
/* Check the magic numbers. */
if (e->e_ident[EI_CLASS] != ELFCLASS64
|| e->e_ident[EI_DATA] != ELFDATA2LSB
|| e->e_machine != EM_IA_64)
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
return GRUB_ERR_NONE;
}
#define MASK20 ((1 << 20) - 1)
#define MASK19 ((1 << 19) - 1)
struct unaligned_uint32
{
grub_uint32_t val;
} __attribute__ ((packed));
static void
add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value)
{
struct unaligned_uint32 *p;
switch (addr & 3)
{
case 0:
p = (struct unaligned_uint32 *) ((addr & ~3ULL) + 2);
p->val = (((((p->val >> 2) & MASK20) + value) & MASK20) << 2) | (p->val & ~(MASK20 << 2));
break;
case 1:
p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 7);
p->val = (((((p->val >> 3) & MASK20) + value) & MASK20) << 3) | (p->val & ~(MASK20 << 3));
break;
case 2:
p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 12);
p->val = (((((p->val >> 4) & MASK20) + value) & MASK20) << 4) | (p->val & ~(MASK20 << 4));
break;
}
}
#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) )
static grub_uint32_t
add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value)
{
grub_uint32_t high, mid, low, c;
low = (a & 0x00007f);
mid = (a & 0x7fc000) >> 7;
high = (a & 0x003e00) << 7;
c = (low | mid | high) + value;
return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00); //0x003e00
}
static void
add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value)
{
struct unaligned_uint32 *p;
switch (addr & 3)
{
case 0:
p = (struct unaligned_uint32 *) ((addr & ~3ULL) + 2);
p->val = ((add_value_to_slot_21_real (((p->val >> 2) & MASKF21), value) & MASKF21) << 2) | (p->val & ~(MASKF21 << 2));
break;
case 1:
p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 7);
p->val = ((add_value_to_slot_21_real (((p->val >> 3) & MASKF21), value) & MASKF21) << 3) | (p->val & ~(MASKF21 << 3));
break;
case 2:
p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 12);
p->val = ((add_value_to_slot_21_real (((p->val >> 4) & MASKF21), value) & MASKF21) << 4) | (p->val & ~(MASKF21 << 4));
break;
}
}
static grub_uint8_t nopm[5] =
{
/* [MLX] nop.m 0x0 */
0x05, 0x00, 0x00, 0x00, 0x01
};
static grub_uint8_t jump[0x20] =
{
/* ld8 r16=[r15],8 */
0x02, 0x80, 0x20, 0x1e, 0x18, 0x14,
/* mov r14=r1;; */
0xe0, 0x00, 0x04, 0x00, 0x42, 0x00,
/* nop.i 0x0 */
0x00, 0x00, 0x04, 0x00,
/* ld8 r1=[r15] */
0x11, 0x08, 0x00, 0x1e, 0x18, 0x10,
/* mov b6=r16 */
0x60, 0x80, 0x04, 0x80, 0x03, 0x00,
/* br.few b6;; */
0x60, 0x00, 0x80, 0x00
};
struct ia64_trampoline
{
/* nop.m */
grub_uint8_t nop[5];
/* movl r15 = addr*/
grub_uint8_t addr_hi[6];
grub_uint8_t e0;
grub_uint8_t addr_lo[4];
grub_uint8_t jump[0x20];
};
static void
make_trampoline (struct ia64_trampoline *tr, grub_uint64_t addr)
{
grub_memcpy (tr->nop, nopm, sizeof (tr->nop));
tr->addr_hi[0] = ((addr & 0xc00000) >> 16);
tr->addr_hi[1] = (addr >> 24) & 0xff;
tr->addr_hi[2] = (addr >> 32) & 0xff;
tr->addr_hi[3] = (addr >> 40) & 0xff;
tr->addr_hi[4] = (addr >> 48) & 0xff;
tr->addr_hi[5] = (addr >> 56) & 0xff;
tr->e0 = 0xe0;
tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01;
tr->addr_lo[1] = ((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11) | ((addr & 0x200000) >> 17);
tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19);
tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60;
grub_memcpy (tr->jump, jump, sizeof (tr->jump));
}
void
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, grub_size_t *got)
{
const Elf_Ehdr *e = ehdr;
grub_size_t cntt = 0, cntg = 0;;
const Elf_Shdr *s;
Elf_Word entsize;
unsigned i;
/* Find a symbol table. */
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
if (s->sh_type == SHT_SYMTAB)
break;
if (i == e->e_shnum)
return;
entsize = s->sh_entsize;
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
if (s->sh_type == SHT_RELA)
{
Elf_Rela *rel, *max;
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
max = rel + s->sh_size / s->sh_entsize;
rel < max; rel++)
switch (ELF_R_TYPE (rel->r_info))
{
case R_IA64_PCREL21B:
cntt++;
break;
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF22X:
case R_IA64_LTOFF22:
cntg++;
break;
}
}
*tramp = cntt * sizeof (struct ia64_trampoline);
*got = cntg * sizeof (grub_uint64_t);
}
/* Relocate symbols. */
grub_err_t
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
{
Elf_Ehdr *e = ehdr;
Elf_Shdr *s;
Elf_Word entsize;
unsigned i;
grub_uint64_t *gp, *gpptr;
struct ia64_trampoline *tr;
gp = (grub_uint64_t *) mod->base;
gpptr = (grub_uint64_t *) mod->got;
tr = mod->tramp;
/* Find a symbol table. */
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
if (s->sh_type == SHT_SYMTAB)
break;
if (i == e->e_shnum)
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
entsize = s->sh_entsize;
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
if (s->sh_type == SHT_RELA)
{
grub_dl_segment_t seg;
/* Find the target segment. */
for (seg = mod->segment; seg; seg = seg->next)
if (seg->section == s->sh_info)
break;
if (seg)
{
Elf_Rela *rel, *max;
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
max = rel + s->sh_size / s->sh_entsize;
rel < max;
rel++)
{
grub_addr_t addr;
Elf_Sym *sym;
grub_uint64_t value;
if (seg->size < (rel->r_offset & ~3))
return grub_error (GRUB_ERR_BAD_MODULE,
"reloc offset is out of the segment");
addr = (grub_addr_t) seg->addr + rel->r_offset;
sym = (Elf_Sym *) ((char *) mod->symtab
+ entsize * ELF_R_SYM (rel->r_info));
/* On the PPC the value does not have an explicit
addend, add it. */
value = sym->st_value + rel->r_addend;
switch (ELF_R_TYPE (rel->r_info))
{
case R_IA64_PCREL21B:
{
grub_uint64_t noff;
make_trampoline (tr, value);
noff = ((char *) tr - (char *) (addr & ~3)) >> 4;
tr++;
if (noff & ~MASK19)
return grub_error (GRUB_ERR_BAD_OS,
"trampoline offset too big (%lx)", noff);
add_value_to_slot_20b (addr, noff);
}
break;
case R_IA64_SEGREL64LSB:
*(grub_uint64_t *) addr += value - rel->r_offset;
break;
case R_IA64_FPTR64LSB:
case R_IA64_DIR64LSB:
*(grub_uint64_t *) addr += value;
break;
case R_IA64_PCREL64LSB:
*(grub_uint64_t *) addr += value - addr;
break;
case R_IA64_GPREL22:
add_value_to_slot_21 (addr, value - (grub_addr_t) gp);
break;
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF22X:
case R_IA64_LTOFF22:
*gpptr = value;
if ((addr & 0xffff) == 0x4301)
grub_dprintf ("modules", "off = %lx\n", (grub_addr_t) gpptr - (grub_addr_t) gp);
add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) gp);
gpptr++;
break;
/* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
case R_IA64_LDXMOV:
break;
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"this relocation (0x%x) is not implemented yet",
ELF_R_TYPE (rel->r_info));
}
}
}
}
return GRUB_ERR_NONE;
}

View File

@ -154,7 +154,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
#ifdef GRUB_MACHINE_MIPS_YEELOONG
VARIABLE (grub_arch_busclock)
.long 0

View File

@ -990,7 +990,7 @@ grub_abort (void)
grub_exit ();
}
#ifndef APPLE_CC
#if ! defined (APPLE_CC) && !defined (GRUB_UTIL)
/* GCC emits references to abort(). */
void abort (void) __attribute__ ((alias ("grub_abort")));
#endif

View File

@ -39,7 +39,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = _start + GRUB_KERNEL_MACHINE_DATA_END
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
codestart:
li 2, 0

View File

@ -42,7 +42,7 @@ VARIABLE(grub_prefix)
* Leave some breathing room for the prefix.
*/
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_DATA_END
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_PREFIX_END
codestart:
/* Copy the modules past the end of the kernel image.

View File

@ -59,7 +59,9 @@ extern grub_uint32_t grub_relocator32_ecx;
extern grub_uint32_t grub_relocator32_edx;
extern grub_uint32_t grub_relocator32_eip;
extern grub_uint32_t grub_relocator32_esp;
extern grub_uint32_t grub_relocator32_ebp;
extern grub_uint32_t grub_relocator32_esi;
extern grub_uint32_t grub_relocator32_edi;
extern grub_uint8_t grub_relocator64_start;
extern grub_uint8_t grub_relocator64_end;
@ -165,7 +167,9 @@ grub_relocator32_boot (struct grub_relocator *rel,
grub_relocator32_edx = state.edx;
grub_relocator32_eip = state.eip;
grub_relocator32_esp = state.esp;
grub_relocator32_ebp = state.ebp;
grub_relocator32_esi = state.esi;
grub_relocator32_edi = state.edi;
grub_memmove (get_virtual_current_address (ch), &grub_relocator32_start,
RELOCATOR_SIZEOF (32));

View File

@ -65,13 +65,27 @@ VARIABLE(grub_relocator32_esp)
movl %eax, %esp
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_relocator32_ebp)
.long 0
movl %eax, %ebp
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_relocator32_esi)
.long 0
movl %eax, %esi
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_relocator32_edi)
.long 0
movl %eax, %edi
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_relocator32_eax)

View File

@ -746,6 +746,7 @@ grub_freebsd_boot (void)
grub_memcpy (&stack[9], &bi, sizeof (bi));
state.eip = entry;
state.esp = stack_target;
state.ebp = stack_target;
stack[0] = entry; /* "Return" address. */
stack[1] = bootflags | FREEBSD_RB_BOOTINFO;
stack[2] = bootdev;
@ -830,7 +831,8 @@ grub_openbsd_boot (void)
#endif
state.eip = entry;
state.esp = ((grub_uint8_t *) stack - (grub_uint8_t *) buf0) + buf_target;
state.ebp = state.esp
= ((grub_uint8_t *) stack - (grub_uint8_t *) buf0) + buf_target;
stack[0] = entry;
stack[1] = bootflags;
stack[2] = openbsd_root;
@ -1045,6 +1047,7 @@ grub_netbsd_boot (void)
state.eip = entry;
state.esp = stack_target;
state.ebp = stack_target;
stack[0] = entry;
stack[1] = bootflags;
stack[2] = 0;

View File

@ -716,7 +716,7 @@ grub_linux_boot (void)
/* FIXME. */
/* asm volatile ("lidt %0" : : "m" (idt_desc)); */
state.ebx = 0;
state.ebp = state.edi = state.ebx = 0;
state.esi = real_mode_target;
state.esp = real_mode_target;
state.eip = params->code32_start;

View File

@ -836,6 +836,7 @@ grub_xnu_boot_resume (void)
struct grub_relocator32_state state;
state.esp = grub_xnu_stack;
state.ebp = grub_xnu_stack;
state.eip = grub_xnu_entry_point;
state.eax = grub_xnu_arg1;
@ -1114,6 +1115,7 @@ grub_xnu_boot (void)
state.eip = grub_xnu_entry_point;
state.eax = grub_xnu_arg1;
state.esp = grub_xnu_stack;
state.ebp = grub_xnu_stack;
return grub_relocator32_boot (grub_xnu_relocator, state);
}

View File

@ -92,8 +92,13 @@ struct grub_dl
grub_dl_dep_t dep;
grub_dl_segment_t segment;
Elf_Sym *symtab;
void (*init) (struct grub_dl *mod);
void (*fini) (void);
grub_addr_t init;
grub_addr_t fini;
#ifdef __ia64__
void *got;
void *tramp;
#endif
void *base;
struct grub_dl *next;
};
typedef struct grub_dl *grub_dl_t;
@ -121,4 +126,14 @@ grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
void grub_arch_dl_init_linker (void);
#endif
#ifdef __ia64__
void grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, grub_size_t *got);
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
#define GRUB_ARCH_DL_GOT_ALIGN 16
#else
#endif
#endif /* ! GRUB_DL_H */

View File

@ -192,6 +192,19 @@ struct grub_pxenv
grub_uint32_t pxe_ptr; /* SEG:OFF to !PXE struct. */
} __attribute__ ((packed));
struct grub_pxe_bangpxe
{
grub_uint8_t signature[4];
#define GRUB_PXE_BANGPXE_SIGNATURE "!PXE"
grub_uint8_t length;
grub_uint8_t chksum;
grub_uint8_t rev;
grub_uint8_t reserved;
grub_uint32_t undiromid;
grub_uint32_t baseromid;
grub_uint32_t rm_entry;
} __attribute__ ((packed));
struct grub_pxenv_get_cached_info
{
grub_uint16_t status;
@ -306,7 +319,7 @@ struct grub_pxenv_unload_stack
int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entry);
extern struct grub_pxenv *grub_pxe_pxenv;
extern struct grub_pxe_bangpxe *grub_pxe_pxenv;
void grub_pxe_unload (void);

View File

@ -26,12 +26,14 @@
struct grub_relocator32_state
{
grub_uint32_t esp;
grub_uint32_t ebp;
grub_uint32_t eax;
grub_uint32_t ebx;
grub_uint32_t ecx;
grub_uint32_t edx;
grub_uint32_t eip;
grub_uint32_t esi;
grub_uint32_t edi;
};
struct grub_relocator16_state

View File

@ -24,8 +24,5 @@
/* the __jmp_buf element type should be __float80 per ABI... */
typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
#define grub_setjmp setjmp
#define grub_longjmp longjmp
int grub_setjmp (grub_jmp_buf env);
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));

View File

@ -38,8 +38,36 @@ void EXPORT_FUNC (__bswapsi2) (void);
# ifdef HAVE___BSWAPDI2
void EXPORT_FUNC (__bswapdi2) (void);
# endif
# ifdef HAVE___UDIVSI3
void EXPORT_FUNC (__udivsi3) (void);
# endif
# ifdef HAVE___UMODSI3
void EXPORT_FUNC (__umodsi3) (void);
# endif
# ifdef HAVE___UMODDI3
void EXPORT_FUNC (__umoddi3) (void);
# endif
# ifdef HAVE___UDIVDI3
void EXPORT_FUNC (__udivdi3) (void);
# endif
# ifdef HAVE___MODDI3
void EXPORT_FUNC (__moddi3) (void);
# endif
# ifdef HAVE___DIVDI3
void EXPORT_FUNC (__divdi3) (void);
# endif
# ifdef HAVE___DIVSI3
void EXPORT_FUNC (__divsi3) (void);
# endif
# ifdef HAVE___MODSI3
void EXPORT_FUNC (__modsi3) (void);
# endif
#endif
# ifdef HAVE___IA64_TRAMPOLINE
void EXPORT_FUNC (__ia64_trampoline) (void);
# endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void);
#endif

View File

@ -34,14 +34,17 @@
/* The offset of GRUB_INSTALL_BSD_PART. */
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX 0x1c
/* End of the data section. */
#define GRUB_KERNEL_I386_PC_DATA_END 0x5c
/* The offset of multiboot signature. */
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x1c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE (GRUB_KERNEL_I386_PC_DATA_END + 0x5F0)
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0x5D8
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
/* End of the data section. */
#define GRUB_KERNEL_I386_PC_PREFIX_END (GRUB_KERNEL_I386_PC_PREFIX + 0x40)
/* The segment where the kernel is loaded. */
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
@ -65,7 +68,7 @@
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
/* End of the data section. */
#define GRUB_KERNEL_I386_QEMU_DATA_END 0x50
#define GRUB_KERNEL_I386_QEMU_PREFIX_END 0x50
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
@ -82,7 +85,7 @@
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
/* End of the data section. */
#define GRUB_KERNEL_SPARC64_IEEE1275_DATA_END 0x114
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END 0x114
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
@ -91,7 +94,7 @@
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
#define GRUB_KERNEL_POWERPC_IEEE1275_DATA_END 0x44
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END 0x44
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
@ -105,29 +108,29 @@
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
#define GRUB_KERNEL_MIPS_YEELOONG_DATA_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_I386_EFI_DATA_END 0x50
#define GRUB_KERNEL_I386_EFI_PREFIX_END 0x50
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_X86_64_EFI_DATA_END 0x50
#define GRUB_KERNEL_X86_64_EFI_PREFIX_END 0x50
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
#define GRUB_KERNEL_I386_COREBOOT_DATA_END 0x42
#define GRUB_KERNEL_I386_COREBOOT_PREFIX_END 0x42
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
#define GRUB_KERNEL_I386_MULTIBOOT_DATA_END GRUB_KERNEL_I386_COREBOOT_DATA_END
#define GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END GRUB_KERNEL_I386_COREBOOT_PREFIX_END
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
#define GRUB_KERNEL_I386_IEEE1275_DATA_END 0x42
#define GRUB_KERNEL_I386_IEEE1275_PREFIX_END 0x42
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
@ -157,7 +160,7 @@
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _COMPRESSED_SIZE)
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX)
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _DATA_END)
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX_END)
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, MACHINE, _UPPER)
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _RAW_SIZE)

View File

@ -101,8 +101,10 @@ typedef grub_int64_t grub_ssize_t;
# if GRUB_CPU_SIZEOF_LONG == 8
# define PRIxGRUB_SIZE "lx"
# define PRIxGRUB_ADDR "lx"
# else
# define PRIxGRUB_SIZE "llx"
# define PRIxGRUB_ADDR "llx"
# endif
#else
typedef grub_uint32_t grub_addr_t;
@ -110,6 +112,7 @@ typedef grub_uint32_t grub_size_t;
typedef grub_int32_t grub_ssize_t;
# define PRIxGRUB_SIZE "x"
# define PRIxGRUB_ADDR "x"
#endif
#if GRUB_CPU_SIZEOF_LONG == 8

View File

@ -54,7 +54,8 @@ struct image_target_desc
enum {
IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH
IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
IMAGE_I386_PC_PXE
} id;
enum
{
@ -62,7 +63,7 @@ struct image_target_desc
PLATFORM_FLAGS_LZMA = 1
} flags;
unsigned prefix;
unsigned data_end;
unsigned prefix_end;
unsigned raw_size;
unsigned total_module_size;
unsigned kernel_image_size;
@ -85,7 +86,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_COREBOOT,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_COREBOOT_PREFIX,
.data_end = GRUB_KERNEL_I386_COREBOOT_DATA_END,
.prefix_end = GRUB_KERNEL_I386_COREBOOT_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -107,7 +108,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_COREBOOT,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_MULTIBOOT_PREFIX,
.data_end = GRUB_KERNEL_I386_MULTIBOOT_DATA_END,
.prefix_end = GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -129,7 +130,25 @@ struct image_target_desc image_targets[] =
.id = IMAGE_I386_PC,
.flags = PLATFORM_FLAGS_LZMA,
.prefix = GRUB_KERNEL_I386_PC_PREFIX,
.data_end = GRUB_KERNEL_I386_PC_DATA_END,
.prefix_end = GRUB_KERNEL_I386_PC_PREFIX_END,
.raw_size = GRUB_KERNEL_I386_PC_RAW_SIZE,
.total_module_size = GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE,
.kernel_image_size = GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE,
.compressed_size = GRUB_KERNEL_I386_PC_COMPRESSED_SIZE,
.section_align = 1,
.vaddr_offset = 0,
.install_dos_part = GRUB_KERNEL_I386_PC_INSTALL_DOS_PART,
.install_bsd_part = GRUB_KERNEL_I386_PC_INSTALL_BSD_PART,
.link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
},
{
.name = "i386-pc-pxe",
.voidp_sizeof = 4,
.bigendian = 0,
.id = IMAGE_I386_PC_PXE,
.flags = PLATFORM_FLAGS_LZMA,
.prefix = GRUB_KERNEL_I386_PC_PREFIX,
.prefix_end = GRUB_KERNEL_I386_PC_PREFIX_END,
.raw_size = GRUB_KERNEL_I386_PC_RAW_SIZE,
.total_module_size = GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE,
.kernel_image_size = GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE,
@ -147,7 +166,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_EFI,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_EFI_PREFIX,
.data_end = GRUB_KERNEL_I386_EFI_DATA_END,
.prefix_end = GRUB_KERNEL_I386_EFI_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -169,7 +188,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_I386_IEEE1275,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_IEEE1275_PREFIX,
.data_end = GRUB_KERNEL_I386_IEEE1275_DATA_END,
.prefix_end = GRUB_KERNEL_I386_IEEE1275_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -191,7 +210,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_QEMU,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_QEMU_PREFIX,
.data_end = GRUB_KERNEL_I386_QEMU_DATA_END,
.prefix_end = GRUB_KERNEL_I386_QEMU_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.compressed_size = TARGET_NO_FIELD,
@ -209,7 +228,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_EFI,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_X86_64_EFI_PREFIX,
.data_end = GRUB_KERNEL_X86_64_EFI_DATA_END,
.prefix_end = GRUB_KERNEL_X86_64_EFI_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -231,7 +250,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_YEELOONG_FLASH,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_MIPS_YEELOONG_PREFIX,
.data_end = GRUB_KERNEL_MIPS_YEELOONG_DATA_END,
.prefix_end = GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END,
.raw_size = GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE,
.total_module_size = GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE,
.compressed_size = GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE,
@ -251,7 +270,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_YEELOONG_ELF,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_MIPS_YEELOONG_PREFIX,
.data_end = GRUB_KERNEL_MIPS_YEELOONG_DATA_END,
.prefix_end = GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END,
.raw_size = GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE,
.total_module_size = GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE,
.compressed_size = GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE,
@ -271,7 +290,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_PPC,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_POWERPC_IEEE1275_PREFIX,
.data_end = GRUB_KERNEL_POWERPC_IEEE1275_DATA_END,
.prefix_end = GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
@ -293,7 +312,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_SPARC64_RAW,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX,
.data_end = GRUB_KERNEL_SPARC64_IEEE1275_DATA_END,
.prefix_end = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END,
.raw_size = GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE,
.total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE,
.kernel_image_size = GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE,
@ -311,7 +330,7 @@ struct image_target_desc image_targets[] =
.id = IMAGE_SPARC64_AOUT,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX,
.data_end = GRUB_KERNEL_SPARC64_IEEE1275_DATA_END,
.prefix_end = GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END,
.raw_size = GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE,
.total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE,
.kernel_image_size = GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE,
@ -559,7 +578,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
total_module_size, &start_address, &rel_section,
&reloc_size, &align, image_target);
if (image_target->prefix + strlen (prefix) + 1 > image_target->data_end)
if (image_target->prefix + strlen (prefix) + 1 > image_target->prefix_end)
grub_util_error (_("prefix is too long"));
strcpy (kernel_img + image_target->prefix, prefix);
@ -664,6 +683,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
switch (image_target->id)
{
case IMAGE_I386_PC:
case IMAGE_I386_PC_PXE:
{
unsigned num;
char *boot_path, *boot_img;
@ -678,6 +698,20 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
if (num > 0xffff)
grub_util_error (_("the core image is too big"));
if (image_target->id == IMAGE_I386_PC_PXE)
{
char *pxeboot_path, *pxeboot_img;
size_t pxeboot_size;
pxeboot_path = grub_util_get_path (dir, "pxeboot.img");
pxeboot_size = grub_util_get_image_size (pxeboot_path);
pxeboot_img = grub_util_read_image (pxeboot_path);
grub_util_write_image (pxeboot_img, pxeboot_size, out);
free (pxeboot_img);
free (pxeboot_path);
}
boot_path = grub_util_get_path (dir, "diskboot.img");
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE)

View File

@ -62,7 +62,8 @@ Make GRUB rescue image.
$self generates a bootable rescue image with specified source files, source
directories, or mkisofs options listed by: xorriso -as mkisofs -help
Option -- switches to native xorriso command mode. or directories.
Option -- switches to native xorriso command mode.
Report bugs to <bug-grub@gnu.org>.
Mail xorriso support requests to <bug-xorriso@gnu.org>.