mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-22 15:22:39 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
206676601e |
No files matched your search
+35
-43
@@ -89,21 +89,16 @@ CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
|
|||||||
|
|
||||||
if COND_STARFIELD
|
if COND_STARFIELD
|
||||||
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
||||||
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE)
|
./build-grub-mkfont -s 10 -o $@ $(DJVU_FONT_SOURCE)
|
||||||
CLEANFILES += dejavu_10.pf2
|
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
|
||||||
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
./build-grub-mkfont -s 12 -o $@ $(DJVU_FONT_SOURCE)
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE)
|
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
|
||||||
CLEANFILES += dejavu_12.pf2
|
./build-grub-mkfont -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||||
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
./build-grub-mkfont -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||||
CLEANFILES += dejavu_14.pf2
|
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
|
||||||
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
./build-grub-mkfont -s 16 -o $@ $(DJVU_FONT_SOURCE)
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
|
||||||
CLEANFILES += dejavu_bold_14.pf2
|
|
||||||
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE)
|
|
||||||
CLEANFILES += dejavu_16.pf2
|
|
||||||
else
|
else
|
||||||
starfield_DATA =
|
starfield_DATA =
|
||||||
endif
|
endif
|
||||||
@@ -111,28 +106,28 @@ endif
|
|||||||
EXTRA_DIST += $(starfield_theme_files)
|
EXTRA_DIST += $(starfield_theme_files)
|
||||||
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
|
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
|
||||||
|
|
||||||
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += unicode.pf2
|
CLEANFILES += unicode.pf2
|
||||||
|
|
||||||
# Arrows and lines are needed to draw the menu, so always include them
|
# Arrows and lines are needed to draw the menu, so always include them
|
||||||
UNICODE_ARROWS=0x2190-0x2193
|
UNICODE_ARROWS=0x2190-0x2193
|
||||||
UNICODE_LINES=0x2501-0x251B
|
UNICODE_LINES=0x2501-0x251B
|
||||||
|
|
||||||
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += ascii.pf2
|
CLEANFILES += ascii.pf2
|
||||||
|
|
||||||
euro.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
euro.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += euro.pf2
|
CLEANFILES += euro.pf2
|
||||||
|
|
||||||
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih$(BUILD_EXEEXT)
|
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih
|
||||||
./build-grub-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
./build-grub-gen-asciih $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||||
CLEANFILES += ascii.h
|
CLEANFILES += ascii.h
|
||||||
|
|
||||||
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec$(BUILD_EXEEXT)
|
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
|
||||||
./build-grub-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
./build-grub-gen-widthspec $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||||
CLEANFILES += widthspec.h
|
CLEANFILES += widthspec.h
|
||||||
|
|
||||||
# Install config.h into platformdir
|
# Install config.h into platformdir
|
||||||
@@ -345,35 +340,33 @@ bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell
|
|||||||
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||||
|
|
||||||
if COND_i386_efi
|
if COND_i386_efi
|
||||||
# NetBSD has no support for finding ACPI on EFI
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_x86_64_efi
|
if COND_x86_64_efi
|
||||||
# NetBSD has no support for finding ACPI on EFI
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_multiboot
|
if COND_i386_multiboot
|
||||||
# *BSD requires ACPI
|
# FreeBSD requires ACPI
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if COND_i386_qemu
|
|
||||||
# *BSD requires ACPI
|
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_coreboot
|
if COND_i386_coreboot
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
|
# Freebsd requires ACPI
|
||||||
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
|
||||||
|
endif
|
||||||
|
|
||||||
|
if COND_i386_qemu
|
||||||
|
# FreeBSD requires ACPI
|
||||||
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_pc
|
if COND_i386_pc
|
||||||
#pc chainloader by definition is only for i386-pc
|
#pc chainloader by definition is only for i386-pc
|
||||||
#ntldr and bootmgr require BIOS.
|
#ntldr and bootmgr require BIOS.
|
||||||
#legacy protocol (linux16) makes early BIOS calls.
|
#legacy protocol makes early BIOS calls.
|
||||||
# 32-bit NetBSD crashes early on non-BIOS
|
# NetBSD crashes early on non-BIOS
|
||||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386
|
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -409,9 +402,8 @@ BOOTCHECK_TIMEOUT=180
|
|||||||
bootcheck: $(BOOTCHECKS)
|
bootcheck: $(BOOTCHECKS)
|
||||||
|
|
||||||
if COND_i386_coreboot
|
if COND_i386_coreboot
|
||||||
default_payload.elf: grub-mkstandalone grub-mkimage FORCE
|
default_payload.elf: grub-mkstandalone grub-mkimage
|
||||||
test -f $@ && rm $@ || true
|
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
|
||||||
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat grub-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -172,8 +172,6 @@ program = {
|
|||||||
|
|
||||||
common = util/grub-mkimage.c;
|
common = util/grub-mkimage.c;
|
||||||
common = util/mkimage.c;
|
common = util/mkimage.c;
|
||||||
common = util/grub-mkimage32.c;
|
|
||||||
common = util/grub-mkimage64.c;
|
|
||||||
common = util/resolve.c;
|
common = util/resolve.c;
|
||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
@@ -512,8 +510,6 @@ program = {
|
|||||||
common = util/render-label.c;
|
common = util/render-label.c;
|
||||||
common = util/glue-efi.c;
|
common = util/glue-efi.c;
|
||||||
common = util/mkimage.c;
|
common = util/mkimage.c;
|
||||||
common = util/grub-mkimage32.c;
|
|
||||||
common = util/grub-mkimage64.c;
|
|
||||||
common = util/grub-install-common.c;
|
common = util/grub-install-common.c;
|
||||||
common = util/setup_bios.c;
|
common = util/setup_bios.c;
|
||||||
common = util/setup_sparc.c;
|
common = util/setup_sparc.c;
|
||||||
@@ -556,8 +552,6 @@ program = {
|
|||||||
common = util/render-label.c;
|
common = util/render-label.c;
|
||||||
common = util/glue-efi.c;
|
common = util/glue-efi.c;
|
||||||
common = util/mkimage.c;
|
common = util/mkimage.c;
|
||||||
common = util/grub-mkimage32.c;
|
|
||||||
common = util/grub-mkimage64.c;
|
|
||||||
common = util/grub-install-common.c;
|
common = util/grub-install-common.c;
|
||||||
common = util/setup_bios.c;
|
common = util/setup_bios.c;
|
||||||
common = util/setup_sparc.c;
|
common = util/setup_sparc.c;
|
||||||
@@ -601,8 +595,6 @@ program = {
|
|||||||
common = util/grub-install.c;
|
common = util/grub-install.c;
|
||||||
common = util/probe.c;
|
common = util/probe.c;
|
||||||
common = util/mkimage.c;
|
common = util/mkimage.c;
|
||||||
common = util/grub-mkimage32.c;
|
|
||||||
common = util/grub-mkimage64.c;
|
|
||||||
common = util/grub-install-common.c;
|
common = util/grub-install-common.c;
|
||||||
common = util/setup_bios.c;
|
common = util/setup_bios.c;
|
||||||
common = util/setup_sparc.c;
|
common = util/setup_sparc.c;
|
||||||
@@ -640,8 +632,6 @@ program = {
|
|||||||
common = util/grub-mknetdir.c;
|
common = util/grub-mknetdir.c;
|
||||||
|
|
||||||
common = util/mkimage.c;
|
common = util/mkimage.c;
|
||||||
common = util/grub-mkimage32.c;
|
|
||||||
common = util/grub-mkimage64.c;
|
|
||||||
common = util/grub-install-common.c;
|
common = util/grub-install-common.c;
|
||||||
common = util/setup_bios.c;
|
common = util/setup_bios.c;
|
||||||
common = util/setup_sparc.c;
|
common = util/setup_sparc.c;
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ New in 2.02:
|
|||||||
* Command for inspecting coreboot tables (`lscoreboot').
|
* Command for inspecting coreboot tables (`lscoreboot').
|
||||||
* New target default_payload.elf.
|
* New target default_payload.elf.
|
||||||
* Increased maximal core size.
|
* Increased maximal core size.
|
||||||
* Prefer pmtimer for TSC calibration.
|
|
||||||
|
|
||||||
* New/improved platform support:
|
* New/improved platform support:
|
||||||
* New `efifwsetup' and `lsefi' commands on EFI platforms.
|
* New `efifwsetup' and `lsefi' commands on EFI platforms.
|
||||||
@@ -90,12 +89,6 @@ New in 2.02:
|
|||||||
* New platform `none' which builds only user level utilities. This is now
|
* New platform `none' which builds only user level utilities. This is now
|
||||||
default if target CPU is not supported.
|
default if target CPU is not supported.
|
||||||
* Support for booting little-endian Linux kernel on powerpc.
|
* Support for booting little-endian Linux kernel on powerpc.
|
||||||
* Support network boot with Oracle sun4v vnet devices.
|
|
||||||
* Added SAS disks to the IEEE 1275 Open Firmware device list.
|
|
||||||
* Try multiple methods for TSC (timestamp counter) calibration - PIT, pmtimer,
|
|
||||||
EFI Stall. If everything fails, use hardcoded frequency 800MHz.
|
|
||||||
* Support Hyper-V Gen2 platforms which lack PIT for TSC calibration.
|
|
||||||
* Map UEFI Persistent Memory to E820 persistent memory.
|
|
||||||
|
|
||||||
* Security:
|
* Security:
|
||||||
* Add optional facility to enforce that all files read by the core image
|
* Add optional facility to enforce that all files read by the core image
|
||||||
@@ -159,7 +152,6 @@ New in 2.02:
|
|||||||
system.
|
system.
|
||||||
* emu libusb support removed (was broken and unmaintained).
|
* emu libusb support removed (was broken and unmaintained).
|
||||||
* powerpc64le compile support.
|
* powerpc64le compile support.
|
||||||
* Use fixed timestamp when generating GRUB image for reproducible builds.
|
|
||||||
|
|
||||||
* Revision control moved to git.
|
* Revision control moved to git.
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ There are a number of important user-visible differences from the
|
|||||||
first version of GRUB, now known as GRUB Legacy. For a summary, please
|
first version of GRUB, now known as GRUB Legacy. For a summary, please
|
||||||
see:
|
see:
|
||||||
|
|
||||||
info grub Introduction 'Changes from GRUB Legacy'
|
info grub Introduction 'Changes from GRUB Legacy'
|
||||||
@@ -7,3 +7,7 @@ glance. So write to <grub-devel@gnu.org> first.
|
|||||||
For bug tracking, refer to:
|
For bug tracking, refer to:
|
||||||
|
|
||||||
http://savannah.gnu.org/bugs/?group=grub
|
http://savannah.gnu.org/bugs/?group=grub
|
||||||
|
|
||||||
|
Our wiki also lists some areas that need work:
|
||||||
|
|
||||||
|
http://grub.enbug.org/
|
||||||
+1
-5
@@ -5,10 +5,6 @@
|
|||||||
.code16
|
.code16
|
||||||
jmp far
|
jmp far
|
||||||
.org 4
|
.org 4
|
||||||
jmp nearer
|
.space 300
|
||||||
.org 6
|
|
||||||
.space 100
|
|
||||||
nearer:
|
|
||||||
.space 200
|
|
||||||
far:
|
far:
|
||||||
.byte 0
|
.byte 0
|
||||||
+2
-2
@@ -23,14 +23,14 @@ fi
|
|||||||
if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
|
if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
|
||||||
rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
|
rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
|
||||||
fi
|
fi
|
||||||
cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
|
ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
|
||||||
cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
|
cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
|
||||||
|
|
||||||
for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do
|
for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do
|
||||||
if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
|
if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
|
||||||
rm grub-core/lib/libgcrypt-grub/mpi/"$x"
|
rm grub-core/lib/libgcrypt-grub/mpi/"$x"
|
||||||
fi
|
fi
|
||||||
cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
|
ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Generating Automake input..."
|
echo "Generating Automake input..."
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ if COND_powerpc_ieee1275
|
|||||||
CFLAGS_PLATFORM += -mcpu=powerpc
|
CFLAGS_PLATFORM += -mcpu=powerpc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#FIXME: discover and check XEN headers
|
||||||
|
CPPFLAGS_XEN = -I/usr/include
|
||||||
|
|
||||||
# Other options
|
# Other options
|
||||||
|
|
||||||
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
|
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
|
||||||
@@ -38,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
|
|||||||
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
|
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
|
||||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
||||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||||
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
|
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags
|
||||||
|
|
||||||
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
||||||
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ EXTRA_DIST += grub-core/lib/libgcrypt
|
|||||||
EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
|
EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')
|
||||||
|
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h')
|
||||||
EXTRA_DIST += grub-core/efiemu/runtime/config.h
|
EXTRA_DIST += grub-core/efiemu/runtime/config.h
|
||||||
|
|
||||||
EXTRA_DIST += grub-core/lib/LzmaDec.c
|
EXTRA_DIST += grub-core/lib/LzmaDec.c
|
||||||
@@ -50,13 +51,8 @@ EXTRA_DIST += util/import_gcrypth.sed
|
|||||||
EXTRA_DIST += util/bin2h.c
|
EXTRA_DIST += util/bin2h.c
|
||||||
EXTRA_DIST += util/grub-gen-asciih.c
|
EXTRA_DIST += util/grub-gen-asciih.c
|
||||||
EXTRA_DIST += util/grub-gen-widthspec.c
|
EXTRA_DIST += util/grub-gen-widthspec.c
|
||||||
EXTRA_DIST += util/grub-module-verifier.c
|
|
||||||
EXTRA_DIST += util/grub-module-verifier32.c
|
|
||||||
EXTRA_DIST += util/grub-module-verifier64.c
|
|
||||||
EXTRA_DIST += util/grub-module-verifierXX.c
|
|
||||||
EXTRA_DIST += util/grub-pe2elf.c
|
EXTRA_DIST += util/grub-pe2elf.c
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST += m4/gnulib-cache.m4
|
EXTRA_DIST += m4/gnulib-cache.m4
|
||||||
EXTRA_DIST += m4/glibc2.m4
|
EXTRA_DIST += m4/glibc2.m4
|
||||||
EXTRA_DIST += m4/gnulib-tool.m4
|
EXTRA_DIST += m4/gnulib-tool.m4
|
||||||
|
|||||||
+63
-93
@@ -31,7 +31,7 @@ dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
|
|||||||
dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
|
dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
|
||||||
dnl used for the target type. See INSTALL for full list of variables.
|
dnl used for the target type. See INSTALL for full list of variables.
|
||||||
|
|
||||||
AC_INIT([GRUB],[2.02~beta3],[bug-grub@gnu.org])
|
AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ AC_PROG_LN_S
|
|||||||
if test "x$LEX" = "x:"; then
|
if test "x$LEX" = "x:"; then
|
||||||
AC_MSG_ERROR([flex is not found])
|
AC_MSG_ERROR([flex is not found])
|
||||||
else
|
else
|
||||||
version=`$LEX --version | $AWK '{ split($2,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
||||||
if test -n "$version" -a "$version" -ge 20535; then
|
if test -n "$version" -a "$version" -ge 20535; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
@@ -783,7 +783,7 @@ fi
|
|||||||
if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
|
if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
|
||||||
# Some toolchains enable these features by default, but they need
|
# Some toolchains enable these features by default, but they need
|
||||||
# registers that aren't set up properly in GRUB.
|
# registers that aren't set up properly in GRUB.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# GRUB doesn't use float or doubles at all. Yet some toolchains may decide
|
# GRUB doesn't use float or doubles at all. Yet some toolchains may decide
|
||||||
@@ -910,24 +910,12 @@ if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xy
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether -mno-stack-arg-probe works], [grub_cv_cc_mno_stack_arg_probe], [
|
|
||||||
CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_mno_stack_arg_probe=yes],
|
|
||||||
[grub_cv_cc_mno_stack_arg_probe=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
||||||
# information in some cases where it previously did not. GRUB doesn't need
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
# these and they just use up vital space. Restore the old compiler
|
# these and they just use up vital space. Restore the old compiler
|
||||||
# behaviour.
|
# behaviour.
|
||||||
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
||||||
CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
||||||
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
||||||
@@ -937,17 +925,66 @@ if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether -fno-unwind-tables works], [grub_cv_cc_fno_unwind_tables], [
|
AC_ARG_ENABLE([efiemu],
|
||||||
CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
|
[AS_HELP_STRING([--enable-efiemu],
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
[build and install the efiemu runtimes (default=guessed)])])
|
||||||
[grub_cv_cc_fno_unwind_tables=yes],
|
if test x"$enable_efiemu" = xno ; then
|
||||||
[grub_cv_cc_fno_unwind_tables=no])
|
efiemu_excuse="explicitly disabled"
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
|
|
||||||
fi
|
fi
|
||||||
|
if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
|
||||||
|
efiemu_excuse="not available on cygwin"
|
||||||
|
fi
|
||||||
|
if test x"$target_cpu" != xi386 ; then
|
||||||
|
efiemu_excuse="only available on i386"
|
||||||
|
fi
|
||||||
|
if test x"$platform" = xefi ; then
|
||||||
|
efiemu_excuse="not available on efi"
|
||||||
|
fi
|
||||||
|
if test x"$efiemu_excuse" = x ; then
|
||||||
|
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||||
|
CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_efiemu=yes],
|
||||||
|
[grub_cv_cc_efiemu=no])
|
||||||
|
])
|
||||||
|
if test x$grub_cv_cc_efiemu = xno; then
|
||||||
|
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test x"$efiemu_excuse" = x ; then
|
||||||
|
AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
|
||||||
|
grub_cv_target_cc_efiemu64_link_format=unknown
|
||||||
|
for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
|
||||||
|
CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
|
||||||
|
LDFLAGS="-m64 -Wl,$format -nostdlib -static"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
asm (".globl start; start:");
|
||||||
|
asm (".globl _start; _start:");
|
||||||
|
asm (".globl __start; __start:");
|
||||||
|
void __main (void);
|
||||||
|
void __main (void) {}
|
||||||
|
]], [[]])], [flag=1], [flag=0])
|
||||||
|
if test x"$flag" = x1; then
|
||||||
|
grub_cv_target_cc_efiemu64_link_format="$format"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done])
|
||||||
|
if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
|
||||||
|
efiemu_excuse="no suitable link format for efiemu64 found"
|
||||||
|
else
|
||||||
|
EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||||
|
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
|
||||||
|
fi
|
||||||
|
if test x"$efiemu_excuse" = x ; then
|
||||||
|
enable_efiemu=yes
|
||||||
|
else
|
||||||
|
enable_efiemu=no
|
||||||
|
fi
|
||||||
|
AC_SUBST([enable_efiemu])
|
||||||
|
AC_SUBST([EFIEMU64_LINK_FORMAT])
|
||||||
|
|
||||||
CFLAGS="$TARGET_CFLAGS"
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
@@ -1041,73 +1078,6 @@ else
|
|||||||
TARGET_IMG_CFLAGS=
|
TARGET_IMG_CFLAGS=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS="$TARGET_CFLAGS"
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([efiemu],
|
|
||||||
[AS_HELP_STRING([--enable-efiemu],
|
|
||||||
[build and install the efiemu runtimes (default=guessed)])])
|
|
||||||
if test x"$enable_efiemu" = xno ; then
|
|
||||||
efiemu_excuse="explicitly disabled"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
|
|
||||||
efiemu_excuse="not available on cygwin"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" != xi386 ; then
|
|
||||||
efiemu_excuse="only available on i386"
|
|
||||||
fi
|
|
||||||
if test x"$platform" = xefi ; then
|
|
||||||
efiemu_excuse="not available on efi"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$efiemu_excuse" = x ; then
|
|
||||||
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
|
||||||
CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_efiemu=yes],
|
|
||||||
[grub_cv_cc_efiemu=no])
|
|
||||||
])
|
|
||||||
if test x$grub_cv_cc_efiemu = xno; then
|
|
||||||
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test x"$efiemu_excuse" = x ; then
|
|
||||||
AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
|
|
||||||
grub_cv_target_cc_efiemu64_link_format=unknown
|
|
||||||
for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
|
|
||||||
CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
|
|
||||||
LDFLAGS="-m64 -Wl,$format -nostdlib -static"
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
asm (".globl start; start:");
|
|
||||||
asm (".globl _start; _start:");
|
|
||||||
asm (".globl __start; __start:");
|
|
||||||
void __main (void);
|
|
||||||
void __main (void) {}
|
|
||||||
]], [[]])], [flag=1], [flag=0])
|
|
||||||
if test x"$flag" = x1; then
|
|
||||||
grub_cv_target_cc_efiemu64_link_format="$format"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done])
|
|
||||||
if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
|
|
||||||
efiemu_excuse="no suitable link format for efiemu64 found"
|
|
||||||
else
|
|
||||||
EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
|
||||||
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
|
|
||||||
fi
|
|
||||||
if test x"$efiemu_excuse" = x ; then
|
|
||||||
enable_efiemu=yes
|
|
||||||
else
|
|
||||||
enable_efiemu=no
|
|
||||||
fi
|
|
||||||
AC_SUBST([enable_efiemu])
|
|
||||||
AC_SUBST([EFIEMU64_LINK_FORMAT])
|
|
||||||
|
|
||||||
CFLAGS="$TARGET_CFLAGS"
|
|
||||||
|
|
||||||
AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-93
@@ -2538,8 +2538,6 @@ team are:
|
|||||||
85:3
|
85:3
|
||||||
@item Asus EeePC 1005PE
|
@item Asus EeePC 1005PE
|
||||||
84:1 (unconfirmed)
|
84:1 (unconfirmed)
|
||||||
@item LENOVO ThinkPad T410s (2912W1C)
|
|
||||||
101:3
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
To take full advantage of this function, install GRUB into the MBR
|
To take full advantage of this function, install GRUB into the MBR
|
||||||
@@ -3040,8 +3038,6 @@ These variables have special meaning to GRUB.
|
|||||||
* cmdpath::
|
* cmdpath::
|
||||||
* color_highlight::
|
* color_highlight::
|
||||||
* color_normal::
|
* color_normal::
|
||||||
* config_directory::
|
|
||||||
* config_file::
|
|
||||||
* debug::
|
* debug::
|
||||||
* default::
|
* default::
|
||||||
* fallback::
|
* fallback::
|
||||||
@@ -3184,22 +3180,6 @@ matching colors of first half.
|
|||||||
to support whole rgb24 palette but currently there is no compelling reason
|
to support whole rgb24 palette but currently there is no compelling reason
|
||||||
to go beyond the current 16 colors.
|
to go beyond the current 16 colors.
|
||||||
|
|
||||||
|
|
||||||
@node config_directory
|
|
||||||
@subsection config_directory
|
|
||||||
|
|
||||||
This variable is automatically set by GRUB to the directory part of
|
|
||||||
current configuration file name (@pxref{config_file}).
|
|
||||||
|
|
||||||
|
|
||||||
@node config_file
|
|
||||||
@subsection config_file
|
|
||||||
|
|
||||||
This variable is automatically set by GRUB to the name of configuration file that is being
|
|
||||||
processed by commands @command{configfile} (@pxref{configfile}) or @command{normal}
|
|
||||||
(@pxref{normal}). It is restored to the previous value when command completes.
|
|
||||||
|
|
||||||
|
|
||||||
@node debug
|
@node debug
|
||||||
@subsection debug
|
@subsection debug
|
||||||
|
|
||||||
@@ -3859,11 +3839,6 @@ you forget a command, you can run the command @command{help}
|
|||||||
@comment * vbeinfo:: List available video modes
|
@comment * vbeinfo:: List available video modes
|
||||||
* verify_detached:: Verify detached digital signature
|
* verify_detached:: Verify detached digital signature
|
||||||
* videoinfo:: List available video modes
|
* videoinfo:: List available video modes
|
||||||
@comment * xen_*:: Xen boot commands
|
|
||||||
* xen_hypervisor:: Load xen hypervisor binary
|
|
||||||
* xen_linux:: Load dom0 kernel for xen hypervisor
|
|
||||||
* xen_initrd:: Load dom0 initrd for dom0 kernel
|
|
||||||
* xen_xsm:: Load xen security module for xen hypervisor
|
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
@@ -4075,15 +4050,12 @@ after @command{configfile} returns.
|
|||||||
@node cpuid
|
@node cpuid
|
||||||
@subsection cpuid
|
@subsection cpuid
|
||||||
|
|
||||||
@deffn Command cpuid [-l] [-p]
|
@deffn Command cpuid [-l]
|
||||||
Check for CPU features. This command is only available on x86 systems.
|
Check for CPU features. This command is only available on x86 systems.
|
||||||
|
|
||||||
With the @option{-l} option, return true if the CPU supports long mode
|
With the @option{-l} option, return true if the CPU supports long mode
|
||||||
(64-bit).
|
(64-bit).
|
||||||
|
|
||||||
With the @option{-p} option, return true if the CPU supports Physical
|
|
||||||
Address Extension (PAE).
|
|
||||||
|
|
||||||
If invoked without options, this command currently behaves as if it had been
|
If invoked without options, this command currently behaves as if it had been
|
||||||
invoked with @option{-l}. This may change in the future.
|
invoked with @option{-l}. This may change in the future.
|
||||||
@end deffn
|
@end deffn
|
||||||
@@ -5047,8 +5019,6 @@ the length of @var{string} is zero
|
|||||||
@var{expression} is false
|
@var{expression} is false
|
||||||
@item @var{expression1} @code{-a} @var{expression2}
|
@item @var{expression1} @code{-a} @var{expression2}
|
||||||
both @var{expression1} and @var{expression2} are true
|
both @var{expression1} and @var{expression2} are true
|
||||||
@item @var{expression1} @var{expression2}
|
|
||||||
both @var{expression1} and @var{expression2} are true. This syntax is not POSIX-compliant and is not recommended.
|
|
||||||
@item @var{expression1} @code{-o} @var{expression2}
|
@item @var{expression1} @code{-o} @var{expression2}
|
||||||
either @var{expression1} or @var{expression2} is true
|
either @var{expression1} or @var{expression2} is true
|
||||||
@end table
|
@end table
|
||||||
@@ -5132,39 +5102,6 @@ successfully. If validation fails, it is set to a non-zero value.
|
|||||||
List available video modes. If resolution is given, show only matching modes.
|
List available video modes. If resolution is given, show only matching modes.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@node xen_hypervisor
|
|
||||||
@subsection xen_hypervisor
|
|
||||||
|
|
||||||
@deffn Command xen_hypervisor file [arguments] @dots{}
|
|
||||||
Load a Xen hypervisor binary from @var{file}. The rest of the line is passed
|
|
||||||
verbatim as the @dfn{kernel command-line}. Any other binaries must be
|
|
||||||
reloaded after using this command.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node xen_linux
|
|
||||||
@subsection xen_linux
|
|
||||||
|
|
||||||
@deffn Command xen_linux file [arguments]
|
|
||||||
Load a dom0 kernel image for xen hypervisor at the booting process of xen.
|
|
||||||
The rest of the line is passed verbatim as the module command line.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node xen_initrd
|
|
||||||
@subsection xen_initrd
|
|
||||||
|
|
||||||
@deffn Command xen_initrd file
|
|
||||||
Load a initrd image for dom0 kernel at the booting process of xen.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node xen_xsm
|
|
||||||
@subsection xen_xsm
|
|
||||||
|
|
||||||
@deffn Command xen_xsm file
|
|
||||||
Load a xen security module for xen hypervisor at the booting process of xen.
|
|
||||||
See @uref{http://wiki.xen.org/wiki/XSM} for more detail.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
|
|
||||||
@node Networking commands
|
@node Networking commands
|
||||||
@section The list of networking commands
|
@section The list of networking commands
|
||||||
|
|
||||||
@@ -5676,16 +5613,6 @@ BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
|
|||||||
limitations mips-loongson (with Linux protocol)
|
limitations mips-loongson (with Linux protocol)
|
||||||
and mips-qemu_mips can use only memory up to first hole.
|
and mips-qemu_mips can use only memory up to first hole.
|
||||||
|
|
||||||
Bootlocation is ability of GRUB to automatically detect where it boots from.
|
|
||||||
``disk'' means the detection is limited to detecting the disk with partition
|
|
||||||
being discovered on install time. ``partition'' means that disk and partiton
|
|
||||||
can be automatically discovered. ``file'' means that boot image file name as
|
|
||||||
well as disk and partition can be discovered. For consistency default install ignores
|
|
||||||
partition and relies solely on disk detection. If no bootlocation discovery is available
|
|
||||||
or boot and grub-root disks are different, UUID is used instead. On ARC if no device
|
|
||||||
to install to is specified, UUID is used instead as well.
|
|
||||||
|
|
||||||
|
|
||||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||||
@item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
|
@item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
|
||||||
@item video @tab yes @tab yes @tab yes @tab yes
|
@item video @tab yes @tab yes @tab yes @tab yes
|
||||||
@@ -5702,7 +5629,6 @@ to install to is specified, UUID is used instead as well.
|
|||||||
@item badram @tab yes @tab yes @tab yes @tab yes
|
@item badram @tab yes @tab yes @tab yes @tab yes
|
||||||
@item compression @tab always @tab pointless @tab no @tab no
|
@item compression @tab always @tab pointless @tab no @tab no
|
||||||
@item exit @tab yes @tab no @tab no @tab no
|
@item exit @tab yes @tab no @tab no @tab no
|
||||||
@item bootlocation @tab disk @tab no @tab no @tab no
|
|
||||||
@end multitable
|
@end multitable
|
||||||
|
|
||||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||||
@@ -5721,7 +5647,6 @@ to install to is specified, UUID is used instead as well.
|
|||||||
@item badram @tab yes @tab yes @tab no @tab yes
|
@item badram @tab yes @tab yes @tab no @tab yes
|
||||||
@item compression @tab no @tab no @tab no @tab no
|
@item compression @tab no @tab no @tab no @tab no
|
||||||
@item exit @tab yes @tab yes @tab yes @tab yes
|
@item exit @tab yes @tab yes @tab yes @tab yes
|
||||||
@item bootlocation @tab file @tab file @tab file, ignored @tab file
|
|
||||||
@end multitable
|
@end multitable
|
||||||
|
|
||||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||||
@@ -5740,26 +5665,24 @@ to install to is specified, UUID is used instead as well.
|
|||||||
@item badram @tab yes (*) @tab no @tab no @tab no
|
@item badram @tab yes (*) @tab no @tab no @tab no
|
||||||
@item compression @tab configurable @tab no @tab no @tab configurable
|
@item compression @tab configurable @tab no @tab no @tab configurable
|
||||||
@item exit @tab no @tab yes @tab yes @tab yes
|
@item exit @tab no @tab yes @tab yes @tab yes
|
||||||
@item bootlocation @tab no @tab partition @tab file @tab file (*)
|
|
||||||
@end multitable
|
@end multitable
|
||||||
|
|
||||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||||
@item @tab MIPS qemu @tab emu @tab xen
|
@item @tab MIPS qemu @tab emu
|
||||||
@item video @tab no @tab yes @tab no
|
@item video @tab no @tab yes
|
||||||
@item console charset @tab CP437 @tab Unicode (*) @tab ASCII
|
@item console charset @tab CP437 @tab Unicode (*)
|
||||||
@item network @tab no @tab yes @tab no
|
@item network @tab no @tab yes
|
||||||
@item ATA/AHCI @tab yes @tab no @tab no
|
@item ATA/AHCI @tab yes @tab no
|
||||||
@item AT keyboard @tab yes @tab no @tab no
|
@item AT keyboard @tab yes @tab no
|
||||||
@item Speaker @tab no @tab no @tab no
|
@item Speaker @tab no @tab no
|
||||||
@item USB @tab N/A @tab yes @tab no
|
@item USB @tab N/A @tab yes
|
||||||
@item chainloader @tab yes @tab no @tab yes
|
@item chainloader @tab yes @tab no
|
||||||
@item cpuid @tab no @tab no @tab yes
|
@item cpuid @tab no @tab no
|
||||||
@item hints @tab guess @tab no @tab no
|
@item hints @tab guess @tab no
|
||||||
@item PCI @tab no @tab no @tab no
|
@item PCI @tab no @tab no
|
||||||
@item badram @tab yes (*) @tab no @tab no
|
@item badram @tab yes (*) @tab no
|
||||||
@item compression @tab configurable @tab no @tab no
|
@item compression @tab configurable @tab no
|
||||||
@item exit @tab no @tab yes @tab no
|
@item exit @tab no @tab yes
|
||||||
@item bootlocation @tab no @tab file @tab no
|
|
||||||
@end multitable
|
@end multitable
|
||||||
|
|
||||||
@node Platform-specific operations
|
@node Platform-specific operations
|
||||||
|
|||||||
@@ -729,11 +729,9 @@ def kernel(defn, platform):
|
|||||||
"""if test x$(TARGET_APPLE_LINKER) = x1; then \
|
"""if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||||
$(TARGET_STRIP) -S -x $(""" + cname(defn) + """) -o $@.bin $<; \
|
$(TARGET_STRIP) -S -x $(""" + cname(defn) + """) -o $@.bin $<; \
|
||||||
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -ed2016 -wd1106 -nu -nd $@.bin $@; \
|
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -ed2016 -wd1106 -nu -nd $@.bin $@; \
|
||||||
rm -f $@.bin; \
|
|
||||||
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
|
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
|
||||||
""" + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@.bin $< && \
|
""" + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@.bin $< && \
|
||||||
$(TARGET_OBJ2ELF) $@.bin $@ || (rm -f $@; rm -f $@.bin; exit 1); \
|
$(TARGET_OBJ2ELF) $@.bin $@ || (rm -f $@; rm -f $@.bin; exit 1); \
|
||||||
rm -f $@.bin; \
|
|
||||||
else """ + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@ $<; \
|
else """ + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@ $<; \
|
||||||
fi"""))
|
fi"""))
|
||||||
|
|
||||||
@@ -761,7 +759,7 @@ def image(defn, platform):
|
|||||||
if test x$(TARGET_APPLE_LINKER) = x1; then \
|
if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||||
$(MACHO2IMG) $< $@; \
|
$(MACHO2IMG) $< $@; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \
|
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \
|
||||||
fi
|
fi
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|||||||
+1
-14
@@ -39,10 +39,6 @@ gentrigtables$(BUILD_EXEEXT): gentrigtables.c
|
|||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
|
||||||
CLEANFILES += gentrigtables$(BUILD_EXEEXT)
|
CLEANFILES += gentrigtables$(BUILD_EXEEXT)
|
||||||
|
|
||||||
build-grub-module-verifier$(BUILD_EXEEXT): $(top_srcdir)/util/grub-module-verifier.c $(top_srcdir)/util/grub-module-verifier32.c $(top_srcdir)/util/grub-module-verifier64.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-module-verifier\" $^
|
|
||||||
CLEANFILES += build-grub-module-verifier$(BUILD_EXEEXT)
|
|
||||||
|
|
||||||
# trigtables.c
|
# trigtables.c
|
||||||
trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
|
trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
|
||||||
./gentrigtables$(BUILD_EXEEXT) > $@
|
./gentrigtables$(BUILD_EXEEXT) > $@
|
||||||
@@ -105,9 +101,7 @@ if COND_i386_efi
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_coreboot
|
if COND_i386_coreboot
|
||||||
@@ -118,12 +112,10 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_multiboot
|
if COND_i386_multiboot
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_qemu
|
if COND_i386_qemu
|
||||||
@@ -162,14 +154,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_ia64_efi
|
if COND_ia64_efi
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_mips
|
if COND_mips
|
||||||
@@ -244,13 +233,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_arm64_efi
|
if COND_arm64_efi
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_emu
|
if COND_emu
|
||||||
@@ -396,7 +383,7 @@ moddep.lst: syminfo.lst genmoddep.awk video.lst
|
|||||||
platform_DATA += moddep.lst
|
platform_DATA += moddep.lst
|
||||||
CLEANFILES += config.log syminfo.lst moddep.lst
|
CLEANFILES += config.log syminfo.lst moddep.lst
|
||||||
|
|
||||||
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT)
|
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
|
||||||
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
|
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
|
||||||
platform_DATA += $(MOD_FILES)
|
platform_DATA += $(MOD_FILES)
|
||||||
platform_DATA += modinfo.sh
|
platform_DATA += modinfo.sh
|
||||||
|
|||||||
+18
-45
@@ -59,6 +59,9 @@ kernel = {
|
|||||||
ia64_efi_ldflags = '-Wl,-r,-d';
|
ia64_efi_ldflags = '-Wl,-r,-d';
|
||||||
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
|
x86_64_xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
i386_xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
arm_efi_ldflags = '-Wl,-r,-d';
|
arm_efi_ldflags = '-Wl,-r,-d';
|
||||||
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
@@ -90,7 +93,7 @@ kernel = {
|
|||||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||||
emu_cflags = '$(CFLAGS_GNULIB)';
|
emu_cflags = '$(CFLAGS_GNULIB)';
|
||||||
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
||||||
arm_uboot_ldflags = '-Wl,-r,-d';
|
arm_uboot_ldflags = '-Wl,-Ttext=0x08000000';
|
||||||
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
i386_pc_startup = kern/i386/pc/startup.S;
|
i386_pc_startup = kern/i386/pc/startup.S;
|
||||||
@@ -171,20 +174,8 @@ kernel = {
|
|||||||
efi = kern/efi/init.c;
|
efi = kern/efi/init.c;
|
||||||
efi = kern/efi/mm.c;
|
efi = kern/efi/mm.c;
|
||||||
efi = term/efi/console.c;
|
efi = term/efi/console.c;
|
||||||
efi = kern/acpi.c;
|
|
||||||
efi = kern/efi/acpi.c;
|
|
||||||
i386_coreboot = kern/i386/pc/acpi.c;
|
|
||||||
i386_multiboot = kern/i386/pc/acpi.c;
|
|
||||||
i386_coreboot = kern/acpi.c;
|
|
||||||
i386_multiboot = kern/acpi.c;
|
|
||||||
|
|
||||||
x86 = kern/i386/tsc.c;
|
x86 = kern/i386/tsc.c;
|
||||||
x86 = kern/i386/tsc_pit.c;
|
|
||||||
i386_efi = kern/i386/efi/tsc.c;
|
|
||||||
x86_64_efi = kern/i386/efi/tsc.c;
|
|
||||||
i386_efi = kern/i386/tsc_pmtimer.c;
|
|
||||||
i386_coreboot = kern/i386/tsc_pmtimer.c;
|
|
||||||
x86_64_efi = kern/i386/tsc_pmtimer.c;
|
|
||||||
|
|
||||||
i386_efi = kern/i386/efi/init.c;
|
i386_efi = kern/i386/efi/init.c;
|
||||||
i386_efi = bus/pci.c;
|
i386_efi = bus/pci.c;
|
||||||
@@ -196,7 +187,6 @@ kernel = {
|
|||||||
x86_64_efi = bus/pci.c;
|
x86_64_efi = bus/pci.c;
|
||||||
|
|
||||||
xen = kern/i386/tsc.c;
|
xen = kern/i386/tsc.c;
|
||||||
xen = kern/i386/xen/tsc.c;
|
|
||||||
x86_64_xen = kern/x86_64/xen/hypercall.S;
|
x86_64_xen = kern/x86_64/xen/hypercall.S;
|
||||||
i386_xen = kern/i386/xen/hypercall.S;
|
i386_xen = kern/i386/xen/hypercall.S;
|
||||||
xen = kern/xen/init.c;
|
xen = kern/xen/init.c;
|
||||||
@@ -213,7 +203,7 @@ kernel = {
|
|||||||
arm_efi = kern/arm/efi/init.c;
|
arm_efi = kern/arm/efi/init.c;
|
||||||
arm_efi = kern/arm/efi/misc.c;
|
arm_efi = kern/arm/efi/misc.c;
|
||||||
|
|
||||||
arm64_efi = kern/arm64/efi/init.c;
|
arm64_efi = kern/arm/efi/init.c;
|
||||||
|
|
||||||
i386_pc = kern/i386/pc/init.c;
|
i386_pc = kern/i386/pc/init.c;
|
||||||
i386_pc = kern/i386/pc/mmap.c;
|
i386_pc = kern/i386/pc/mmap.c;
|
||||||
@@ -614,6 +604,7 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = lsxen;
|
name = lsxen;
|
||||||
common = commands/xen/lsxen.c;
|
common = commands/xen/lsxen.c;
|
||||||
|
cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
enable = xen;
|
enable = xen;
|
||||||
};
|
};
|
||||||
@@ -678,8 +669,10 @@ module = {
|
|||||||
name = acpi;
|
name = acpi;
|
||||||
|
|
||||||
common = commands/acpi.c;
|
common = commands/acpi.c;
|
||||||
i386_pc = kern/acpi.c;
|
efi = commands/efi/acpi.c;
|
||||||
i386_pc = kern/i386/pc/acpi.c;
|
i386_pc = commands/i386/pc/acpi.c;
|
||||||
|
i386_coreboot = commands/i386/pc/acpi.c;
|
||||||
|
i386_multiboot = commands/i386/pc/acpi.c;
|
||||||
|
|
||||||
enable = efi;
|
enable = efi;
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
@@ -832,6 +825,7 @@ module = {
|
|||||||
i386_coreboot = lib/i386/halt.c;
|
i386_coreboot = lib/i386/halt.c;
|
||||||
i386_qemu = lib/i386/halt.c;
|
i386_qemu = lib/i386/halt.c;
|
||||||
xen = lib/xen/halt.c;
|
xen = lib/xen/halt.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
efi = lib/efi/halt.c;
|
efi = lib/efi/halt.c;
|
||||||
ieee1275 = lib/ieee1275/halt.c;
|
ieee1275 = lib/ieee1275/halt.c;
|
||||||
emu = lib/emu/halt.c;
|
emu = lib/emu/halt.c;
|
||||||
@@ -852,6 +846,7 @@ module = {
|
|||||||
mips_loongson = lib/mips/loongson/reboot.c;
|
mips_loongson = lib/mips/loongson/reboot.c;
|
||||||
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
|
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
|
||||||
xen = lib/xen/reboot.c;
|
xen = lib/xen/reboot.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
uboot = lib/uboot/reboot.c;
|
uboot = lib/uboot/reboot.c;
|
||||||
common = commands/reboot.c;
|
common = commands/reboot.c;
|
||||||
};
|
};
|
||||||
@@ -1531,6 +1526,7 @@ module = {
|
|||||||
i386_xen = lib/i386/xen/relocator.S;
|
i386_xen = lib/i386/xen/relocator.S;
|
||||||
x86_64_xen = lib/x86_64/xen/relocator.S;
|
x86_64_xen = lib/x86_64/xen/relocator.S;
|
||||||
xen = lib/i386/relocator_common_c.c;
|
xen = lib/i386/relocator_common_c.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
extra_dist = lib/i386/relocator_common.S;
|
extra_dist = lib/i386/relocator_common.S;
|
||||||
extra_dist = kern/powerpc/cache_flush.S;
|
extra_dist = kern/powerpc/cache_flush.S;
|
||||||
@@ -1551,6 +1547,7 @@ module = {
|
|||||||
sparc64_ieee1275 = lib/ieee1275/cmos.c;
|
sparc64_ieee1275 = lib/ieee1275/cmos.c;
|
||||||
powerpc_ieee1275 = lib/ieee1275/cmos.c;
|
powerpc_ieee1275 = lib/ieee1275/cmos.c;
|
||||||
xen = lib/xen/datetime.c;
|
xen = lib/xen/datetime.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
mips_arc = lib/arc/datetime.c;
|
mips_arc = lib/arc/datetime.c;
|
||||||
enable = noemu;
|
enable = noemu;
|
||||||
@@ -1660,6 +1657,7 @@ module = {
|
|||||||
name = linux;
|
name = linux;
|
||||||
x86 = loader/i386/linux.c;
|
x86 = loader/i386/linux.c;
|
||||||
xen = loader/i386/xen.c;
|
xen = loader/i386/xen.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
||||||
mips = loader/mips/linux.c;
|
mips = loader/mips/linux.c;
|
||||||
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
||||||
@@ -1667,6 +1665,7 @@ module = {
|
|||||||
ia64_efi = loader/ia64/efi/linux.c;
|
ia64_efi = loader/ia64/efi/linux.c;
|
||||||
arm = loader/arm/linux.c;
|
arm = loader/arm/linux.c;
|
||||||
arm64 = loader/arm64/linux.c;
|
arm64 = loader/arm64/linux.c;
|
||||||
|
fdt = lib/fdt.c;
|
||||||
common = loader/linux.c;
|
common = loader/linux.c;
|
||||||
common = lib/cmdline.c;
|
common = lib/cmdline.c;
|
||||||
enable = noemu;
|
enable = noemu;
|
||||||
@@ -1675,8 +1674,7 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = fdt;
|
name = fdt;
|
||||||
arm64 = loader/arm64/fdt.c;
|
arm64 = loader/arm64/fdt.c;
|
||||||
common = lib/fdt.c;
|
enable = arm64;
|
||||||
enable = fdt;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@@ -1685,32 +1683,7 @@ module = {
|
|||||||
x86 = loader/i386/xnu.c;
|
x86 = loader/i386/xnu.c;
|
||||||
x86 = loader/xnu.c;
|
x86 = loader/xnu.c;
|
||||||
|
|
||||||
/* Code is pretty generic but relies on RNG which
|
enable = x86;
|
||||||
is available only on few platforms. It's not a
|
|
||||||
big deal as xnu needs ACPI anyway and we have
|
|
||||||
RNG on all platforms with ACPI.
|
|
||||||
*/
|
|
||||||
enable = i386_multiboot;
|
|
||||||
enable = i386_coreboot;
|
|
||||||
enable = i386_pc;
|
|
||||||
enable = i386_efi;
|
|
||||||
enable = x86_64_efi;
|
|
||||||
};
|
|
||||||
|
|
||||||
module = {
|
|
||||||
name = random;
|
|
||||||
x86 = lib/i386/random.c;
|
|
||||||
common = lib/random.c;
|
|
||||||
|
|
||||||
i386_multiboot = kern/i386/tsc_pmtimer.c;
|
|
||||||
i386_coreboot = kern/i386/tsc_pmtimer.c;
|
|
||||||
i386_pc = kern/i386/tsc_pmtimer.c;
|
|
||||||
|
|
||||||
enable = i386_multiboot;
|
|
||||||
enable = i386_coreboot;
|
|
||||||
enable = i386_pc;
|
|
||||||
enable = i386_efi;
|
|
||||||
enable = x86_64_efi;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
|
|||||||
+11
-60
@@ -29,7 +29,6 @@
|
|||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/cs5536.h>
|
#include <grub/cs5536.h>
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/cache.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
@@ -338,21 +337,6 @@ struct grub_ehci
|
|||||||
|
|
||||||
static struct grub_ehci *ehci;
|
static struct grub_ehci *ehci;
|
||||||
|
|
||||||
static void
|
|
||||||
sync_all_caches (struct grub_ehci *e)
|
|
||||||
{
|
|
||||||
if (!e)
|
|
||||||
return;
|
|
||||||
if (e->td_virt)
|
|
||||||
grub_arch_sync_dma_caches (e->td_virt, sizeof (struct grub_ehci_td) *
|
|
||||||
GRUB_EHCI_N_TD);
|
|
||||||
if (e->qh_virt)
|
|
||||||
grub_arch_sync_dma_caches (e->qh_virt, sizeof (struct grub_ehci_qh) *
|
|
||||||
GRUB_EHCI_N_QH);
|
|
||||||
if (e->framelist_virt)
|
|
||||||
grub_arch_sync_dma_caches (e->framelist_virt, 4096);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EHCC registers access functions */
|
/* EHCC registers access functions */
|
||||||
static inline grub_uint32_t
|
static inline grub_uint32_t
|
||||||
grub_ehci_ehcc_read32 (struct grub_ehci *e, grub_uint32_t addr)
|
grub_ehci_ehcc_read32 (struct grub_ehci *e, grub_uint32_t addr)
|
||||||
@@ -453,8 +437,6 @@ grub_ehci_reset (struct grub_ehci *e)
|
|||||||
{
|
{
|
||||||
grub_uint64_t maxtime;
|
grub_uint64_t maxtime;
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
|
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
|
||||||
GRUB_EHCI_CMD_HC_RESET
|
GRUB_EHCI_CMD_HC_RESET
|
||||||
| grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND));
|
| grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND));
|
||||||
@@ -858,8 +840,6 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
|||||||
e->next = ehci;
|
e->next = ehci;
|
||||||
ehci = e;
|
ehci = e;
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: OK at all\n");
|
grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: OK at all\n");
|
||||||
|
|
||||||
grub_dprintf ("ehci",
|
grub_dprintf ("ehci",
|
||||||
@@ -1040,7 +1020,6 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
|
|||||||
/* Found proper existing (and linked) QH, do setup of QH */
|
/* Found proper existing (and linked) QH, do setup of QH */
|
||||||
grub_dprintf ("ehci", "find_qh: found, QH=%p\n", qh_iter);
|
grub_dprintf ("ehci", "find_qh: found, QH=%p\n", qh_iter);
|
||||||
grub_ehci_setup_qh (qh_iter, transfer);
|
grub_ehci_setup_qh (qh_iter, transfer);
|
||||||
sync_all_caches (e);
|
|
||||||
return qh_iter;
|
return qh_iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1142,7 +1121,7 @@ grub_ehci_free_tds (struct grub_ehci *e, grub_ehci_td_t td,
|
|||||||
token = grub_le_to_cpu32 (td->token);
|
token = grub_le_to_cpu32 (td->token);
|
||||||
to_transfer = (token & GRUB_EHCI_TOTAL_MASK) >> GRUB_EHCI_TOTAL_OFF;
|
to_transfer = (token & GRUB_EHCI_TOTAL_MASK) >> GRUB_EHCI_TOTAL_OFF;
|
||||||
|
|
||||||
/* Check state of TD - if it did not transfer
|
/* Check state of TD - if it did not transfered
|
||||||
* whole data then set last_trans - it should be last executed TD
|
* whole data then set last_trans - it should be last executed TD
|
||||||
* in case when something went wrong. */
|
* in case when something went wrong. */
|
||||||
if (transfer && (td->size != to_transfer))
|
if (transfer && (td->size != to_transfer))
|
||||||
@@ -1310,28 +1289,16 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
|||||||
grub_ehci_td_t td_prev = NULL;
|
grub_ehci_td_t td_prev = NULL;
|
||||||
int i;
|
int i;
|
||||||
struct grub_ehci_transfer_controller_data *cdata;
|
struct grub_ehci_transfer_controller_data *cdata;
|
||||||
grub_uint32_t status;
|
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
/* Check if EHCI is running and AL is enabled */
|
/* Check if EHCI is running and AL is enabled */
|
||||||
status = grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS);
|
if ((grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS)
|
||||||
if ((status & GRUB_EHCI_ST_HC_HALTED) != 0)
|
& GRUB_EHCI_ST_HC_HALTED) != 0)
|
||||||
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
|
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
|
||||||
{
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
grub_dprintf ("ehci", "setup_transfer: halted, status = 0x%x\n",
|
if ((grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS)
|
||||||
status);
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
}
|
|
||||||
status = grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS);
|
|
||||||
if ((status
|
|
||||||
& (GRUB_EHCI_ST_AS_STATUS | GRUB_EHCI_ST_PS_STATUS)) == 0)
|
& (GRUB_EHCI_ST_AS_STATUS | GRUB_EHCI_ST_PS_STATUS)) == 0)
|
||||||
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
|
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
|
||||||
{
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
grub_dprintf ("ehci", "setup_transfer: no AS/PS, status = 0x%x\n",
|
|
||||||
status);
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for controller transfer data. */
|
/* Allocate memory for controller transfer data. */
|
||||||
cdata = grub_malloc (sizeof (*cdata));
|
cdata = grub_malloc (sizeof (*cdata));
|
||||||
@@ -1343,7 +1310,6 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
|||||||
cdata->qh_virt = grub_ehci_find_qh (e, transfer);
|
cdata->qh_virt = grub_ehci_find_qh (e, transfer);
|
||||||
if (!cdata->qh_virt)
|
if (!cdata->qh_virt)
|
||||||
{
|
{
|
||||||
grub_dprintf ("ehci", "setup_transfer: no QH\n");
|
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
@@ -1353,7 +1319,6 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
|||||||
cdata->td_alt_virt = grub_ehci_alloc_td (e);
|
cdata->td_alt_virt = grub_ehci_alloc_td (e);
|
||||||
if (!cdata->td_alt_virt)
|
if (!cdata->td_alt_virt)
|
||||||
{
|
{
|
||||||
grub_dprintf ("ehci", "setup_transfer: no TDs\n");
|
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
@@ -1380,7 +1345,6 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
|||||||
grub_ehci_free_tds (e, cdata->td_first_virt, NULL, &actual);
|
grub_ehci_free_tds (e, cdata->td_first_virt, NULL, &actual);
|
||||||
|
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
grub_dprintf ("ehci", "setup_transfer: no TD\n");
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1422,8 +1386,6 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
|||||||
* i.e. reset token */
|
* i.e. reset token */
|
||||||
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
|
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
/* Finito */
|
/* Finito */
|
||||||
transfer->controller_data = cdata;
|
transfer->controller_data = cdata;
|
||||||
|
|
||||||
@@ -1472,8 +1434,6 @@ grub_ehci_parse_notrun (grub_usb_controller_t dev,
|
|||||||
grub_ehci_free_td (e, cdata->td_alt_virt);
|
grub_ehci_free_td (e, cdata->td_alt_virt);
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
/* Additionally, do something with EHCI to make it running (what?) */
|
/* Additionally, do something with EHCI to make it running (what?) */
|
||||||
/* Try enable EHCI and AL */
|
/* Try enable EHCI and AL */
|
||||||
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
|
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
|
||||||
@@ -1509,8 +1469,6 @@ grub_ehci_parse_halt (grub_usb_controller_t dev,
|
|||||||
grub_ehci_free_td (e, cdata->td_alt_virt);
|
grub_ehci_free_td (e, cdata->td_alt_virt);
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
/* Evaluation of error code - currently we don't have GRUB USB error
|
/* Evaluation of error code - currently we don't have GRUB USB error
|
||||||
* codes for some EHCI states, GRUB_USB_ERR_DATA is used for them.
|
* codes for some EHCI states, GRUB_USB_ERR_DATA is used for them.
|
||||||
* Order of evaluation is critical, specially bubble/stall. */
|
* Order of evaluation is critical, specially bubble/stall. */
|
||||||
@@ -1544,8 +1502,6 @@ grub_ehci_parse_success (grub_usb_controller_t dev,
|
|||||||
grub_ehci_free_td (e, cdata->td_alt_virt);
|
grub_ehci_free_td (e, cdata->td_alt_virt);
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1559,8 +1515,6 @@ grub_ehci_check_transfer (grub_usb_controller_t dev,
|
|||||||
transfer->controller_data;
|
transfer->controller_data;
|
||||||
grub_uint32_t token, token_ftd;
|
grub_uint32_t token, token_ftd;
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
grub_dprintf ("ehci",
|
grub_dprintf ("ehci",
|
||||||
"check_transfer: EHCI STATUS=%08x, cdata=%p, qh=%p\n",
|
"check_transfer: EHCI STATUS=%08x, cdata=%p, qh=%p\n",
|
||||||
grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS),
|
grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS),
|
||||||
@@ -1627,9 +1581,6 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
|
|||||||
int i;
|
int i;
|
||||||
grub_uint64_t maxtime;
|
grub_uint64_t maxtime;
|
||||||
grub_uint32_t qh_phys;
|
grub_uint32_t qh_phys;
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
grub_uint32_t interrupt =
|
grub_uint32_t interrupt =
|
||||||
cdata->qh_virt->ep_cap & GRUB_EHCI_SMASK_MASK;
|
cdata->qh_virt->ep_cap & GRUB_EHCI_SMASK_MASK;
|
||||||
|
|
||||||
@@ -1649,7 +1600,6 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
|
|||||||
grub_ehci_free_tds (e, cdata->td_first_virt, transfer, &actual);
|
grub_ehci_free_tds (e, cdata->td_first_virt, transfer, &actual);
|
||||||
grub_ehci_free_td (e, cdata->td_alt_virt);
|
grub_ehci_free_td (e, cdata->td_alt_virt);
|
||||||
grub_free (cdata);
|
grub_free (cdata);
|
||||||
sync_all_caches (e);
|
|
||||||
grub_dprintf ("ehci", "cancel_transfer: end - EHCI not running\n");
|
grub_dprintf ("ehci", "cancel_transfer: end - EHCI not running\n");
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
@@ -1672,8 +1622,6 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
|
|||||||
/* Unlink QH from AL */
|
/* Unlink QH from AL */
|
||||||
e->qh_virt[i].qh_hptr = cdata->qh_virt->qh_hptr;
|
e->qh_virt[i].qh_hptr = cdata->qh_virt->qh_hptr;
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
/* If this is an interrupt transfer, we just wait for the periodic
|
/* If this is an interrupt transfer, we just wait for the periodic
|
||||||
* schedule to advance a few times and then assume that the EHCI
|
* schedule to advance a few times and then assume that the EHCI
|
||||||
* controller has read the updated QH. */
|
* controller has read the updated QH. */
|
||||||
@@ -1728,8 +1676,6 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
|
|||||||
|
|
||||||
grub_dprintf ("ehci", "cancel_transfer: end\n");
|
grub_dprintf ("ehci", "cancel_transfer: end\n");
|
||||||
|
|
||||||
sync_all_caches (e);
|
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1831,6 +1777,11 @@ grub_ehci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
|
|||||||
|
|
||||||
status = grub_ehci_port_read (e, port);
|
status = grub_ehci_port_read (e, port);
|
||||||
|
|
||||||
|
grub_dprintf ("ehci", "detect_dev: EHCI STATUS: %08x\n",
|
||||||
|
grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS));
|
||||||
|
grub_dprintf ("ehci", "detect_dev: iobase=%p, port=%d, status=0x%02x\n",
|
||||||
|
e->iobase, port, status);
|
||||||
|
|
||||||
/* Connect Status Change bit - it detects change of connection */
|
/* Connect Status Change bit - it detects change of connection */
|
||||||
if (status & GRUB_EHCI_PORT_CONNECT_CH)
|
if (status & GRUB_EHCI_PORT_CONNECT_CH)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbtrans.h>
|
#include <grub/usbtrans.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/cache.h>
|
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
@@ -102,8 +101,6 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||||||
data_addr = grub_dma_get_phys (data_chunk);
|
data_addr = grub_dma_get_phys (data_chunk);
|
||||||
grub_memcpy ((char *) data, data_in, size);
|
grub_memcpy ((char *) data, data_in, size);
|
||||||
|
|
||||||
grub_arch_sync_dma_caches (data, size);
|
|
||||||
|
|
||||||
grub_dprintf ("usb",
|
grub_dprintf ("usb",
|
||||||
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n",
|
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n",
|
||||||
reqtype, request, value, index, (unsigned long)size);
|
reqtype, request, value, index, (unsigned long)size);
|
||||||
@@ -164,8 +161,6 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||||||
setupdata->value = value;
|
setupdata->value = value;
|
||||||
setupdata->index = index;
|
setupdata->index = index;
|
||||||
setupdata->length = size;
|
setupdata->length = size;
|
||||||
grub_arch_sync_dma_caches (setupdata, sizeof (*setupdata));
|
|
||||||
|
|
||||||
transfer->transactions[0].size = sizeof (*setupdata);
|
transfer->transactions[0].size = sizeof (*setupdata);
|
||||||
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
||||||
transfer->transactions[0].data = setupdata_addr;
|
transfer->transactions[0].data = setupdata_addr;
|
||||||
@@ -207,13 +202,11 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
|
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
grub_dma_free (setupdata_chunk);
|
grub_dma_free (setupdata_chunk);
|
||||||
|
|
||||||
grub_arch_sync_dma_caches (data, size0);
|
|
||||||
grub_memcpy (data_in, (char *) data, size0);
|
grub_memcpy (data_in, (char *) data, size0);
|
||||||
|
|
||||||
grub_dma_free (data_chunk);
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,10 +236,7 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
|
|||||||
data = grub_dma_get_virt (data_chunk);
|
data = grub_dma_get_virt (data_chunk);
|
||||||
data_addr = grub_dma_get_phys (data_chunk);
|
data_addr = grub_dma_get_phys (data_chunk);
|
||||||
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
||||||
{
|
grub_memcpy ((char *) data, data_in, size);
|
||||||
grub_memcpy ((char *) data, data_in, size);
|
|
||||||
grub_arch_sync_dma_caches (data, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a transfer. */
|
/* Create a transfer. */
|
||||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
||||||
@@ -316,13 +306,9 @@ grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer)
|
|||||||
dev->toggle[transfer->endpoint] = toggle;
|
dev->toggle[transfer->endpoint] = toggle;
|
||||||
|
|
||||||
if (transfer->dir == GRUB_USB_TRANSFER_TYPE_IN)
|
if (transfer->dir == GRUB_USB_TRANSFER_TYPE_IN)
|
||||||
{
|
grub_memcpy (transfer->data, (void *)
|
||||||
grub_arch_sync_dma_caches (grub_dma_get_virt (transfer->data_chunk),
|
grub_dma_get_virt (transfer->data_chunk),
|
||||||
transfer->size + 1);
|
transfer->size + 1);
|
||||||
grub_memcpy (transfer->data, (void *)
|
|
||||||
grub_dma_get_virt (transfer->data_chunk),
|
|
||||||
transfer->size + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
grub_dma_free (transfer->data_chunk);
|
grub_dma_free (transfer->data_chunk);
|
||||||
|
|||||||
@@ -61,6 +61,18 @@ static const struct grub_arg_option options[] = {
|
|||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */
|
||||||
|
grub_uint8_t
|
||||||
|
grub_byte_checksum (void *base, grub_size_t size)
|
||||||
|
{
|
||||||
|
grub_uint8_t *ptr;
|
||||||
|
grub_uint8_t ret = 0;
|
||||||
|
for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size;
|
||||||
|
ptr++)
|
||||||
|
ret += *ptr;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* rev1 is 1 if ACPIv1 is to be generated, 0 otherwise.
|
/* rev1 is 1 if ACPIv1 is to be generated, 0 otherwise.
|
||||||
rev2 contains the revision of ACPIv2+ to generate or 0 if none. */
|
rev2 contains the revision of ACPIv2+ to generate or 0 if none. */
|
||||||
static int rev1, rev2;
|
static int rev1, rev2;
|
||||||
@@ -593,9 +605,6 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||||||
if (! table->addr)
|
if (! table->addr)
|
||||||
{
|
{
|
||||||
free_tables ();
|
free_tables ();
|
||||||
grub_free (exclude);
|
|
||||||
grub_free (load_only);
|
|
||||||
grub_free (table);
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
table->next = acpi_tables;
|
table->next = acpi_tables;
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#define grub_dprintf(cond, args...) printf ( args )
|
#define grub_dprintf(cond, args...) printf ( args )
|
||||||
#define grub_printf printf
|
#define grub_printf printf
|
||||||
#define grub_util_fopen fopen
|
|
||||||
#define grub_memcmp memcmp
|
|
||||||
typedef uint64_t grub_uint64_t;
|
typedef uint64_t grub_uint64_t;
|
||||||
typedef uint32_t grub_uint32_t;
|
typedef uint32_t grub_uint32_t;
|
||||||
typedef uint16_t grub_uint16_t;
|
typedef uint16_t grub_uint16_t;
|
||||||
@@ -248,7 +246,6 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
|||||||
if (!add)
|
if (!add)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD:
|
|
||||||
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
|
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
|
||||||
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -140,13 +140,10 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utcount)
|
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||||
{
|
for (j = 0; j < utcount; j++)
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
grub_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||||
for (j = 0; j < utcount; j++)
|
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||||
grub_printf ("<%x>", (unsigned int) utbuf[j]);
|
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_xputs ("\n");
|
grub_xputs ("\n");
|
||||||
grub_refresh ();
|
grub_refresh ();
|
||||||
|
|||||||
File renamed without changes.
@@ -51,7 +51,7 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
|
|
||||||
grub_printf
|
grub_printf
|
||||||
("Type Physical start - end #Pages "
|
("Type Physical start - end #Pages "
|
||||||
" Size Attributes\n");
|
" Size Attributes\n");
|
||||||
memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size);
|
memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size);
|
||||||
for (desc = memory_map;
|
for (desc = memory_map;
|
||||||
desc < memory_map_end;
|
desc < memory_map_end;
|
||||||
@@ -74,8 +74,7 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
"ACPI-nvs",
|
"ACPI-nvs",
|
||||||
"MMIO ",
|
"MMIO ",
|
||||||
"IO-ports",
|
"IO-ports",
|
||||||
"PAL-code",
|
"PAL-code"
|
||||||
"persist ",
|
|
||||||
};
|
};
|
||||||
if (desc->type < ARRAY_SIZE (types_str))
|
if (desc->type < ARRAY_SIZE (types_str))
|
||||||
grub_printf ("%s ", types_str[desc->type]);
|
grub_printf ("%s ", types_str[desc->type]);
|
||||||
@@ -88,29 +87,21 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
desc->physical_start + (desc->num_pages << 12) - 1,
|
desc->physical_start + (desc->num_pages << 12) - 1,
|
||||||
desc->num_pages);
|
desc->num_pages);
|
||||||
|
|
||||||
size = desc->num_pages << 12; /* 4 KiB page size */
|
size = desc->num_pages;
|
||||||
/*
|
size <<= (12 - 10);
|
||||||
* Since size is a multiple of 4 KiB, no need to handle units
|
if (size < 1024)
|
||||||
* of just Bytes (which would use a mask of 0x3ff).
|
grub_printf (" %4" PRIuGRUB_UINT64_T "KB", size);
|
||||||
*
|
|
||||||
* 14 characters would support the largest possible number of 4 KiB
|
|
||||||
* pages that are not a multiple of larger units (e.g., MiB):
|
|
||||||
* 17592186044415 (0xffffff_fffff000), but that uses a lot of
|
|
||||||
* whitespace for a rare case. 6 characters usually suffices;
|
|
||||||
* columns will be off if not, but this is preferable to rounding.
|
|
||||||
*/
|
|
||||||
if (size & 0xfffff)
|
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "KiB", size >> 10);
|
|
||||||
else if (size & 0x3fffffff)
|
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "MiB", size >> 20);
|
|
||||||
else if (size & 0xffffffffff)
|
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "GiB", size >> 30);
|
|
||||||
else if (size & 0x3ffffffffffff)
|
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "TiB", size >> 40);
|
|
||||||
else if (size & 0xfffffffffffffff)
|
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "PiB", size >> 50);
|
|
||||||
else
|
else
|
||||||
grub_printf (" %6" PRIuGRUB_UINT64_T "EiB", size >> 60);
|
{
|
||||||
|
size /= 1024;
|
||||||
|
if (size < 1024)
|
||||||
|
grub_printf (" %4" PRIuGRUB_UINT64_T "MB", size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size /= 1024;
|
||||||
|
grub_printf (" %4" PRIuGRUB_UINT64_T "GB", size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attr = desc->attribute;
|
attr = desc->attribute;
|
||||||
if (attr & GRUB_EFI_MEMORY_RUNTIME)
|
if (attr & GRUB_EFI_MEMORY_RUNTIME)
|
||||||
@@ -131,12 +122,6 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_printf (" RP");
|
grub_printf (" RP");
|
||||||
if (attr & GRUB_EFI_MEMORY_XP)
|
if (attr & GRUB_EFI_MEMORY_XP)
|
||||||
grub_printf (" XP");
|
grub_printf (" XP");
|
||||||
if (attr & GRUB_EFI_MEMORY_NV)
|
|
||||||
grub_printf (" NV");
|
|
||||||
if (attr & GRUB_EFI_MEMORY_MORE_RELIABLE)
|
|
||||||
grub_printf (" MR");
|
|
||||||
if (attr & GRUB_EFI_MEMORY_RO)
|
|
||||||
grub_printf (" RO");
|
|
||||||
|
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,20 +37,10 @@ static const struct guid_mapping guid_mappings[] =
|
|||||||
{
|
{
|
||||||
{ GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
|
{ GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
|
||||||
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
|
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
|
||||||
{ GRUB_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
|
|
||||||
"CRC32 GUIDED SECTION EXTRACTION"},
|
|
||||||
{ GRUB_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
|
|
||||||
{ GRUB_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
|
|
||||||
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"},
|
|
||||||
{ GRUB_EFI_HOB_LIST_GUID, "HOB LIST"},
|
|
||||||
{ GRUB_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
|
|
||||||
{ GRUB_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
|
|
||||||
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
|
|
||||||
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
|
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
|
||||||
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
|
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
|
||||||
{ GRUB_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
|
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
|
||||||
{ GRUB_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
|
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"}
|
||||||
{ GRUB_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ static grub_err_t
|
|||||||
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
|
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int byte = 0, bit = 0;
|
int byte, bit;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
grub_uint8_t value;
|
grub_uint8_t value;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ static grub_err_t
|
|||||||
grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
|
grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int byte = 0, bit = 0;
|
int byte, bit;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
grub_uint8_t value;
|
grub_uint8_t value;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ static grub_err_t
|
|||||||
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
|
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int byte = 0, bit = 0;
|
int byte, bit;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
grub_uint8_t value;
|
grub_uint8_t value;
|
||||||
|
|
||||||
|
|||||||
File renamed without changes.
@@ -253,7 +253,6 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
struct grub_command *cmd;
|
struct grub_command *cmd;
|
||||||
char **cutargs;
|
char **cutargs;
|
||||||
int cutargc;
|
int cutargc;
|
||||||
grub_err_t err = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
@@ -315,8 +314,6 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||||
|
|
||||||
cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
|
cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
|
||||||
if (!cutargs)
|
|
||||||
return grub_errno;
|
|
||||||
cutargc = argc - 1;
|
cutargc = argc - 1;
|
||||||
grub_memcpy (cutargs + 1, args + 2, sizeof (cutargs[0]) * (argc - 2));
|
grub_memcpy (cutargs + 1, args + 2, sizeof (cutargs[0]) * (argc - 2));
|
||||||
cutargs[0] = args[0];
|
cutargs[0] = args[0];
|
||||||
@@ -336,7 +333,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
if (!(cmd->func) (cmd, cutargc, cutargs))
|
if (!(cmd->func) (cmd, cutargc, cutargs))
|
||||||
{
|
{
|
||||||
kernel_type = LINUX;
|
kernel_type = LINUX;
|
||||||
goto out;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
@@ -351,7 +348,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
if (!(cmd->func) (cmd, argc, args))
|
if (!(cmd->func) (cmd, argc, args))
|
||||||
{
|
{
|
||||||
kernel_type = MULTIBOOT;
|
kernel_type = MULTIBOOT;
|
||||||
goto out;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
@@ -416,7 +413,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
if (!(cmd->func) (cmd, cutargc, cutargs))
|
if (!(cmd->func) (cmd, cutargc, cutargs))
|
||||||
{
|
{
|
||||||
kernel_type = KFREEBSD;
|
kernel_type = KFREEBSD;
|
||||||
goto out;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
@@ -425,8 +422,6 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
char **bsdargs;
|
char **bsdargs;
|
||||||
int bsdargc;
|
int bsdargc;
|
||||||
char bsddevname[sizeof ("wdXXXXXXXXXXXXY")];
|
char bsddevname[sizeof ("wdXXXXXXXXXXXXY")];
|
||||||
int found = 0;
|
|
||||||
|
|
||||||
if (bsd_device == -1)
|
if (bsd_device == -1)
|
||||||
{
|
{
|
||||||
bsdargs = cutargs;
|
bsdargs = cutargs;
|
||||||
@@ -437,11 +432,6 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
char rbuf[3] = "-r";
|
char rbuf[3] = "-r";
|
||||||
bsdargc = cutargc + 2;
|
bsdargc = cutargc + 2;
|
||||||
bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc);
|
bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc);
|
||||||
if (!bsdargs)
|
|
||||||
{
|
|
||||||
err = grub_errno;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0]));
|
grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0]));
|
||||||
bsdargs[argc] = rbuf;
|
bsdargs[argc] = rbuf;
|
||||||
bsdargs[argc + 1] = bsddevname;
|
bsdargs[argc + 1] = bsddevname;
|
||||||
@@ -457,8 +447,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
if (!(cmd->func) (cmd, bsdargc, bsdargs))
|
if (!(cmd->func) (cmd, bsdargc, bsdargs))
|
||||||
{
|
{
|
||||||
kernel_type = KNETBSD;
|
kernel_type = KNETBSD;
|
||||||
found = 1;
|
return GRUB_ERR_NONE;
|
||||||
goto free_bsdargs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
@@ -471,28 +460,20 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
if (!(cmd->func) (cmd, bsdargc, bsdargs))
|
if (!(cmd->func) (cmd, bsdargc, bsdargs))
|
||||||
{
|
{
|
||||||
kernel_type = KOPENBSD;
|
kernel_type = KOPENBSD;
|
||||||
found = 1;
|
return GRUB_ERR_NONE;
|
||||||
goto free_bsdargs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_bsdargs:
|
|
||||||
if (bsdargs != cutargs)
|
if (bsdargs != cutargs)
|
||||||
grub_free (bsdargs);
|
grub_free (bsdargs);
|
||||||
if (found)
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
err = grub_error (GRUB_ERR_BAD_OS, "couldn't load file %s",
|
return grub_error (GRUB_ERR_BAD_OS, "couldn't load file %s",
|
||||||
args[0]);
|
args[0]);
|
||||||
out:
|
|
||||||
grub_free (cutargs);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -553,17 +534,15 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
|
|||||||
char **newargs;
|
char **newargs;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
char nounzipbuf[10] = "--nounzip";
|
char nounzipbuf[10] = "--nounzip";
|
||||||
|
|
||||||
cmd = grub_command_find ("module");
|
|
||||||
if (!cmd)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"),
|
|
||||||
"module");
|
|
||||||
|
|
||||||
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
|
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
|
||||||
if (!newargs)
|
if (!newargs)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
|
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
|
||||||
newargs[0] = nounzipbuf;
|
newargs[0] = nounzipbuf;
|
||||||
|
cmd = grub_command_find ("module");
|
||||||
|
if (!cmd)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"),
|
||||||
|
"module");
|
||||||
|
|
||||||
err = cmd->func (cmd, argc + 1, newargs);
|
err = cmd->func (cmd, argc + 1, newargs);
|
||||||
grub_free (newargs);
|
grub_free (newargs);
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ static const char *names[] =
|
|||||||
is required to save accross hibernations. */
|
is required to save accross hibernations. */
|
||||||
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
|
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
|
||||||
[GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
|
[GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
|
||||||
[GRUB_MEMORY_PERSISTENT] = N_("persistent RAM"),
|
|
||||||
[GRUB_MEMORY_PERSISTENT_LEGACY] = N_("persistent RAM (legacy)"),
|
|
||||||
[GRUB_MEMORY_COREBOOT_TABLES] = N_("RAM holding coreboot tables"),
|
[GRUB_MEMORY_COREBOOT_TABLES] = N_("RAM holding coreboot tables"),
|
||||||
[GRUB_MEMORY_CODE] = N_("RAM holding firmware code")
|
[GRUB_MEMORY_CODE] = N_("RAM holding firmware code")
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -198,10 +198,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (get_uuid (NULL, &uuid_root, 0))
|
if (get_uuid (NULL, &uuid_root, 0))
|
||||||
{
|
return grub_errno;
|
||||||
grub_free (mods);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
prefdev = grub_file_get_device_name (prefix);
|
prefdev = grub_file_get_device_name (prefix);
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
@@ -213,8 +210,6 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
if (get_uuid (prefdev, &uuid_prefix, 0))
|
if (get_uuid (prefdev, &uuid_prefix, 0))
|
||||||
{
|
{
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
grub_free (prefdev);
|
|
||||||
grub_free (mods);
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,15 +289,12 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
}
|
}
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
grub_free (uuid_prefix);
|
grub_free (uuid_prefix);
|
||||||
grub_free (prefdev);
|
|
||||||
grub_free (mods);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
grub_free (uuid_root);
|
grub_free (uuid_root);
|
||||||
grub_free (uuid_prefix);
|
grub_free (uuid_prefix);
|
||||||
grub_free (prefdev);
|
|
||||||
|
|
||||||
for (i = 0; i < mods_loaded; i++)
|
for (i = 0; i < mods_loaded; i++)
|
||||||
if (mods[i])
|
if (mods[i])
|
||||||
@@ -310,8 +302,6 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
mods[i]->fini = 0;
|
mods[i]->fini = 0;
|
||||||
grub_dl_unload (mods[i]);
|
grub_dl_unload (mods[i]);
|
||||||
}
|
}
|
||||||
grub_free (mods);
|
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,6 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
}
|
}
|
||||||
if (! cur)
|
if (! cur)
|
||||||
{
|
{
|
||||||
grub_free (parsed);
|
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
|
||||||
args[i]);
|
args[i]);
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ check_password (const char *user, const char *entered, void *pin)
|
|||||||
grub_uint8_t *buf;
|
grub_uint8_t *buf;
|
||||||
struct pbkdf2_password *pass = pin;
|
struct pbkdf2_password *pass = pin;
|
||||||
gcry_err_code_t err;
|
gcry_err_code_t err;
|
||||||
grub_err_t ret;
|
|
||||||
|
|
||||||
buf = grub_malloc (pass->buflen);
|
buf = grub_malloc (pass->buflen);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
@@ -56,17 +55,17 @@ check_password (const char *user, const char *entered, void *pin)
|
|||||||
pass->salt, pass->saltlen, pass->c,
|
pass->salt, pass->saltlen, pass->c,
|
||||||
buf, pass->buflen);
|
buf, pass->buflen);
|
||||||
if (err)
|
if (err)
|
||||||
ret = grub_crypto_gcry_error (err);
|
|
||||||
else if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
|
|
||||||
ret = GRUB_ACCESS_DENIED;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
grub_auth_authenticate (user);
|
grub_free (buf);
|
||||||
ret = GRUB_ERR_NONE;
|
return grub_crypto_gcry_error (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_free (buf);
|
if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
|
||||||
return ret;
|
return GRUB_ACCESS_DENIED;
|
||||||
|
|
||||||
|
grub_auth_authenticate (user);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ iterate_device (const char *name, void *data)
|
|||||||
/* Skip floppy drives when requested. */
|
/* Skip floppy drives when requested. */
|
||||||
if (ctx->no_floppy &&
|
if (ctx->no_floppy &&
|
||||||
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
|
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
|
||||||
return 1;
|
return 0;
|
||||||
|
|
||||||
#ifdef DO_SEARCH_FS_UUID
|
#ifdef DO_SEARCH_FS_UUID
|
||||||
#define compare_fn grub_strcasecmp
|
#define compare_fn grub_strcasecmp
|
||||||
|
|||||||
@@ -324,19 +324,19 @@ grub_load_public_key (grub_file_t f)
|
|||||||
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
|
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
break;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
lb = (grub_be_to_cpu16 (l) + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT;
|
lb = (grub_be_to_cpu16 (l) + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT;
|
||||||
if (lb > READBUF_SIZE - sizeof (grub_uint16_t))
|
if (lb > READBUF_SIZE - sizeof (grub_uint16_t))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
break;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (grub_file_read (f, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
|
if (grub_file_read (f, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
break;
|
goto fail;
|
||||||
}
|
}
|
||||||
grub_memcpy (buffer, &l, sizeof (l));
|
grub_memcpy (buffer, &l, sizeof (l));
|
||||||
|
|
||||||
@@ -346,16 +346,10 @@ grub_load_public_key (grub_file_t f)
|
|||||||
buffer, lb + sizeof (grub_uint16_t), 0))
|
buffer, lb + sizeof (grub_uint16_t), 0))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
break;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < pkalgos[pk].nmpipub)
|
|
||||||
{
|
|
||||||
grub_free (sk);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MD_SHA1->final (fingerprint_context);
|
GRUB_MD_SHA1->final (fingerprint_context);
|
||||||
|
|
||||||
grub_memcpy (sk->fingerprint, GRUB_MD_SHA1->read (fingerprint_context), 20);
|
grub_memcpy (sk->fingerprint, GRUB_MD_SHA1->read (fingerprint_context), 20);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
struct grub_ahci_cmd_head
|
struct grub_ahci_cmd_head
|
||||||
{
|
{
|
||||||
grub_uint32_t config;
|
grub_uint32_t config;
|
||||||
grub_uint32_t transferred;
|
grub_uint32_t transfered;
|
||||||
grub_uint64_t command_table_base;
|
grub_uint64_t command_table_base;
|
||||||
grub_uint32_t unused[4];
|
grub_uint32_t unused[4];
|
||||||
};
|
};
|
||||||
@@ -954,7 +954,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|||||||
grub_dprintf ("ahci", "AHCI tfd = %x\n",
|
grub_dprintf ("ahci", "AHCI tfd = %x\n",
|
||||||
dev->hba->ports[dev->port].task_file_data);
|
dev->hba->ports[dev->port].task_file_data);
|
||||||
|
|
||||||
dev->command_list[0].transferred = 0;
|
dev->command_list[0].transfered = 0;
|
||||||
dev->command_list[0].command_table_base
|
dev->command_list[0].command_table_base
|
||||||
= grub_dma_get_phys (dev->command_table_chunk);
|
= grub_dma_get_phys (dev->command_table_chunk);
|
||||||
|
|
||||||
@@ -1044,7 +1044,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|||||||
dev->hba->ports[dev->port].command_issue,
|
dev->hba->ports[dev->port].command_issue,
|
||||||
dev->hba->ports[dev->port].intstatus,
|
dev->hba->ports[dev->port].intstatus,
|
||||||
dev->hba->ports[dev->port].task_file_data,
|
dev->hba->ports[dev->port].task_file_data,
|
||||||
dev->command_list[0].transferred,
|
dev->command_list[0].transfered,
|
||||||
dev->hba->ports[dev->port].sata_error,
|
dev->hba->ports[dev->port].sata_error,
|
||||||
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x00],
|
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x00],
|
||||||
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x18]);
|
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x18]);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include <grub/fs.h>
|
#include <grub/fs.h>
|
||||||
#include <grub/file.h>
|
#include <grub/file.h>
|
||||||
#include <grub/procfs.h>
|
#include <grub/procfs.h>
|
||||||
#include <grub/partition.h>
|
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
#include <grub/emu/hostdisk.h>
|
#include <grub/emu/hostdisk.h>
|
||||||
@@ -719,7 +718,6 @@ grub_cryptodisk_insert (grub_cryptodisk_t newdev, const char *name,
|
|||||||
newdev->id = last_cryptodisk_id++;
|
newdev->id = last_cryptodisk_id++;
|
||||||
newdev->source_id = source->id;
|
newdev->source_id = source->id;
|
||||||
newdev->source_dev_id = source->dev->id;
|
newdev->source_dev_id = source->dev->id;
|
||||||
newdev->partition_start = grub_partition_get_start (source->partition);
|
|
||||||
newdev->next = cryptodisk_list;
|
newdev->next = cryptodisk_list;
|
||||||
cryptodisk_list = newdev;
|
cryptodisk_list = newdev;
|
||||||
|
|
||||||
@@ -742,9 +740,7 @@ grub_cryptodisk_get_by_source_disk (grub_disk_t disk)
|
|||||||
grub_cryptodisk_t dev;
|
grub_cryptodisk_t dev;
|
||||||
for (dev = cryptodisk_list; dev != NULL; dev = dev->next)
|
for (dev = cryptodisk_list; dev != NULL; dev = dev->next)
|
||||||
if (dev->source_id == disk->id && dev->source_dev_id == disk->dev->id)
|
if (dev->source_id == disk->id && dev->source_dev_id == disk->dev->id)
|
||||||
if ((disk->partition && grub_partition_get_start (disk->partition) == dev->partition_start) ||
|
return dev;
|
||||||
(!disk->partition && dev->partition_start == 0))
|
|
||||||
return dev;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +761,6 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
|
|||||||
newdev->cheat_fd = GRUB_UTIL_FD_INVALID;
|
newdev->cheat_fd = GRUB_UTIL_FD_INVALID;
|
||||||
newdev->source_id = source->id;
|
newdev->source_id = source->id;
|
||||||
newdev->source_dev_id = source->dev->id;
|
newdev->source_dev_id = source->dev->id;
|
||||||
newdev->partition_start = grub_partition_get_start (source->partition);
|
|
||||||
newdev->id = last_cryptodisk_id++;
|
newdev->id = last_cryptodisk_id++;
|
||||||
newdev->next = cryptodisk_list;
|
newdev->next = cryptodisk_list;
|
||||||
cryptodisk_list = newdev;
|
cryptodisk_list = newdev;
|
||||||
|
|||||||
@@ -85,12 +85,6 @@ make_devices (void)
|
|||||||
{
|
{
|
||||||
/* Uggh. */
|
/* Uggh. */
|
||||||
grub_free (handles);
|
grub_free (handles);
|
||||||
while (devices)
|
|
||||||
{
|
|
||||||
d = devices->next;
|
|
||||||
grub_free (devices);
|
|
||||||
devices = d;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,15 +487,8 @@ grub_efidisk_open (const char *name, struct grub_disk *disk)
|
|||||||
m = d->block_io->media;
|
m = d->block_io->media;
|
||||||
/* FIXME: Probably it is better to store the block size in the disk,
|
/* FIXME: Probably it is better to store the block size in the disk,
|
||||||
and total sectors should be replaced with total blocks. */
|
and total sectors should be replaced with total blocks. */
|
||||||
grub_dprintf ("efidisk",
|
grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
|
||||||
"m = %p, last block = %llx, block size = %x, io align = %x\n",
|
m, (unsigned long long) m->last_block, m->block_size);
|
||||||
m, (unsigned long long) m->last_block, m->block_size,
|
|
||||||
m->io_align);
|
|
||||||
|
|
||||||
/* Ensure required buffer alignment is a power of two (or is zero). */
|
|
||||||
if (m->io_align & (m->io_align - 1))
|
|
||||||
return grub_error (GRUB_ERR_IO, "invalid buffer alignment %d", m->io_align);
|
|
||||||
|
|
||||||
disk->total_sectors = m->last_block + 1;
|
disk->total_sectors = m->last_block + 1;
|
||||||
/* Don't increase this value due to bug in some EFI. */
|
/* Don't increase this value due to bug in some EFI. */
|
||||||
disk->max_agglomerate = 0xa0000 >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS);
|
disk->max_agglomerate = 0xa0000 >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS);
|
||||||
@@ -531,42 +518,15 @@ grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector,
|
|||||||
{
|
{
|
||||||
struct grub_efidisk_data *d;
|
struct grub_efidisk_data *d;
|
||||||
grub_efi_block_io_t *bio;
|
grub_efi_block_io_t *bio;
|
||||||
grub_efi_status_t status;
|
|
||||||
grub_size_t io_align, num_bytes;
|
|
||||||
char *aligned_buf;
|
|
||||||
|
|
||||||
d = disk->data;
|
d = disk->data;
|
||||||
bio = d->block_io;
|
bio = d->block_io;
|
||||||
|
|
||||||
/* Set alignment to 1 if 0 specified */
|
return efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio,
|
||||||
io_align = bio->media->io_align ? bio->media->io_align : 1;
|
bio->media->media_id,
|
||||||
num_bytes = size << disk->log_sector_size;
|
(grub_efi_uint64_t) sector,
|
||||||
|
(grub_efi_uintn_t) size << disk->log_sector_size,
|
||||||
if ((grub_addr_t) buf & (io_align - 1))
|
buf);
|
||||||
{
|
|
||||||
aligned_buf = grub_memalign (io_align, num_bytes);
|
|
||||||
if (! aligned_buf)
|
|
||||||
return GRUB_EFI_OUT_OF_RESOURCES;
|
|
||||||
if (wr)
|
|
||||||
grub_memcpy (aligned_buf, buf, num_bytes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aligned_buf = buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio,
|
|
||||||
bio->media->media_id, (grub_efi_uint64_t) sector,
|
|
||||||
(grub_efi_uintn_t) num_bytes, aligned_buf);
|
|
||||||
|
|
||||||
if ((grub_addr_t) buf & (io_align - 1))
|
|
||||||
{
|
|
||||||
if (!wr)
|
|
||||||
grub_memcpy (buf, aligned_buf, num_bytes);
|
|
||||||
grub_free (aligned_buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -581,9 +541,7 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
|
|||||||
|
|
||||||
status = grub_efidisk_readwrite (disk, sector, size, buf, 0);
|
status = grub_efidisk_readwrite (disk, sector, size, buf, 0);
|
||||||
|
|
||||||
if (status == GRUB_EFI_NO_MEDIA)
|
if (status != GRUB_EFI_SUCCESS)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'"), disk->name);
|
|
||||||
else if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return grub_error (GRUB_ERR_READ_ERROR,
|
return grub_error (GRUB_ERR_READ_ERROR,
|
||||||
N_("failure reading sector 0x%llx from `%s'"),
|
N_("failure reading sector 0x%llx from `%s'"),
|
||||||
(unsigned long long) sector,
|
(unsigned long long) sector,
|
||||||
@@ -604,9 +562,7 @@ grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector,
|
|||||||
|
|
||||||
status = grub_efidisk_readwrite (disk, sector, size, (char *) buf, 1);
|
status = grub_efidisk_readwrite (disk, sector, size, (char *) buf, 1);
|
||||||
|
|
||||||
if (status == GRUB_EFI_NO_MEDIA)
|
if (status != GRUB_EFI_SUCCESS)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'"), disk->name);
|
|
||||||
else if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return grub_error (GRUB_ERR_WRITE_ERROR,
|
return grub_error (GRUB_ERR_WRITE_ERROR,
|
||||||
N_("failure writing sector 0x%llx to `%s'"),
|
N_("failure writing sector 0x%llx to `%s'"),
|
||||||
(unsigned long long) sector, disk->name);
|
(unsigned long long) sector, disk->name);
|
||||||
|
|||||||
@@ -227,10 +227,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
|
|||||||
|
|
||||||
if (grub_ieee1275_open (alias->path, &ihandle))
|
if (grub_ieee1275_open (alias->path, &ihandle))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* This method doesn't need memory allocation for the table. Open
|
|
||||||
firmware takes care of all memory management and the result table
|
|
||||||
stays in memory and is never freed. */
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
|
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
|
||||||
args.method = (grub_ieee1275_cell_t) "vscsi-report-luns";
|
args.method = (grub_ieee1275_cell_t) "vscsi-report-luns";
|
||||||
args.ihandle = ihandle;
|
args.ihandle = ihandle;
|
||||||
@@ -263,82 +260,6 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
|
|||||||
grub_free (buf);
|
grub_free (buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (alias->type, "sas_ioa") == 0)
|
|
||||||
{
|
|
||||||
/* The method returns the number of disks and a table where
|
|
||||||
* each ID is 64-bit long. Example of sas paths:
|
|
||||||
* /pci@80000002000001f/pci1014,034A@0/sas/disk@c05db70800
|
|
||||||
* /pci@80000002000001f/pci1014,034A@0/sas/disk@a05db70800
|
|
||||||
* /pci@80000002000001f/pci1014,034A@0/sas/disk@805db70800 */
|
|
||||||
|
|
||||||
struct sas_children
|
|
||||||
{
|
|
||||||
struct grub_ieee1275_common_hdr common;
|
|
||||||
grub_ieee1275_cell_t method;
|
|
||||||
grub_ieee1275_cell_t ihandle;
|
|
||||||
grub_ieee1275_cell_t max;
|
|
||||||
grub_ieee1275_cell_t table;
|
|
||||||
grub_ieee1275_cell_t catch_result;
|
|
||||||
grub_ieee1275_cell_t nentries;
|
|
||||||
}
|
|
||||||
args;
|
|
||||||
char *buf, *bufptr;
|
|
||||||
unsigned i;
|
|
||||||
grub_uint64_t *table;
|
|
||||||
grub_uint16_t table_size;
|
|
||||||
grub_ieee1275_ihandle_t ihandle;
|
|
||||||
|
|
||||||
buf = grub_malloc (grub_strlen (alias->path) +
|
|
||||||
sizeof ("/disk@7766554433221100"));
|
|
||||||
if (!buf)
|
|
||||||
return;
|
|
||||||
bufptr = grub_stpcpy (buf, alias->path);
|
|
||||||
|
|
||||||
/* Power machines documentation specify 672 as maximum SAS disks in
|
|
||||||
one system. Using a slightly larger value to be safe. */
|
|
||||||
table_size = 768;
|
|
||||||
table = grub_malloc (table_size * sizeof (grub_uint64_t));
|
|
||||||
|
|
||||||
if (!table)
|
|
||||||
{
|
|
||||||
grub_free (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_ieee1275_open (alias->path, &ihandle))
|
|
||||||
{
|
|
||||||
grub_free (buf);
|
|
||||||
grub_free (table);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 4, 2);
|
|
||||||
args.method = (grub_ieee1275_cell_t) "get-sas-children";
|
|
||||||
args.ihandle = ihandle;
|
|
||||||
args.max = table_size;
|
|
||||||
args.table = (grub_ieee1275_cell_t) table;
|
|
||||||
args.catch_result = 0;
|
|
||||||
args.nentries = 0;
|
|
||||||
|
|
||||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
|
||||||
{
|
|
||||||
grub_ieee1275_close (ihandle);
|
|
||||||
grub_free (table);
|
|
||||||
grub_free (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < args.nentries; i++)
|
|
||||||
{
|
|
||||||
grub_snprintf (bufptr, sizeof ("/disk@7766554433221100"),
|
|
||||||
"/disk@%" PRIxGRUB_UINT64_T, table[i]);
|
|
||||||
dev_iterate_real (buf, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_ieee1275_close (ihandle);
|
|
||||||
grub_free (table);
|
|
||||||
grub_free (buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS)
|
if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS)
|
||||||
&& grub_strcmp (alias->type, "block") == 0)
|
&& grub_strcmp (alias->type, "block") == 0)
|
||||||
|
|||||||
@@ -154,10 +154,7 @@ grub_efiemu_init_segments (grub_efiemu_segment_t *segs, const Elf_Ehdr *e)
|
|||||||
s->sh_flags & SHF_EXECINSTR ? GRUB_EFI_RUNTIME_SERVICES_CODE
|
s->sh_flags & SHF_EXECINSTR ? GRUB_EFI_RUNTIME_SERVICES_CODE
|
||||||
: GRUB_EFI_RUNTIME_SERVICES_DATA);
|
: GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||||
if (seg->handle < 0)
|
if (seg->handle < 0)
|
||||||
{
|
return grub_errno;
|
||||||
grub_free (seg);
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
seg->off = 0;
|
seg->off = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +343,7 @@ SUFFIX (grub_efiemu_loadcore_init) (void *core, const char *filename,
|
|||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
|
return grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
|
||||||
|
|
||||||
/* Make sure that every section is within the core. */
|
/* Make sure that every section is within the core. */
|
||||||
if ((grub_size_t) core_size < e->e_shoff + (grub_uint32_t) e->e_shentsize * e->e_shnum)
|
if ((grub_size_t) core_size < e->e_shoff + e->e_shentsize * e->e_shnum)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ grub_efiemu_load_file (const char *filename)
|
|||||||
{
|
{
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
grub_efiemu_unload ();
|
grub_efiemu_unload ();
|
||||||
return err;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("efiemu", "mm initialized\n");
|
grub_dprintf ("efiemu", "mm initialized\n");
|
||||||
|
|||||||
+3
-22
@@ -99,8 +99,7 @@ grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
|
|||||||
grub_size_t align_overhead;
|
grub_size_t align_overhead;
|
||||||
struct grub_efiemu_memrequest *ret, *cur, *prev;
|
struct grub_efiemu_memrequest *ret, *cur, *prev;
|
||||||
/* Check that the request is correct */
|
/* Check that the request is correct */
|
||||||
if (type <= GRUB_EFI_LOADER_CODE || type == GRUB_EFI_PERSISTENT_MEMORY ||
|
if (type >= GRUB_EFI_MAX_MEMORY_TYPE || type <= GRUB_EFI_LOADER_CODE)
|
||||||
type >= GRUB_EFI_MAX_MEMORY_TYPE)
|
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
/* Add new size to requested size */
|
/* Add new size to requested size */
|
||||||
@@ -167,13 +166,6 @@ efiemu_alloc_requests (void)
|
|||||||
GRUB_EFI_MEMORY_MAPPED_IO,
|
GRUB_EFI_MEMORY_MAPPED_IO,
|
||||||
GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE,
|
GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE,
|
||||||
GRUB_EFI_PAL_CODE
|
GRUB_EFI_PAL_CODE
|
||||||
|
|
||||||
/*
|
|
||||||
* These are not allocatable:
|
|
||||||
* GRUB_EFI_RESERVED_MEMORY_TYPE
|
|
||||||
* GRUB_EFI_PERSISTENT_MEMORY
|
|
||||||
* >= GRUB_EFI_MAX_MEMORY_TYPE
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Compute total memory needed */
|
/* Compute total memory needed */
|
||||||
@@ -410,10 +402,6 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
|
|||||||
return grub_efiemu_add_to_mmap (addr, size,
|
return grub_efiemu_add_to_mmap (addr, size,
|
||||||
GRUB_EFI_ACPI_MEMORY_NVS);
|
GRUB_EFI_ACPI_MEMORY_NVS);
|
||||||
|
|
||||||
case GRUB_MEMORY_PERSISTENT:
|
|
||||||
case GRUB_MEMORY_PERSISTENT_LEGACY:
|
|
||||||
return grub_efiemu_add_to_mmap (addr, size,
|
|
||||||
GRUB_EFI_PERSISTENT_MEMORY);
|
|
||||||
default:
|
default:
|
||||||
grub_dprintf ("efiemu",
|
grub_dprintf ("efiemu",
|
||||||
"Unknown memory type %d. Assuming unusable\n", type);
|
"Unknown memory type %d. Assuming unusable\n", type);
|
||||||
@@ -457,7 +445,7 @@ grub_efiemu_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|||||||
case GRUB_EFI_MEMORY_MAPPED_IO:
|
case GRUB_EFI_MEMORY_MAPPED_IO:
|
||||||
case GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE:
|
case GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE:
|
||||||
case GRUB_EFI_PAL_CODE:
|
case GRUB_EFI_PAL_CODE:
|
||||||
default:
|
case GRUB_EFI_MAX_MEMORY_TYPE:
|
||||||
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
||||||
GRUB_MEMORY_RESERVED, hook_data);
|
GRUB_MEMORY_RESERVED, hook_data);
|
||||||
break;
|
break;
|
||||||
@@ -480,12 +468,6 @@ grub_efiemu_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|||||||
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
||||||
GRUB_MEMORY_NVS, hook_data);
|
GRUB_MEMORY_NVS, hook_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_EFI_PERSISTENT_MEMORY:
|
|
||||||
hook (efiemu_mmap[i].physical_start, efiemu_mmap[i].num_pages * 4096,
|
|
||||||
GRUB_MEMORY_PERSISTENT, hook_data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -521,8 +503,7 @@ grub_efiemu_mmap_sort_and_uniq (void)
|
|||||||
[GRUB_EFI_ACPI_MEMORY_NVS] = 3,
|
[GRUB_EFI_ACPI_MEMORY_NVS] = 3,
|
||||||
[GRUB_EFI_MEMORY_MAPPED_IO] = 4,
|
[GRUB_EFI_MEMORY_MAPPED_IO] = 4,
|
||||||
[GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE] = 4,
|
[GRUB_EFI_MEMORY_MAPPED_IO_PORT_SPACE] = 4,
|
||||||
[GRUB_EFI_PAL_CODE] = 4,
|
[GRUB_EFI_PAL_CODE] = 4
|
||||||
[GRUB_EFI_PERSISTENT_MEMORY] = 4
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int i, j, k, done;
|
int i, j, k, done;
|
||||||
|
|||||||
@@ -83,16 +83,10 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
|||||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
||||||
|
|
||||||
/* Put pointer to the list of configuration tables in system table */
|
/* Put pointer to the list of configuration tables in system table */
|
||||||
err = grub_efiemu_write_value
|
grub_efiemu_write_value
|
||||||
(&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
|
(&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
|
||||||
conftable_handle, 0, 1,
|
conftable_handle, 0, 1,
|
||||||
sizeof (SUFFIX (grub_efiemu_system_table)->configuration_table));
|
sizeof (SUFFIX (grub_efiemu_system_table)->configuration_table));
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_efiemu_unload ();
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
SUFFIX(grub_efiemu_system_table)->num_table_entries = cntconftables;
|
SUFFIX(grub_efiemu_system_table)->num_table_entries = cntconftables;
|
||||||
|
|
||||||
/* Fill the list of configuration tables */
|
/* Fill the list of configuration tables */
|
||||||
|
|||||||
+1
-9
@@ -344,16 +344,8 @@ init_cbfsdisk (void)
|
|||||||
|
|
||||||
ptr = *(grub_uint32_t *) 0xfffffffc;
|
ptr = *(grub_uint32_t *) 0xfffffffc;
|
||||||
head = (struct cbfs_header *) (grub_addr_t) ptr;
|
head = (struct cbfs_header *) (grub_addr_t) ptr;
|
||||||
grub_dprintf ("cbfs", "head=%p\n", head);
|
|
||||||
|
|
||||||
/* coreboot current supports only ROMs <= 16 MiB. Bigger ROMs will
|
if (!validate_head (head))
|
||||||
have problems as RCBA is 18 MiB below end of 32-bit typically,
|
|
||||||
so either memory map would have to be rearranged or we'd need to support
|
|
||||||
reading ROMs through controller directly.
|
|
||||||
*/
|
|
||||||
if (ptr < 0xff000000
|
|
||||||
|| 0xffffffff - ptr < (grub_uint32_t) sizeof (*head) + 0xf
|
|
||||||
|| !validate_head (head))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cbfsdisk_size = ALIGN_UP (grub_be_to_cpu32 (head->romsize),
|
cbfsdisk_size = ALIGN_UP (grub_be_to_cpu32 (head->romsize),
|
||||||
|
|||||||
+1
-1
@@ -681,7 +681,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node,
|
|||||||
ctxt->dir.file_size
|
ctxt->dir.file_size
|
||||||
= grub_cpu_to_le64 (sec.type_specific.stream_extension.file_size);
|
= grub_cpu_to_le64 (sec.type_specific.stream_extension.file_size);
|
||||||
ctxt->dir.have_stream = 1;
|
ctxt->dir.have_stream = 1;
|
||||||
ctxt->dir.is_contiguous = !!(sec.type_specific.stream_extension.flags
|
ctxt->dir.is_contiguous = !!(dir.type_specific.stream_extension.flags
|
||||||
& grub_cpu_to_le16_compile_time (FLAG_CONTIGUOUS));
|
& grub_cpu_to_le16_compile_time (FLAG_CONTIGUOUS));
|
||||||
break;
|
break;
|
||||||
case 0xc1:
|
case 0xc1:
|
||||||
|
|||||||
@@ -1308,7 +1308,6 @@ grub_hfs_open (struct grub_file *file, const char *name)
|
|||||||
if (grub_hfs_find_dir (data, name, &found, GRUB_FSHELP_REG))
|
if (grub_hfs_find_dir (data, name, &found, GRUB_FSHELP_REG))
|
||||||
{
|
{
|
||||||
grub_free (data);
|
grub_free (data);
|
||||||
grub_free (found);
|
|
||||||
grub_dl_unref (my_mod);
|
grub_dl_unref (my_mod);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ decomp_block (struct grub_ntfs_comp *cc, grub_uint8_t *dest)
|
|||||||
if (tag & 1)
|
if (tag & 1)
|
||||||
{
|
{
|
||||||
grub_uint32_t i, len, delta, code, lmask, dshift;
|
grub_uint32_t i, len, delta, code, lmask, dshift;
|
||||||
grub_uint16_t word = 0;
|
grub_uint16_t word;
|
||||||
|
|
||||||
if (decomp_get16 (cc, &word))
|
if (decomp_get16 (cc, &word))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|||||||
+1
-4
@@ -775,10 +775,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
|||||||
c = de->name[de->len];
|
c = de->name[de->len];
|
||||||
de->name[de->len] = '\0';
|
de->name[de->len] = '\0';
|
||||||
if (iterate_dir_call_hook (ino, de->name, &ctx))
|
if (iterate_dir_call_hook (ino, de->name, &ctx))
|
||||||
{
|
return 1;
|
||||||
de->name[de->len] = c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
de->name[de->len] = c;
|
de->name[de->len] = c;
|
||||||
|
|
||||||
de = grub_xfs_inline_next_de(dir->data, head, de);
|
de = grub_xfs_inline_next_de(dir->data, head, de);
|
||||||
|
|||||||
@@ -3132,7 +3132,7 @@ make_mdn (dnode_end_t * mdn, struct grub_zfs_data *data)
|
|||||||
{
|
{
|
||||||
void *osp;
|
void *osp;
|
||||||
blkptr_t *bp;
|
blkptr_t *bp;
|
||||||
grub_size_t ospsize = 0;
|
grub_size_t ospsize;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
grub_dprintf ("zfs", "endian = %d\n", mdn->endian);
|
grub_dprintf ("zfs", "endian = %d\n", mdn->endian);
|
||||||
|
|||||||
@@ -184,8 +184,6 @@ LZ4_uncompress_unknownOutputSize(const char *source,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* copy literals */
|
/* copy literals */
|
||||||
if ((grub_addr_t) length > ~(grub_addr_t)op)
|
|
||||||
goto _output_error;
|
|
||||||
cpy = op + length;
|
cpy = op + length;
|
||||||
if ((cpy > oend - COPYLENGTH) ||
|
if ((cpy > oend - COPYLENGTH) ||
|
||||||
(ip + length > iend - COPYLENGTH)) {
|
(ip + length > iend - COPYLENGTH)) {
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ set -e
|
|||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
# genmod.sh moddep.lst normal.module build-grub-module-verifier normal.mod
|
# genmod.sh moddep.lst normal.module normal.mod
|
||||||
#
|
#
|
||||||
|
|
||||||
moddep=$1
|
moddep=$1
|
||||||
infile=$2
|
infile=$2
|
||||||
outfile=$4
|
outfile=$3
|
||||||
|
|
||||||
tmpfile=${outfile}.tmp
|
tmpfile=${outfile}.tmp
|
||||||
modname=`echo $infile | sed -e 's@\.module.*$@@'`
|
modname=`echo $infile | sed -e 's@\.module.*$@@'`
|
||||||
@@ -58,7 +58,7 @@ if test x@TARGET_APPLE_LINKER@ != x1; then
|
|||||||
-K grub_mod_init -K grub_mod_fini \
|
-K grub_mod_init -K grub_mod_fini \
|
||||||
-K _grub_mod_init -K _grub_mod_fini \
|
-K _grub_mod_init -K _grub_mod_fini \
|
||||||
-R .note.gnu.gold-version -R .note.GNU-stack \
|
-R .note.gnu.gold-version -R .note.GNU-stack \
|
||||||
-R .note -R .comment -R .ARM.exidx $tmpfile || exit 1
|
-R .note -R .comment $tmpfile || exit 1
|
||||||
fi
|
fi
|
||||||
if ! test -z "${TARGET_OBJ2ELF}"; then
|
if ! test -z "${TARGET_OBJ2ELF}"; then
|
||||||
"${TARGET_OBJ2ELF}" $tmpfile || exit 1
|
"${TARGET_OBJ2ELF}" $tmpfile || exit 1
|
||||||
@@ -91,9 +91,6 @@ else
|
|||||||
-nr:_grub_mod_init:grub_mod_init \
|
-nr:_grub_mod_init:grub_mod_init \
|
||||||
-nr:_grub_mod_fini:grub_mod_fini \
|
-nr:_grub_mod_fini:grub_mod_fini \
|
||||||
-wd1106 -nu -nd $tmpfile.bin $tmpfile || exit 1
|
-wd1106 -nu -nd $tmpfile.bin $tmpfile || exit 1
|
||||||
rm -f $tmpfile.bin
|
rm -f $name.bin
|
||||||
fi
|
|
||||||
if test x@platform@ != xemu; then
|
|
||||||
./build-grub-module-verifier@BUILD_EXEEXT@ $tmpfile @target_cpu@
|
|
||||||
fi
|
fi
|
||||||
mv $tmpfile $outfile
|
mv $tmpfile $outfile
|
||||||
+1
-31
@@ -29,7 +29,7 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf "error: %u: unrecognized input format\n", NR >"/dev/stderr";
|
printf "error: %u: unrecognized input format\n", NR;
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,8 +39,6 @@ END {
|
|||||||
if (error >= 1)
|
if (error >= 1)
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|
||||||
total_depcount = 0
|
|
||||||
|
|
||||||
for (mod in modtab) {
|
for (mod in modtab) {
|
||||||
# Remove duplications.
|
# Remove duplications.
|
||||||
split(modtab[mod], depmods, " ");
|
split(modtab[mod], depmods, " ");
|
||||||
@@ -54,42 +52,14 @@ END {
|
|||||||
uniqmods[depmod] = 1;
|
uniqmods[depmod] = 1;
|
||||||
}
|
}
|
||||||
modlist = ""
|
modlist = ""
|
||||||
depcount[mod] = 0
|
|
||||||
for (depmod in uniqmods) {
|
for (depmod in uniqmods) {
|
||||||
modlist = modlist " " depmod;
|
modlist = modlist " " depmod;
|
||||||
inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod
|
|
||||||
depcount[mod]++
|
|
||||||
total_depcount++
|
|
||||||
}
|
}
|
||||||
if (mod == "all_video") {
|
if (mod == "all_video") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf "%s:%s\n", mod, modlist;
|
printf "%s:%s\n", mod, modlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that we have no dependency circles
|
|
||||||
while (total_depcount != 0) {
|
|
||||||
something_done = 0
|
|
||||||
for (mod in depcount) {
|
|
||||||
if (depcount[mod] == 0) {
|
|
||||||
delete depcount[mod]
|
|
||||||
split(inverse_dependencies[mod], inv_depmods, " ");
|
|
||||||
for (ctr in inv_depmods) {
|
|
||||||
depcount[inv_depmods[ctr]]--
|
|
||||||
total_depcount--
|
|
||||||
}
|
|
||||||
delete inverse_dependencies[mod]
|
|
||||||
something_done = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (something_done == 0) {
|
|
||||||
for (mod in depcount) {
|
|
||||||
circle = circle " " mod
|
|
||||||
}
|
|
||||||
printf "error: modules %s form a dependency circle\n", circle >"/dev/stderr";
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
modlist = ""
|
modlist = ""
|
||||||
while (getline <"video.lst") {
|
while (getline <"video.lst") {
|
||||||
modlist = modlist " " $1;
|
modlist = modlist " " $1;
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|||||||
grub_uint32_t *logical;
|
grub_uint32_t *logical;
|
||||||
grub_ssize_t logical_len, visual_len;
|
grub_ssize_t logical_len, visual_len;
|
||||||
struct grub_unicode_glyph *visual, *ptr;
|
struct grub_unicode_glyph *visual, *ptr;
|
||||||
grub_err_t err;
|
|
||||||
|
|
||||||
logical_len = grub_utf8_to_ucs4_alloc (str, &logical, 0);
|
logical_len = grub_utf8_to_ucs4_alloc (str, &logical, 0);
|
||||||
if (logical_len < 0)
|
if (logical_len < 0)
|
||||||
@@ -57,28 +56,24 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|||||||
if (visual_len < 0)
|
if (visual_len < 0)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
err = GRUB_ERR_NONE;
|
|
||||||
for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++)
|
for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++)
|
||||||
{
|
{
|
||||||
|
grub_err_t err;
|
||||||
struct grub_font_glyph *glyph;
|
struct grub_font_glyph *glyph;
|
||||||
glyph = grub_font_construct_glyph (font, ptr);
|
glyph = grub_font_construct_glyph (font, ptr);
|
||||||
if (!glyph)
|
if (!glyph)
|
||||||
{
|
return grub_errno;
|
||||||
err = grub_errno;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
err = grub_font_draw_glyph (glyph, color, x, baseline_y);
|
err = grub_font_draw_glyph (glyph, color, x, baseline_y);
|
||||||
if (err)
|
|
||||||
goto out;
|
|
||||||
x += glyph->device_width;
|
x += glyph->device_width;
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
for (ptr = visual; ptr < visual + visual_len; ptr++)
|
for (ptr = visual; ptr < visual + visual_len; ptr++)
|
||||||
grub_unicode_destroy_glyph (ptr);
|
grub_unicode_destroy_glyph (ptr);
|
||||||
grub_free (visual);
|
grub_free (visual);
|
||||||
|
|
||||||
return err;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the width in pixels of the specified UTF-8 string, when rendered in
|
/* Get the width in pixels of the specified UTF-8 string, when rendered in
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
|||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
||||||
"theme");
|
"theme");
|
||||||
|
|
||||||
err = grub_video_get_info (&mode_info);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
instance = grub_zalloc (sizeof (*instance));
|
instance = grub_zalloc (sizeof (*instance));
|
||||||
if (!instance)
|
if (!instance)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
err = grub_video_get_info (&mode_info);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
if (theme_path[0] != '/' && theme_path[0] != '(')
|
if (theme_path[0] != '/' && theme_path[0] != '(')
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ theme_set_string (grub_gfxmenu_view_t view,
|
|||||||
{
|
{
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
int err = theme_get_unsigned_int_from_proportional (value,
|
int err = theme_get_unsigned_int_from_proportional (value,
|
||||||
view->screen.height,
|
view->screen.width,
|
||||||
&tmp);
|
&tmp);
|
||||||
if (err != GRUB_ERR_NONE)
|
if (err != GRUB_ERR_NONE)
|
||||||
return err;
|
return err;
|
||||||
@@ -275,7 +275,7 @@ theme_set_string (grub_gfxmenu_view_t view,
|
|||||||
{
|
{
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
int err = theme_get_unsigned_int_from_proportional (value,
|
int err = theme_get_unsigned_int_from_proportional (value,
|
||||||
view->screen.height,
|
view->screen.width,
|
||||||
&tmp);
|
&tmp);
|
||||||
if (err != GRUB_ERR_NONE)
|
if (err != GRUB_ERR_NONE)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2012 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/types.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
|
|
||||||
/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */
|
|
||||||
grub_uint8_t
|
|
||||||
grub_byte_checksum (void *base, grub_size_t size)
|
|
||||||
{
|
|
||||||
grub_uint8_t *ptr;
|
|
||||||
grub_uint8_t ret = 0;
|
|
||||||
for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size;
|
|
||||||
ptr++)
|
|
||||||
ret += *ptr;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
grub_acpi_rsdt_find_table (struct grub_acpi_table_header *rsdt, const char *sig)
|
|
||||||
{
|
|
||||||
grub_size_t s;
|
|
||||||
grub_unaligned_uint32_t *ptr;
|
|
||||||
|
|
||||||
if (!rsdt)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (grub_memcmp (rsdt->signature, "RSDT", 4) != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ptr = (grub_unaligned_uint32_t *) (rsdt + 1);
|
|
||||||
s = (rsdt->length - sizeof (*rsdt)) / sizeof (grub_uint32_t);
|
|
||||||
for (; s; s--, ptr++)
|
|
||||||
{
|
|
||||||
struct grub_acpi_table_header *tbl;
|
|
||||||
tbl = (struct grub_acpi_table_header *) (grub_addr_t) ptr->val;
|
|
||||||
if (grub_memcmp (tbl->signature, sig, 4) == 0)
|
|
||||||
return tbl;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
grub_acpi_xsdt_find_table (struct grub_acpi_table_header *xsdt, const char *sig)
|
|
||||||
{
|
|
||||||
grub_size_t s;
|
|
||||||
grub_unaligned_uint64_t *ptr;
|
|
||||||
|
|
||||||
if (!xsdt)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (grub_memcmp (xsdt->signature, "XSDT", 4) != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ptr = (grub_unaligned_uint64_t *) (xsdt + 1);
|
|
||||||
s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint32_t);
|
|
||||||
for (; s; s--, ptr++)
|
|
||||||
{
|
|
||||||
struct grub_acpi_table_header *tbl;
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P != 8
|
|
||||||
if (ptr->val >> 32)
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
tbl = (struct grub_acpi_table_header *) (grub_addr_t) ptr->val;
|
|
||||||
if (grub_memcmp (tbl->signature, sig, 4) == 0)
|
|
||||||
return tbl;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_acpi_fadt *
|
|
||||||
grub_acpi_find_fadt (void)
|
|
||||||
{
|
|
||||||
struct grub_acpi_fadt *fadt = 0;
|
|
||||||
struct grub_acpi_rsdp_v10 *rsdpv1;
|
|
||||||
struct grub_acpi_rsdp_v20 *rsdpv2;
|
|
||||||
rsdpv1 = grub_machine_acpi_get_rsdpv1 ();
|
|
||||||
if (rsdpv1)
|
|
||||||
fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
|
|
||||||
(grub_addr_t) rsdpv1->rsdt_addr,
|
|
||||||
GRUB_ACPI_FADT_SIGNATURE);
|
|
||||||
if (fadt)
|
|
||||||
return fadt;
|
|
||||||
rsdpv2 = grub_machine_acpi_get_rsdpv2 ();
|
|
||||||
if (rsdpv2)
|
|
||||||
fadt = grub_acpi_rsdt_find_table ((struct grub_acpi_table_header *)
|
|
||||||
(grub_addr_t) rsdpv2->rsdpv1.rsdt_addr,
|
|
||||||
GRUB_ACPI_FADT_SIGNATURE);
|
|
||||||
if (fadt)
|
|
||||||
return fadt;
|
|
||||||
if (rsdpv2
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P != 8
|
|
||||||
&& !(rsdpv2->xsdt_addr >> 32)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
fadt = grub_acpi_xsdt_find_table ((struct grub_acpi_table_header *)
|
|
||||||
(grub_addr_t) rsdpv2->xsdt_addr,
|
|
||||||
GRUB_ACPI_FADT_SIGNATURE);
|
|
||||||
if (fadt)
|
|
||||||
return fadt;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -38,7 +38,7 @@ static void
|
|||||||
increment_timer (grub_efi_event_t event __attribute__ ((unused)),
|
increment_timer (grub_efi_event_t event __attribute__ ((unused)),
|
||||||
void *context __attribute__ ((unused)))
|
void *context __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
tmr += 10;
|
tmr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -52,7 +52,7 @@ grub_machine_init (void)
|
|||||||
|
|
||||||
efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
|
||||||
GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
|
GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
|
||||||
efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000);
|
efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 10000);
|
||||||
|
|
||||||
grub_install_get_time_ms (grub_efi_get_time_ms);
|
grub_install_get_time_ms (grub_efi_get_time_ms);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ FUNCTION(_start)
|
|||||||
VARIABLE(grub_total_module_size)
|
VARIABLE(grub_total_module_size)
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
|
VARIABLE(grub_uboot_machine_type)
|
||||||
|
.long 0
|
||||||
|
VARIABLE(grub_uboot_boot_data)
|
||||||
|
.long 0
|
||||||
VARIABLE(grub_modbase)
|
VARIABLE(grub_modbase)
|
||||||
.long 0
|
.long 0
|
||||||
bss_start_ptr:
|
bss_start_ptr:
|
||||||
@@ -62,66 +66,29 @@ bss_start_ptr:
|
|||||||
end_ptr:
|
end_ptr:
|
||||||
.long EXT_C(_end)
|
.long EXT_C(_end)
|
||||||
|
|
||||||
@ Memory map at start:
|
|
||||||
@ * text+data
|
|
||||||
@ * list relocations
|
|
||||||
@ * modules
|
|
||||||
@ Before we enter C, we need to apply the relocations
|
|
||||||
@ and get following map:
|
|
||||||
@ * text+data
|
|
||||||
@ * BSS (cleared)
|
|
||||||
@ * stack
|
|
||||||
@ * modules
|
|
||||||
@
|
|
||||||
@ To make things easier we ensure
|
|
||||||
@ that BSS+stack is larger than list of relocations
|
|
||||||
@ by increasing stack if necessarry.
|
|
||||||
@ This allows us to always unconditionally copy backwards
|
|
||||||
@ Currently list of relocations is ~5K and stack is set
|
|
||||||
@ to be at least 256K
|
|
||||||
|
|
||||||
FUNCTION(codestart)
|
FUNCTION(codestart)
|
||||||
@ Store context: Machine ID, atags/dtb, ...
|
@ Store context: Machine ID, atags/dtb, ...
|
||||||
@ U-Boot API signature is stored on the U-Boot heap
|
@ U-Boot API signature is stored on the U-Boot heap
|
||||||
@ Stack pointer used as start address for signature probing
|
@ Stack pointer used as start address for signature probing
|
||||||
mov r12, sp
|
mov r12, sp
|
||||||
adr sp, entry_state
|
adr sp, entry_state
|
||||||
push {r1-r12,lr} @ store U-Boot context (sp in r12)
|
push {r4-r12,lr} @ store U-Boot context (sp in r12)
|
||||||
|
|
||||||
adr r1, _start
|
str r1, EXT_C(grub_uboot_machine_type)
|
||||||
ldr r0, bss_start_ptr @ src
|
str r2, EXT_C(grub_uboot_boot_data)
|
||||||
add r0, r0, r1
|
|
||||||
|
|
||||||
add r0, r0, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
@ Modules have been stored as a blob in BSS,
|
||||||
mvn r2, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
|
||||||
and r0, r0, r2
|
|
||||||
1:
|
|
||||||
ldr r3, [r0], #4 @load next offset
|
|
||||||
@ both -2 and -1 are treated the same as we have only one type of relocs
|
|
||||||
@ -2 means "end of this type of relocs" and -1 means "end of all relocs"
|
|
||||||
add r2, r3, #2
|
|
||||||
cmp r2, #1
|
|
||||||
bls reloc_done
|
|
||||||
@ Adjust next offset
|
|
||||||
ldr r2, [r3, r1]
|
|
||||||
add r2, r2, r1
|
|
||||||
str r2, [r3, r1]
|
|
||||||
b 1b
|
|
||||||
|
|
||||||
reloc_done:
|
|
||||||
|
|
||||||
@ Modules have been stored as a blob
|
|
||||||
@ they need to be manually relocated to _end
|
@ they need to be manually relocated to _end
|
||||||
|
ldr r0, bss_start_ptr @ src
|
||||||
add r0, r0, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
add r0, r0, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
||||||
mvn r1, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
mvn r1, #(GRUB_KERNEL_MACHINE_MOD_ALIGN - 1)
|
||||||
and r0, r0, r1 @ src = aligned end of relocations
|
and r0, r0, r1
|
||||||
|
|
||||||
ldr r1, end_ptr @ dst = End of BSS
|
ldr r1, end_ptr @ dst = End of BSS
|
||||||
ldr r2, grub_total_module_size @ blob size
|
ldr r2, grub_total_module_size @ blob size
|
||||||
|
|
||||||
add r1, r1, #GRUB_KERNEL_MACHINE_STACK_SIZE
|
add r1, r1, #GRUB_KERNEL_MACHINE_STACK_SIZE
|
||||||
and r1, r1, #~0x7 @ Ensure 8-byte alignment
|
and r1, r1, #~0x7 @ Ensure 8-byte alignment
|
||||||
|
|
||||||
sub sp, r1, #8
|
sub sp, r1, #8
|
||||||
add r1, r1, #1024
|
add r1, r1, #1024
|
||||||
|
|
||||||
@@ -190,11 +157,6 @@ FUNCTION(grub_uboot_return)
|
|||||||
.align 3
|
.align 3
|
||||||
@ U-boot context stack space
|
@ U-boot context stack space
|
||||||
entry_state_end:
|
entry_state_end:
|
||||||
VARIABLE(grub_uboot_machine_type)
|
|
||||||
.long 0 @ r1
|
|
||||||
VARIABLE(grub_uboot_boot_data)
|
|
||||||
.long 0 @ r2
|
|
||||||
.long 0 @ r3
|
|
||||||
.long 0 @ r4
|
.long 0 @ r4
|
||||||
.long 0 @ r5
|
.long 0 @ r5
|
||||||
.long 0 @ r6
|
.long 0 @ r6
|
||||||
|
|||||||
@@ -132,12 +132,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
|||||||
*abs_place = (grub_uint64_t) sym_addr;
|
*abs_place = (grub_uint64_t) sym_addr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R_AARCH64_ADD_ABS_LO12_NC:
|
|
||||||
grub_arm64_set_abs_lo12 (place, sym_addr);
|
|
||||||
break;
|
|
||||||
case R_AARCH64_LDST64_ABS_LO12_NC:
|
|
||||||
grub_arm64_set_abs_lo12_ldst64 (place, sym_addr);
|
|
||||||
break;
|
|
||||||
case R_AARCH64_CALL26:
|
case R_AARCH64_CALL26:
|
||||||
case R_AARCH64_JUMP26:
|
case R_AARCH64_JUMP26:
|
||||||
{
|
{
|
||||||
@@ -160,18 +154,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
|||||||
grub_arm64_set_xxxx26_offset (place, offset);
|
grub_arm64_set_xxxx26_offset (place, offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R_AARCH64_ADR_PREL_PG_HI21:
|
|
||||||
{
|
|
||||||
grub_int64_t offset = (sym_addr & ~0xfffULL) - (((grub_uint64_t) place) & ~0xfffULL);
|
|
||||||
|
|
||||||
if (!grub_arm64_check_hi21_signed (offset))
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"HI21 out of range");
|
|
||||||
|
|
||||||
grub_arm64_set_hi21 (place, offset);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
|
|||||||
@@ -53,43 +53,3 @@ grub_arm64_set_xxxx26_offset (grub_uint32_t *place, grub_int64_t offset)
|
|||||||
*place &= insmask;
|
*place &= insmask;
|
||||||
*place |= grub_cpu_to_le32 (offset >> 2) & ~insmask;
|
*place |= grub_cpu_to_le32 (offset >> 2) & ~insmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
grub_arm64_check_hi21_signed (grub_int64_t offset)
|
|
||||||
{
|
|
||||||
if (offset != (grub_int64_t)(grub_int32_t)offset)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_arm64_set_hi21 (grub_uint32_t *place, grub_int64_t offset)
|
|
||||||
{
|
|
||||||
const grub_uint32_t insmask = grub_cpu_to_le32_compile_time (0x9f00001f);
|
|
||||||
grub_uint32_t val;
|
|
||||||
|
|
||||||
offset >>= 12;
|
|
||||||
|
|
||||||
val = ((offset & 3) << 29) | (((offset >> 2) & 0x7ffff) << 5);
|
|
||||||
|
|
||||||
*place &= insmask;
|
|
||||||
*place |= grub_cpu_to_le32 (val) & ~insmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_arm64_set_abs_lo12 (grub_uint32_t *place, grub_int64_t target)
|
|
||||||
{
|
|
||||||
const grub_uint32_t insmask = grub_cpu_to_le32_compile_time (0xffc003ff);
|
|
||||||
|
|
||||||
*place &= insmask;
|
|
||||||
*place |= grub_cpu_to_le32 (target << 10) & ~insmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_arm64_set_abs_lo12_ldst64 (grub_uint32_t *place, grub_int64_t target)
|
|
||||||
{
|
|
||||||
const grub_uint32_t insmask = grub_cpu_to_le32_compile_time (0xfff803ff);
|
|
||||||
|
|
||||||
*place &= insmask;
|
|
||||||
*place |= grub_cpu_to_le32 (target << 7) & ~insmask;
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/* init.c - initialize an arm-based EFI system */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2013 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/env.h>
|
|
||||||
#include <grub/kernel.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/loader.h>
|
|
||||||
|
|
||||||
static grub_uint64_t timer_frequency_in_khz;
|
|
||||||
|
|
||||||
static grub_uint64_t
|
|
||||||
grub_efi_get_time_ms (void)
|
|
||||||
{
|
|
||||||
grub_uint64_t tmr;
|
|
||||||
asm volatile("mrs %0, cntvct_el0" : "=r" (tmr));
|
|
||||||
|
|
||||||
return tmr / timer_frequency_in_khz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_machine_init (void)
|
|
||||||
{
|
|
||||||
grub_uint64_t timer_frequency;
|
|
||||||
|
|
||||||
grub_efi_init ();
|
|
||||||
|
|
||||||
asm volatile("mrs %0, cntfrq_el0" : "=r" (timer_frequency));
|
|
||||||
timer_frequency_in_khz = timer_frequency / 1000;
|
|
||||||
|
|
||||||
grub_install_get_time_ms (grub_efi_get_time_ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_machine_fini (int flags)
|
|
||||||
{
|
|
||||||
if (!(flags & GRUB_LOADER_FLAG_NORETURN))
|
|
||||||
return;
|
|
||||||
|
|
||||||
grub_efi_fini ();
|
|
||||||
}
|
|
||||||
+2
-8
@@ -333,11 +333,8 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||||||
if (s->sh_type == SHT_SYMTAB)
|
if (s->sh_type == SHT_SYMTAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Module without symbol table may still be used to pull in dependencies.
|
|
||||||
We verify at build time that such modules do not contain any relocations
|
|
||||||
that may reference symbol table. */
|
|
||||||
if (i == e->e_shnum)
|
if (i == e->e_shnum)
|
||||||
return GRUB_ERR_NONE;
|
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||||
|
|
||||||
#ifdef GRUB_MODULES_MACHINE_READONLY
|
#ifdef GRUB_MODULES_MACHINE_READONLY
|
||||||
mod->symtab = grub_malloc (s->sh_size);
|
mod->symtab = grub_malloc (s->sh_size);
|
||||||
@@ -579,9 +576,6 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||||||
|
|
||||||
if (seg)
|
if (seg)
|
||||||
{
|
{
|
||||||
if (!mod->symtab)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "relocation without symbol table");
|
|
||||||
|
|
||||||
err = grub_arch_dl_relocate_symbols (mod, ehdr, s, seg);
|
err = grub_arch_dl_relocate_symbols (mod, ehdr, s, seg);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@@ -611,7 +605,7 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that every section is within the core. */
|
/* Make sure that every section is within the core. */
|
||||||
if (size < e->e_shoff + (grub_uint32_t) e->e_shentsize * e->e_shnum)
|
if (size < e->e_shoff + e->e_shentsize * e->e_shnum)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_OS, "ELF sections outside core");
|
grub_error (GRUB_ERR_BAD_OS, "ELF sections outside core");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
|
||||||
|
|
||||||
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
|
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
|
||||||
#define GRUB_ELF_ENABLE_BI_ENDIAN 1
|
#define GRUB_ELF_ENABLE_BI_ENDIAN 1
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ grub_elfXX_load_phdrs (grub_elf_t elf)
|
|||||||
if (elf->phdrs)
|
if (elf->phdrs)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
phdrs_size = (grub_uint32_t) elf->ehdr.ehdrXX.e_phnum * elf->ehdr.ehdrXX.e_phentsize;
|
phdrs_size = elf->ehdr.ehdrXX.e_phnum * elf->ehdr.ehdrXX.e_phentsize;
|
||||||
|
|
||||||
grub_dprintf ("elf", "Loading program headers at 0x%llx, size 0x%lx.\n",
|
grub_dprintf ("elf", "Loading program headers at 0x%llx, size 0x%lx.\n",
|
||||||
(unsigned long long) elf->ehdr.ehdrXX.e_phoff,
|
(unsigned long long) elf->ehdr.ehdrXX.e_phoff,
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
# if GRUB_DISK_DEVS_ARE_CHAR
|
# if GRUB_DISK_DEVS_ARE_CHAR
|
||||||
if (fstat (fd, &st) >= 0 && S_ISCHR (st.st_mode))
|
if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
|
||||||
# else
|
# else
|
||||||
if (fstat (fd, &st) >= 0 && S_ISBLK (st.st_mode))
|
if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode))
|
||||||
# endif
|
# endif
|
||||||
data->is_disk = 1;
|
data->is_disk = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,12 +65,6 @@ grub_reboot (void)
|
|||||||
longjmp (main_env, 1);
|
longjmp (main_env, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_exit (void)
|
|
||||||
{
|
|
||||||
grub_reboot ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_machine_init (void)
|
grub_machine_init (void)
|
||||||
{
|
{
|
||||||
@@ -92,16 +86,11 @@ grub_machine_fini (int flags)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define OPT_MEMDISK 257
|
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
|
{"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
|
||||||
{"device-map", 'm', N_("FILE"), 0,
|
{"device-map", 'm', N_("FILE"), 0,
|
||||||
/* TRANSLATORS: There are many devices in device map. */
|
/* TRANSLATORS: There are many devices in device map. */
|
||||||
N_("use FILE as the device map [default=%s]"), 0},
|
N_("use FILE as the device map [default=%s]"), 0},
|
||||||
{"memdisk", OPT_MEMDISK, N_("FILE"), 0,
|
|
||||||
/* TRANSLATORS: There are many devices in device map. */
|
|
||||||
N_("use FILE as memdisk"), 0},
|
|
||||||
{"directory", 'd', N_("DIR"), 0,
|
{"directory", 'd', N_("DIR"), 0,
|
||||||
N_("use GRUB files in the directory DIR [default=%s]"), 0},
|
N_("use GRUB files in the directory DIR [default=%s]"), 0},
|
||||||
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
||||||
@@ -130,7 +119,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
|||||||
struct arguments
|
struct arguments
|
||||||
{
|
{
|
||||||
const char *dev_map;
|
const char *dev_map;
|
||||||
const char *mem_disk;
|
|
||||||
int hold;
|
int hold;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -143,9 +131,6 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case OPT_MEMDISK:
|
|
||||||
arguments->mem_disk = arg;
|
|
||||||
break;
|
|
||||||
case 'r':
|
case 'r':
|
||||||
free (root_dev);
|
free (root_dev);
|
||||||
root_dev = xstrdup (arg);
|
root_dev = xstrdup (arg);
|
||||||
@@ -195,13 +180,9 @@ main (int argc, char *argv[])
|
|||||||
struct arguments arguments =
|
struct arguments arguments =
|
||||||
{
|
{
|
||||||
.dev_map = DEFAULT_DEVICE_MAP,
|
.dev_map = DEFAULT_DEVICE_MAP,
|
||||||
.hold = 0,
|
.hold = 0
|
||||||
.mem_disk = 0,
|
|
||||||
};
|
};
|
||||||
volatile int hold = 0;
|
volatile int hold = 0;
|
||||||
size_t total_module_size = sizeof (struct grub_module_info), memdisk_size = 0;
|
|
||||||
struct grub_module_info *modinfo;
|
|
||||||
void *mods;
|
|
||||||
|
|
||||||
grub_util_host_init (&argc, &argv);
|
grub_util_host_init (&argc, &argv);
|
||||||
|
|
||||||
@@ -213,33 +194,6 @@ main (int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.mem_disk)
|
|
||||||
{
|
|
||||||
memdisk_size = ALIGN_UP(grub_util_get_image_size (arguments.mem_disk), 512);
|
|
||||||
total_module_size += memdisk_size + sizeof (struct grub_module_header);
|
|
||||||
}
|
|
||||||
|
|
||||||
mods = xmalloc (total_module_size);
|
|
||||||
modinfo = grub_memset (mods, 0, total_module_size);
|
|
||||||
mods = (char *) (modinfo + 1);
|
|
||||||
|
|
||||||
modinfo->magic = GRUB_MODULE_MAGIC;
|
|
||||||
modinfo->offset = sizeof (struct grub_module_info);
|
|
||||||
modinfo->size = total_module_size;
|
|
||||||
|
|
||||||
if (arguments.mem_disk)
|
|
||||||
{
|
|
||||||
struct grub_module_header *header = (struct grub_module_header *) mods;
|
|
||||||
header->type = OBJ_TYPE_MEMDISK;
|
|
||||||
header->size = memdisk_size + sizeof (*header);
|
|
||||||
mods = header + 1;
|
|
||||||
|
|
||||||
grub_util_load_image (arguments.mem_disk, mods);
|
|
||||||
mods = (char *) mods + memdisk_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_modbase = (grub_addr_t) modinfo;
|
|
||||||
|
|
||||||
hold = arguments.hold;
|
hold = arguments.hold;
|
||||||
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
|
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
|
||||||
if (hold && verbosity > 0)
|
if (hold && verbosity > 0)
|
||||||
|
|||||||
@@ -134,13 +134,11 @@ xasprintf (const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
|
|
||||||
void
|
void
|
||||||
grub_exit (void)
|
grub_exit (void)
|
||||||
{
|
{
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
grub_uint64_t
|
grub_uint64_t
|
||||||
grub_get_time_ms (void)
|
grub_get_time_ms (void)
|
||||||
@@ -151,51 +149,3 @@ grub_get_time_ms (void)
|
|||||||
|
|
||||||
return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
|
return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
|
||||||
grub_util_get_image_size (const char *path)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
size_t ret;
|
|
||||||
off_t sz;
|
|
||||||
|
|
||||||
f = grub_util_fopen (path, "rb");
|
|
||||||
|
|
||||||
if (!f)
|
|
||||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
|
||||||
|
|
||||||
fseeko (f, 0, SEEK_END);
|
|
||||||
|
|
||||||
sz = ftello (f);
|
|
||||||
if (sz < 0)
|
|
||||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
|
||||||
if (sz != (size_t) sz)
|
|
||||||
grub_util_error (_("file `%s' is too big"), path);
|
|
||||||
ret = (size_t) sz;
|
|
||||||
|
|
||||||
fclose (f);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_util_load_image (const char *path, char *buf)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
grub_util_info ("reading %s", path);
|
|
||||||
|
|
||||||
size = grub_util_get_image_size (path);
|
|
||||||
|
|
||||||
fp = grub_util_fopen (path, "rb");
|
|
||||||
if (! fp)
|
|
||||||
grub_util_error (_("cannot open `%s': %s"), path,
|
|
||||||
strerror (errno));
|
|
||||||
|
|
||||||
if (fread (buf, 1, size, fp) != size)
|
|
||||||
grub_util_error (_("cannot read `%s': %s"), path,
|
|
||||||
strerror (errno));
|
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
@@ -89,11 +89,6 @@ grub_file_open (const char *name)
|
|||||||
|
|
||||||
file->device = device;
|
file->device = device;
|
||||||
|
|
||||||
/* In case of relative pathnames and non-Unix systems (like Windows)
|
|
||||||
* name of host files may not start with `/'. Blocklists for host files
|
|
||||||
* are meaningless as well (for a start, host disk does not allow any direct
|
|
||||||
* access - it is just a marker). So skip host disk in this case.
|
|
||||||
*/
|
|
||||||
if (device->disk && file_name[0] != '/'
|
if (device->disk && file_name[0] != '/'
|
||||||
#if defined(GRUB_UTIL) || defined(GRUB_MACHINE_EMU)
|
#if defined(GRUB_UTIL) || defined(GRUB_MACHINE_EMU)
|
||||||
&& grub_strcmp (device->disk->name, "host")
|
&& grub_strcmp (device->disk->name, "host")
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/* kern/i386/tsc.c - x86 TSC time source implementation
|
|
||||||
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
|
||||||
* This module uses the PIT to calibrate the TSC to
|
|
||||||
* real time.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i386/tsc.h>
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/efi/api.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_tsc_calibrate_from_efi (void)
|
|
||||||
{
|
|
||||||
grub_uint64_t start_tsc, end_tsc;
|
|
||||||
/* Use EFI Time Service to calibrate TSC */
|
|
||||||
start_tsc = grub_get_tsc ();
|
|
||||||
efi_call_1 (grub_efi_system_table->boot_services->stall, 1000);
|
|
||||||
end_tsc = grub_get_tsc ();
|
|
||||||
grub_tsc_rate = grub_divmod64 ((1ULL << 32), end_tsc - start_tsc, 0);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -44,13 +44,6 @@ FUNCTION(grub_bios_interrupt)
|
|||||||
movl 24(%edx), %esi
|
movl 24(%edx), %esi
|
||||||
movl 28(%edx), %edx
|
movl 28(%edx), %edx
|
||||||
|
|
||||||
/*
|
|
||||||
Via C3 CPUs have cache coherence problems, so we need to call
|
|
||||||
wbinvd at these 2 points. As wbinvd slows down boot, don't do
|
|
||||||
it on non-VIA. 9090 is nop nop. */
|
|
||||||
VARIABLE(grub_bios_via_workaround1)
|
|
||||||
.byte 0x90, 0x90
|
|
||||||
|
|
||||||
PROT_TO_REAL
|
PROT_TO_REAL
|
||||||
.code16
|
.code16
|
||||||
pushf
|
pushf
|
||||||
@@ -99,10 +92,6 @@ intno:
|
|||||||
movw %ax, LOCAL(bios_register_es)
|
movw %ax, LOCAL(bios_register_es)
|
||||||
|
|
||||||
popf
|
popf
|
||||||
|
|
||||||
VARIABLE(grub_bios_via_workaround2)
|
|
||||||
.byte 0x90, 0x90
|
|
||||||
|
|
||||||
REAL_TO_PROT
|
REAL_TO_PROT
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/cache.h>
|
#include <grub/cache.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/cpu/cpuid.h>
|
|
||||||
#include <grub/cpu/tsc.h>
|
#include <grub/cpu/tsc.h>
|
||||||
#include <grub/machine/time.h>
|
#include <grub/machine/time.h>
|
||||||
|
|
||||||
@@ -185,26 +184,6 @@ mmap_iterate_hook (grub_uint64_t addr, grub_uint64_t size,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern grub_uint16_t grub_bios_via_workaround1, grub_bios_via_workaround2;
|
|
||||||
|
|
||||||
/* Via needs additional wbinvd. */
|
|
||||||
static void
|
|
||||||
grub_via_workaround_init (void)
|
|
||||||
{
|
|
||||||
grub_uint32_t manufacturer[3], max_cpuid;
|
|
||||||
if (! grub_cpu_is_cpuid_supported ())
|
|
||||||
return;
|
|
||||||
|
|
||||||
grub_cpuid (0, max_cpuid, manufacturer[0], manufacturer[2], manufacturer[1]);
|
|
||||||
|
|
||||||
if (grub_memcmp (manufacturer, "CentaurHauls", 12) != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
grub_bios_via_workaround1 = 0x090f;
|
|
||||||
grub_bios_via_workaround2 = 0x090f;
|
|
||||||
asm volatile ("wbinvd");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_machine_init (void)
|
grub_machine_init (void)
|
||||||
{
|
{
|
||||||
@@ -214,9 +193,6 @@ grub_machine_init (void)
|
|||||||
#endif
|
#endif
|
||||||
grub_addr_t modend;
|
grub_addr_t modend;
|
||||||
|
|
||||||
/* This has to happen before any BIOS calls. */
|
|
||||||
grub_via_workaround_init ();
|
|
||||||
|
|
||||||
grub_modbase = GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR + (_edata - _start);
|
grub_modbase = GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR + (_edata - _start);
|
||||||
|
|
||||||
/* Initialize the console as early as possible. */
|
/* Initialize the console as early as possible. */
|
||||||
|
|||||||
+102
-19
@@ -1,6 +1,7 @@
|
|||||||
/* kern/i386/tsc.c - x86 TSC time source implementation
|
/* kern/i386/tsc.c - x86 TSC time source implementation
|
||||||
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
||||||
* This module calibrates the TSC to real time.
|
* This module uses the RTC (via grub_get_rtc()) to calibrate the TSC to
|
||||||
|
* real time.
|
||||||
*
|
*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
@@ -24,6 +25,12 @@
|
|||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/i386/tsc.h>
|
#include <grub/i386/tsc.h>
|
||||||
#include <grub/i386/cpuid.h>
|
#include <grub/i386/cpuid.h>
|
||||||
|
#ifdef GRUB_MACHINE_XEN
|
||||||
|
#include <grub/xen.h>
|
||||||
|
#else
|
||||||
|
#include <grub/i386/pit.h>
|
||||||
|
#endif
|
||||||
|
#include <grub/cpu/io.h>
|
||||||
|
|
||||||
/* This defines the value TSC had at the epoch (that is, when we calibrated it). */
|
/* This defines the value TSC had at the epoch (that is, when we calibrated it). */
|
||||||
static grub_uint64_t tsc_boot_time;
|
static grub_uint64_t tsc_boot_time;
|
||||||
@@ -33,6 +40,66 @@ static grub_uint64_t tsc_boot_time;
|
|||||||
in 32-bit. */
|
in 32-bit. */
|
||||||
grub_uint32_t grub_tsc_rate;
|
grub_uint32_t grub_tsc_rate;
|
||||||
|
|
||||||
|
/* Read the TSC value, which increments with each CPU clock cycle. */
|
||||||
|
static __inline grub_uint64_t
|
||||||
|
grub_get_tsc (void)
|
||||||
|
{
|
||||||
|
grub_uint32_t lo, hi;
|
||||||
|
grub_uint32_t a,b,c,d;
|
||||||
|
|
||||||
|
/* The CPUID instruction is a 'serializing' instruction, and
|
||||||
|
avoids out-of-order execution of the RDTSC instruction. */
|
||||||
|
grub_cpuid (0,a,b,c,d);
|
||||||
|
/* Read TSC value. We cannot use "=A", since this would use
|
||||||
|
%rax on x86_64. */
|
||||||
|
__asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi));
|
||||||
|
|
||||||
|
return (((grub_uint64_t) hi) << 32) | lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef GRUB_MACHINE_XEN
|
||||||
|
|
||||||
|
static __inline int
|
||||||
|
grub_cpu_is_tsc_supported (void)
|
||||||
|
{
|
||||||
|
grub_uint32_t a,b,c,d;
|
||||||
|
if (! grub_cpu_is_cpuid_supported ())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
grub_cpuid(1,a,b,c,d);
|
||||||
|
|
||||||
|
return (d & (1 << 4)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_pit_wait (grub_uint16_t tics)
|
||||||
|
{
|
||||||
|
/* Disable timer2 gate and speaker. */
|
||||||
|
grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT)
|
||||||
|
& ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2),
|
||||||
|
GRUB_PIT_SPEAKER_PORT);
|
||||||
|
|
||||||
|
/* Set tics. */
|
||||||
|
grub_outb (GRUB_PIT_CTRL_SELECT_2 | GRUB_PIT_CTRL_READLOAD_WORD,
|
||||||
|
GRUB_PIT_CTRL);
|
||||||
|
grub_outb (tics & 0xff, GRUB_PIT_COUNTER_2);
|
||||||
|
grub_outb (tics >> 8, GRUB_PIT_COUNTER_2);
|
||||||
|
|
||||||
|
/* Enable timer2 gate, keep speaker disabled. */
|
||||||
|
grub_outb ((grub_inb (GRUB_PIT_SPEAKER_PORT) & ~ GRUB_PIT_SPK_DATA)
|
||||||
|
| GRUB_PIT_SPK_TMR2,
|
||||||
|
GRUB_PIT_SPEAKER_PORT);
|
||||||
|
|
||||||
|
/* Wait. */
|
||||||
|
while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00);
|
||||||
|
|
||||||
|
/* Disable timer2 gate and speaker. */
|
||||||
|
grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT)
|
||||||
|
& ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2),
|
||||||
|
GRUB_PIT_SPEAKER_PORT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static grub_uint64_t
|
static grub_uint64_t
|
||||||
grub_tsc_get_time_ms (void)
|
grub_tsc_get_time_ms (void)
|
||||||
{
|
{
|
||||||
@@ -43,36 +110,52 @@ grub_tsc_get_time_ms (void)
|
|||||||
return ((al * grub_tsc_rate) >> 32) + ah * grub_tsc_rate;
|
return ((al * grub_tsc_rate) >> 32) + ah * grub_tsc_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
#ifndef GRUB_MACHINE_XEN
|
||||||
calibrate_tsc_hardcode (void)
|
/* Calibrate the TSC based on the RTC. */
|
||||||
|
static void
|
||||||
|
calibrate_tsc (void)
|
||||||
{
|
{
|
||||||
grub_tsc_rate = 5368;/* 800 MHz */
|
/* First calibrate the TSC rate (relative, not absolute time). */
|
||||||
return 1;
|
grub_uint64_t end_tsc;
|
||||||
|
|
||||||
|
tsc_boot_time = grub_get_tsc ();
|
||||||
|
grub_pit_wait (0xffff);
|
||||||
|
end_tsc = grub_get_tsc ();
|
||||||
|
|
||||||
|
grub_tsc_rate = 0;
|
||||||
|
if (end_tsc > tsc_boot_time)
|
||||||
|
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
|
||||||
|
if (grub_tsc_rate == 0)
|
||||||
|
grub_tsc_rate = 5368;/* 800 MHz */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_tsc_init (void)
|
grub_tsc_init (void)
|
||||||
{
|
{
|
||||||
if (!grub_cpu_is_tsc_supported ())
|
#ifdef GRUB_MACHINE_XEN
|
||||||
|
grub_uint64_t t;
|
||||||
|
tsc_boot_time = grub_get_tsc ();
|
||||||
|
t = grub_xen_shared_info->vcpu_info[0].time.tsc_to_system_mul;
|
||||||
|
if (grub_xen_shared_info->vcpu_info[0].time.tsc_shift > 0)
|
||||||
|
t <<= grub_xen_shared_info->vcpu_info[0].time.tsc_shift;
|
||||||
|
else
|
||||||
|
t >>= -grub_xen_shared_info->vcpu_info[0].time.tsc_shift;
|
||||||
|
grub_tsc_rate = grub_divmod64 (t, 1000000, 0);
|
||||||
|
grub_install_get_time_ms (grub_tsc_get_time_ms);
|
||||||
|
#else
|
||||||
|
if (grub_cpu_is_tsc_supported ())
|
||||||
|
{
|
||||||
|
calibrate_tsc ();
|
||||||
|
grub_install_get_time_ms (grub_tsc_get_time_ms);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_IEEE1275)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_IEEE1275)
|
||||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||||
#else
|
#else
|
||||||
grub_fatal ("no TSC found");
|
grub_fatal ("no TSC found");
|
||||||
#endif
|
#endif
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tsc_boot_time = grub_get_tsc ();
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_XEN
|
|
||||||
(void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode());
|
|
||||||
#elif defined (GRUB_MACHINE_EFI)
|
|
||||||
(void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode());
|
|
||||||
#elif defined (GRUB_MACHINE_COREBOOT)
|
|
||||||
(void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
|
|
||||||
#else
|
|
||||||
(void) (grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
|
|
||||||
#endif
|
#endif
|
||||||
grub_install_get_time_ms (grub_tsc_get_time_ms);
|
|
||||||
}
|
}
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/* kern/i386/tsc.c - x86 TSC time source implementation
|
|
||||||
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
|
||||||
* This module uses the PIT to calibrate the TSC to
|
|
||||||
* real time.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i386/tsc.h>
|
|
||||||
#include <grub/i386/pit.h>
|
|
||||||
#include <grub/cpu/io.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
grub_pit_wait (void)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
/* Disable timer2 gate and speaker. */
|
|
||||||
grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT)
|
|
||||||
& ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2),
|
|
||||||
GRUB_PIT_SPEAKER_PORT);
|
|
||||||
|
|
||||||
/* Set tics. */
|
|
||||||
grub_outb (GRUB_PIT_CTRL_SELECT_2 | GRUB_PIT_CTRL_READLOAD_WORD,
|
|
||||||
GRUB_PIT_CTRL);
|
|
||||||
/* 0xffff ticks: 55ms. */
|
|
||||||
grub_outb (0xff, GRUB_PIT_COUNTER_2);
|
|
||||||
grub_outb (0xff, GRUB_PIT_COUNTER_2);
|
|
||||||
|
|
||||||
/* Enable timer2 gate, keep speaker disabled. */
|
|
||||||
grub_outb ((grub_inb (GRUB_PIT_SPEAKER_PORT) & ~ GRUB_PIT_SPK_DATA)
|
|
||||||
| GRUB_PIT_SPK_TMR2,
|
|
||||||
GRUB_PIT_SPEAKER_PORT);
|
|
||||||
|
|
||||||
if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00) {
|
|
||||||
ret = 1;
|
|
||||||
/* Wait. */
|
|
||||||
while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disable timer2 gate and speaker. */
|
|
||||||
grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT)
|
|
||||||
& ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2),
|
|
||||||
GRUB_PIT_SPEAKER_PORT);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calibrate the TSC based on the RTC. */
|
|
||||||
int
|
|
||||||
grub_tsc_calibrate_from_pit (void)
|
|
||||||
{
|
|
||||||
/* First calibrate the TSC rate (relative, not absolute time). */
|
|
||||||
grub_uint64_t start_tsc, end_tsc;
|
|
||||||
|
|
||||||
start_tsc = grub_get_tsc ();
|
|
||||||
if (!grub_pit_wait ())
|
|
||||||
return 0;
|
|
||||||
end_tsc = grub_get_tsc ();
|
|
||||||
|
|
||||||
grub_tsc_rate = 0;
|
|
||||||
if (end_tsc > start_tsc)
|
|
||||||
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - start_tsc, 0);
|
|
||||||
if (grub_tsc_rate == 0)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/* kern/i386/tsc.c - x86 TSC time source implementation
|
|
||||||
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
|
||||||
* This module uses the PIT to calibrate the TSC to
|
|
||||||
* real time.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i386/tsc.h>
|
|
||||||
#include <grub/i386/pmtimer.h>
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
#include <grub/cpu/io.h>
|
|
||||||
|
|
||||||
grub_uint64_t
|
|
||||||
grub_pmtimer_wait_count_tsc (grub_port_t pmtimer,
|
|
||||||
grub_uint16_t num_pm_ticks)
|
|
||||||
{
|
|
||||||
grub_uint32_t start;
|
|
||||||
grub_uint32_t last;
|
|
||||||
grub_uint32_t cur, end;
|
|
||||||
grub_uint64_t start_tsc;
|
|
||||||
grub_uint64_t end_tsc;
|
|
||||||
int num_iter = 0;
|
|
||||||
|
|
||||||
start = grub_inl (pmtimer) & 0xffffff;
|
|
||||||
last = start;
|
|
||||||
end = start + num_pm_ticks;
|
|
||||||
start_tsc = grub_get_tsc ();
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
cur = grub_inl (pmtimer) & 0xffffff;
|
|
||||||
if (cur < last)
|
|
||||||
cur |= 0x1000000;
|
|
||||||
num_iter++;
|
|
||||||
if (cur >= end)
|
|
||||||
{
|
|
||||||
end_tsc = grub_get_tsc ();
|
|
||||||
return end_tsc - start_tsc;
|
|
||||||
}
|
|
||||||
/* Check for broken PM timer.
|
|
||||||
50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz)
|
|
||||||
if after this time we still don't have 1 ms on pmtimer, then
|
|
||||||
pmtimer is broken.
|
|
||||||
*/
|
|
||||||
if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_tsc_calibrate_from_pmtimer (void)
|
|
||||||
{
|
|
||||||
struct grub_acpi_fadt *fadt;
|
|
||||||
grub_port_t pmtimer;
|
|
||||||
grub_uint64_t tsc_diff;
|
|
||||||
|
|
||||||
fadt = grub_acpi_find_fadt ();
|
|
||||||
if (!fadt)
|
|
||||||
return 0;
|
|
||||||
pmtimer = fadt->pmtimer;
|
|
||||||
if (!pmtimer)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* It's 3.579545 MHz clock. Wait 1 ms. */
|
|
||||||
tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer, 3580);
|
|
||||||
if (tsc_diff == 0)
|
|
||||||
return 0;
|
|
||||||
grub_tsc_rate = grub_divmod64 ((1ULL << 32), tsc_diff, 0);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/* kern/i386/tsc.c - x86 TSC time source implementation
|
|
||||||
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
|
|
||||||
* This module uses the PIT to calibrate the TSC to
|
|
||||||
* real time.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/time.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/i386/tsc.h>
|
|
||||||
#include <grub/xen.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_tsc_calibrate_from_xen (void)
|
|
||||||
{
|
|
||||||
grub_uint64_t t;
|
|
||||||
t = grub_xen_shared_info->vcpu_info[0].time.tsc_to_system_mul;
|
|
||||||
if (grub_xen_shared_info->vcpu_info[0].time.tsc_shift > 0)
|
|
||||||
t <<= grub_xen_shared_info->vcpu_info[0].time.tsc_shift;
|
|
||||||
else
|
|
||||||
t >>= -grub_xen_shared_info->vcpu_info[0].time.tsc_shift;
|
|
||||||
grub_tsc_rate = grub_divmod64 (t, 1000000, 0);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -46,19 +46,11 @@
|
|||||||
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
|
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
|
||||||
|
|
||||||
/* The maximum heap size we're going to claim */
|
/* The maximum heap size we're going to claim */
|
||||||
#ifdef __i386__
|
|
||||||
#define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024)
|
|
||||||
#else
|
|
||||||
#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024)
|
#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024)
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If possible, we will avoid claiming heap above this address, because it
|
/* If possible, we will avoid claiming heap above this address, because it
|
||||||
seems to cause relocation problems with OSes that link at 4 MiB */
|
seems to cause relocation problems with OSes that link at 4 MiB */
|
||||||
#ifdef __i386__
|
|
||||||
#define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024)
|
|
||||||
#else
|
|
||||||
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
|
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char _start[];
|
extern char _start[];
|
||||||
extern char _end[];
|
extern char _end[];
|
||||||
@@ -174,7 +166,7 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type,
|
|||||||
{
|
{
|
||||||
unsigned long *total = data;
|
unsigned long *total = data;
|
||||||
|
|
||||||
if (type != GRUB_MEMORY_AVAILABLE)
|
if (type != 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM))
|
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM))
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|||||||
{
|
{
|
||||||
grub_ieee1275_phandle_t root;
|
grub_ieee1275_phandle_t root;
|
||||||
grub_ieee1275_phandle_t memory;
|
grub_ieee1275_phandle_t memory;
|
||||||
grub_uint32_t available[128];
|
grub_uint32_t available[32];
|
||||||
grub_ssize_t available_size;
|
grub_ssize_t available_size;
|
||||||
grub_uint32_t address_cells = 1;
|
grub_uint32_t address_cells = 1;
|
||||||
grub_uint32_t size_cells = 1;
|
grub_uint32_t size_cells = 1;
|
||||||
@@ -49,9 +49,6 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|||||||
sizeof available, &available_size))
|
sizeof available, &available_size))
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||||
"couldn't examine /memory/available property");
|
"couldn't examine /memory/available property");
|
||||||
if (available_size < 0 || (grub_size_t) available_size > sizeof (available))
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
|
||||||
"/memory response buffer exceeded");
|
|
||||||
|
|
||||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
|
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -740,12 +740,6 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
|
|||||||
fmt++;
|
fmt++;
|
||||||
|
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
if (c == '%')
|
|
||||||
{
|
|
||||||
n--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c == 'l')
|
if (c == 'l')
|
||||||
{
|
{
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
@@ -882,7 +876,6 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
|
|||||||
if (c == '%')
|
if (c == '%')
|
||||||
{
|
{
|
||||||
write_char (str, &count, max_len,c);
|
write_char (str, &count, max_len,c);
|
||||||
n--;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1106,8 +1099,6 @@ grub_fatal (const char *fmt, ...)
|
|||||||
grub_vprintf (_(fmt), ap);
|
grub_vprintf (_(fmt), ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
grub_refresh ();
|
|
||||||
|
|
||||||
grub_abort ();
|
grub_abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,15 +325,6 @@ grub_memalign (grub_size_t align, grub_size_t size)
|
|||||||
if (!grub_mm_base)
|
if (!grub_mm_base)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (size > ~(grub_size_t) align)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* We currently assume at least a 32-bit grub_size_t,
|
|
||||||
so limiting allocations to <adress space size> - 1MiB
|
|
||||||
in name of sanity is beneficial. */
|
|
||||||
if ((size + align) > ~(grub_size_t) 0x100000)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
align = (align >> GRUB_MM_ALIGN_LOG2);
|
align = (align >> GRUB_MM_ALIGN_LOG2);
|
||||||
if (align == 0)
|
if (align == 0)
|
||||||
align = 1;
|
align = 1;
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ grub_parser_execute (char *source)
|
|||||||
grub_parser_execute_getline (&line, 0, &source);
|
grub_parser_execute_getline (&line, 0, &source);
|
||||||
grub_rescue_parse_line (line, grub_parser_execute_getline, &source);
|
grub_rescue_parse_line (line, grub_parser_execute_getline, &source);
|
||||||
grub_free (line);
|
grub_free (line);
|
||||||
grub_print_error ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|||||||
@@ -43,17 +43,13 @@ grub_rescue_parse_line (char *line,
|
|||||||
|
|
||||||
/* In case of an assignment set the environment accordingly
|
/* In case of an assignment set the environment accordingly
|
||||||
instead of calling a function. */
|
instead of calling a function. */
|
||||||
if (n == 1)
|
if (n == 1 && grub_strchr (line, '='))
|
||||||
{
|
{
|
||||||
char *val = grub_strchr (args[0], '=');
|
char *val = grub_strchr (args[0], '=');
|
||||||
|
val[0] = 0;
|
||||||
if (val)
|
grub_env_set (args[0], val + 1);
|
||||||
{
|
val[0] = '=';
|
||||||
val[0] = 0;
|
goto quit;
|
||||||
grub_env_set (args[0], val + 1);
|
|
||||||
val[0] = '=';
|
|
||||||
goto quit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the command name. */
|
/* Get the command name. */
|
||||||
@@ -76,7 +72,6 @@ grub_rescue_parse_line (char *line,
|
|||||||
}
|
}
|
||||||
|
|
||||||
quit:
|
quit:
|
||||||
/* Arguments are returned in single memory chunk separated by zeroes */
|
|
||||||
grub_free (args[0]);
|
grub_free (args[0]);
|
||||||
grub_free (args);
|
grub_free (args);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ FUNCTION(grub_longjmp)
|
|||||||
ldp x29, x30, [x0], #16
|
ldp x29, x30, [x0], #16
|
||||||
ldr x2, [x0]
|
ldr x2, [x0]
|
||||||
mov sp, x2
|
mov sp, x2
|
||||||
mov x0, #1
|
|
||||||
cmp x1, #0
|
cmp x1, #0
|
||||||
csel x0, x1, x0, ne
|
csel x0, x1, x0, ne
|
||||||
ret
|
ret
|
||||||
@@ -470,8 +470,7 @@ grub_password_get (char buf[], unsigned buf_size)
|
|||||||
|
|
||||||
if (key == '\b')
|
if (key == '\b')
|
||||||
{
|
{
|
||||||
if (cur_len)
|
cur_len--;
|
||||||
cur_len--;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
#include <grub/fdt.h>
|
#include <grub/fdt.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/dl.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
|
||||||
|
|
||||||
#define FDT_SUPPORTED_VERSION 17
|
#define FDT_SUPPORTED_VERSION 17
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ void
|
|||||||
grub_backtrace (void)
|
grub_backtrace (void)
|
||||||
{
|
{
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
asm volatile ("movq %%rbp, %%rdi\n"
|
asm volatile ("movq %rbp, %rdi\n"
|
||||||
"callq *%%rax": :"a"(grub_backtrace_pointer));
|
"call " EXT_C("grub_backtrace_pointer"));
|
||||||
#else
|
#else
|
||||||
asm volatile ("movl %%ebp, %%eax\n"
|
asm volatile ("movl %ebp, %eax\n"
|
||||||
"calll *%%ecx": :"c"(grub_backtrace_pointer));
|
"call " EXT_C("grub_backtrace_pointer"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2016 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/random.h>
|
|
||||||
#include <grub/i386/io.h>
|
|
||||||
#include <grub/i386/tsc.h>
|
|
||||||
#include <grub/i386/pmtimer.h>
|
|
||||||
#include <grub/acpi.h>
|
|
||||||
|
|
||||||
static int have_tsc = -1, have_pmtimer = -1;
|
|
||||||
static grub_port_t pmtimer_port;
|
|
||||||
|
|
||||||
static int
|
|
||||||
detect_pmtimer (void)
|
|
||||||
{
|
|
||||||
struct grub_acpi_fadt *fadt;
|
|
||||||
fadt = grub_acpi_find_fadt ();
|
|
||||||
if (!fadt)
|
|
||||||
return 0;
|
|
||||||
pmtimer_port = fadt->pmtimer;
|
|
||||||
if (!pmtimer_port)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
pmtimer_tsc_get_random_bit (void)
|
|
||||||
{
|
|
||||||
/* It's hard to come up with figures about pmtimer and tsc jitter but
|
|
||||||
50 ppm seems to be typical. So we need 10^6/50 tsc cycles to get drift
|
|
||||||
of one tsc cycle. With TSC at least of 800 MHz it means 1/(50*800)
|
|
||||||
= 1/40000 s or about 3579545 / 40000 = 90 pmtimer ticks.
|
|
||||||
This gives us rate of 40000 bit/s or 5 kB/s.
|
|
||||||
*/
|
|
||||||
grub_uint64_t tsc_diff;
|
|
||||||
tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer_port, 90);
|
|
||||||
if (tsc_diff == 0)
|
|
||||||
{
|
|
||||||
have_pmtimer = 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return tsc_diff & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
pmtimer_tsc_get_random_byte (void)
|
|
||||||
{
|
|
||||||
grub_uint8_t ret = 0;
|
|
||||||
int i, c;
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
c = pmtimer_tsc_get_random_bit ();
|
|
||||||
if (c < 0)
|
|
||||||
return -1;
|
|
||||||
ret |= c << i;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
pmtimer_fill_buffer (void *buffer, grub_size_t sz)
|
|
||||||
{
|
|
||||||
grub_uint8_t *p = buffer;
|
|
||||||
int c;
|
|
||||||
while (sz)
|
|
||||||
{
|
|
||||||
c = pmtimer_tsc_get_random_byte ();
|
|
||||||
if (c < 0)
|
|
||||||
return 0;
|
|
||||||
*p++ = c;
|
|
||||||
sz--;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_crypto_arch_get_random (void *buffer, grub_size_t sz)
|
|
||||||
{
|
|
||||||
if (have_tsc == -1)
|
|
||||||
have_tsc = grub_cpu_is_tsc_supported ();
|
|
||||||
if (!have_tsc)
|
|
||||||
return 0;
|
|
||||||
if (have_pmtimer == -1)
|
|
||||||
have_pmtimer = detect_pmtimer ();
|
|
||||||
if (!have_pmtimer)
|
|
||||||
return 0;
|
|
||||||
return pmtimer_fill_buffer (buffer, sz);
|
|
||||||
}
|
|
||||||
@@ -95,7 +95,7 @@ grub_get_datetime (struct grub_datetime *datetime)
|
|||||||
|
|
||||||
datetime->year = args.year;
|
datetime->year = args.year;
|
||||||
datetime->month = args.month;
|
datetime->month = args.month;
|
||||||
datetime->day = args.day + 1;
|
datetime->day = args.day;
|
||||||
datetime->hour = args.hour;
|
datetime->hour = args.hour;
|
||||||
datetime->minute = args.minute;
|
datetime->minute = args.minute;
|
||||||
datetime->second = args.second;
|
datetime->second = args.second;
|
||||||
@@ -140,7 +140,7 @@ grub_set_datetime (struct grub_datetime *datetime)
|
|||||||
|
|
||||||
args.year = datetime->year;
|
args.year = datetime->year;
|
||||||
args.month = datetime->month;
|
args.month = datetime->month;
|
||||||
args.day = datetime->day - 1;
|
args.day = datetime->day;
|
||||||
args.hour = datetime->hour;
|
args.hour = datetime->hour;
|
||||||
args.minute = datetime->minute;
|
args.minute = datetime->minute;
|
||||||
args.second = datetime->second;
|
args.second = datetime->second;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv2+");
|
|||||||
desired derived output length DKLEN. Output buffer is DK which
|
desired derived output length DKLEN. Output buffer is DK which
|
||||||
must have room for at least DKLEN octets. The output buffer will
|
must have room for at least DKLEN octets. The output buffer will
|
||||||
be filled with the derived data. */
|
be filled with the derived data. */
|
||||||
|
#pragma GCC diagnostic ignored "-Wunreachable-code"
|
||||||
|
|
||||||
gcry_err_code_t
|
gcry_err_code_t
|
||||||
grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
|
grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
|
||||||
|
|||||||
@@ -38,17 +38,11 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)),
|
|||||||
grub_uint64_t now;
|
grub_uint64_t now;
|
||||||
static grub_uint64_t last_progress_update_time;
|
static grub_uint64_t last_progress_update_time;
|
||||||
grub_file_t file = data;
|
grub_file_t file = data;
|
||||||
const char *e;
|
|
||||||
file->progress_offset += length;
|
file->progress_offset += length;
|
||||||
|
|
||||||
if (call_depth)
|
if (call_depth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
e = grub_env_get ("enable_progress_indicator");
|
|
||||||
if (e && e[0] == '0') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
call_depth = 1;
|
call_depth = 1;
|
||||||
now = grub_get_time_ms ();
|
now = grub_get_time_ms ();
|
||||||
|
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2016 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/random.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/lib/hexdump.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_crypto_get_random (void *buffer, grub_size_t sz)
|
|
||||||
{
|
|
||||||
/* This is an arbitrer between different methods.
|
|
||||||
TODO: Add more methods in the future. */
|
|
||||||
/* TODO: Add some PRNG smartness to reduce damage from bad entropy. */
|
|
||||||
if (grub_crypto_arch_get_random (buffer, sz))
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
return grub_error (GRUB_ERR_IO, "no random sources found");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
get_num_digits (int val)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
while (val != 0)
|
|
||||||
{
|
|
||||||
ret++;
|
|
||||||
val /= 10;
|
|
||||||
}
|
|
||||||
if (ret == 0)
|
|
||||||
return 1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_hexdump_random (grub_command_t cmd __attribute__ ((unused)), int argc, char **args)
|
|
||||||
{
|
|
||||||
grub_size_t length = 64;
|
|
||||||
grub_err_t err;
|
|
||||||
void *buffer;
|
|
||||||
grub_uint8_t *ptr;
|
|
||||||
int stats[256];
|
|
||||||
int i, digits = 2;
|
|
||||||
char template[10];
|
|
||||||
|
|
||||||
if (argc >= 1)
|
|
||||||
length = grub_strtoull (args[0], 0, 0);
|
|
||||||
|
|
||||||
if (length == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "length pust be positive");
|
|
||||||
|
|
||||||
buffer = grub_malloc (length);
|
|
||||||
if (!buffer)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
err = grub_crypto_get_random (buffer, length);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (buffer);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
hexdump (0, buffer, length);
|
|
||||||
grub_memset(stats, 0, sizeof(stats));
|
|
||||||
for (ptr = buffer; ptr < (grub_uint8_t *) buffer + length; ptr++)
|
|
||||||
stats[*ptr]++;
|
|
||||||
grub_printf ("Statistics:\n");
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
int z = get_num_digits (stats[i]);
|
|
||||||
if (z > digits)
|
|
||||||
digits = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_snprintf (template, sizeof (template), "%%0%dd ", digits);
|
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
grub_printf ("%s", template);//, stats[i]);
|
|
||||||
if ((i & 0xf) == 0xf)
|
|
||||||
grub_printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (buffer);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (random)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("hexdump_random", grub_cmd_hexdump_random,
|
|
||||||
N_("[LENGTH]"),
|
|
||||||
N_("Hexdump random data."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (random)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
||||||
+20
-30
@@ -736,36 +736,26 @@ malloc_in_range (struct grub_relocator *rel,
|
|||||||
}
|
}
|
||||||
isinsideafter = (!ncollisions && (nstarted || ((nlefto || nstartedfw)
|
isinsideafter = (!ncollisions && (nstarted || ((nlefto || nstartedfw)
|
||||||
&& !nblockfw)));
|
&& !nblockfw)));
|
||||||
if (from_low_priv) {
|
if (!isinsidebefore && isinsideafter)
|
||||||
if (!isinsidebefore && isinsideafter)
|
starta = from_low_priv ? ALIGN_UP (events[j].pos, align)
|
||||||
starta = ALIGN_UP (events[j].pos, align);
|
: ALIGN_DOWN (events[j].pos - size, align) + size;
|
||||||
|
if (isinsidebefore && !isinsideafter && from_low_priv)
|
||||||
if (isinsidebefore && !isinsideafter)
|
{
|
||||||
{
|
target = starta;
|
||||||
target = starta;
|
if (target < start)
|
||||||
if (target < start)
|
target = start;
|
||||||
target = start;
|
if (target + size <= end && target + size <= events[j].pos)
|
||||||
if (target + size <= end && target + size <= events[j].pos)
|
/* Found an usable address. */
|
||||||
/* Found an usable address. */
|
goto found;
|
||||||
goto found;
|
}
|
||||||
}
|
if (isinsidebefore && !isinsideafter && !from_low_priv)
|
||||||
} else {
|
{
|
||||||
if (!isinsidebefore && isinsideafter)
|
target = starta - size;
|
||||||
{
|
if (target > end - size)
|
||||||
if (events[j].pos >= size)
|
target = end - size;
|
||||||
starta = ALIGN_DOWN (events[j].pos - size, align) + size;
|
if (target >= start && target >= events[j].pos)
|
||||||
else
|
goto found;
|
||||||
starta = 0;
|
}
|
||||||
}
|
|
||||||
if (isinsidebefore && !isinsideafter && starta >= size)
|
|
||||||
{
|
|
||||||
target = starta - size;
|
|
||||||
if (target > end - size)
|
|
||||||
target = end - size;
|
|
||||||
if (target >= start && target >= events[j].pos)
|
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ VARIABLE(grub_relocator_xen_mfn_list)
|
|||||||
|
|
||||||
loop 1b
|
loop 1b
|
||||||
|
|
||||||
leaq LOCAL(mmu_op) (%rip), %rdi
|
leaq EXT_C(grub_relocator_xen_mmu_op) (%rip), %rdi
|
||||||
movq $3, %rsi
|
movq $3, %rsi
|
||||||
movq $0, %rdx
|
movq $0, %rdx
|
||||||
movq $0x7FF0, %r10
|
movq $0x7FF0, %r10
|
||||||
@@ -104,7 +104,6 @@ VARIABLE(grub_relocator_xen_remap_continue)
|
|||||||
|
|
||||||
jmp *%rax
|
jmp *%rax
|
||||||
|
|
||||||
LOCAL(mmu_op):
|
|
||||||
VARIABLE(grub_relocator_xen_mmu_op)
|
VARIABLE(grub_relocator_xen_mmu_op)
|
||||||
.space 256
|
.space 256
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,16 @@
|
|||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#define XEN_HYPERVISOR_NAME "xen_hypervisor"
|
#define XEN_HYPERVISOR_NAME "xen_hypervisor"
|
||||||
|
|
||||||
|
#define MODULE_DEFAULT_ALIGN (0x0)
|
||||||
|
#define MODULE_IMAGE_MIN_ALIGN MODULE_DEFAULT_ALIGN
|
||||||
|
#define MODULE_INITRD_MIN_ALIGN MODULE_DEFAULT_ALIGN
|
||||||
|
#define MODULE_XSM_MIN_ALIGN MODULE_DEFAULT_ALIGN
|
||||||
|
#define MODULE_CUSTOM_MIN_ALIGN MODULE_DEFAULT_ALIGN
|
||||||
|
|
||||||
|
#define MODULE_IMAGE_COMPATIBLE "multiboot,kernel\0multiboot,module"
|
||||||
|
#define MODULE_INITRD_COMPATIBLE "multiboot,ramdisk\0multiboot,module"
|
||||||
|
#define MODULE_XSM_COMPATIBLE "xen,xsm-policy\0multiboot,module"
|
||||||
#define MODULE_CUSTOM_COMPATIBLE "multiboot,module"
|
#define MODULE_CUSTOM_COMPATIBLE "multiboot,module"
|
||||||
|
|
||||||
/* This maximum size is defined in Power.org ePAPR V1.1
|
/* This maximum size is defined in Power.org ePAPR V1.1
|
||||||
@@ -64,6 +74,14 @@ enum module_type
|
|||||||
};
|
};
|
||||||
typedef enum module_type module_type_t;
|
typedef enum module_type module_type_t;
|
||||||
|
|
||||||
|
struct fdt_node_info
|
||||||
|
{
|
||||||
|
module_type_t type;
|
||||||
|
|
||||||
|
const char *compat_string;
|
||||||
|
grub_size_t compat_string_size;
|
||||||
|
};
|
||||||
|
|
||||||
struct xen_hypervisor_header
|
struct xen_hypervisor_header
|
||||||
{
|
{
|
||||||
struct grub_arm64_linux_kernel_header efi_head;
|
struct grub_arm64_linux_kernel_header efi_head;
|
||||||
@@ -80,7 +98,7 @@ struct xen_boot_binary
|
|||||||
{
|
{
|
||||||
struct xen_boot_binary *next;
|
struct xen_boot_binary *next;
|
||||||
struct xen_boot_binary **prev;
|
struct xen_boot_binary **prev;
|
||||||
int is_hypervisor;
|
const char *name;
|
||||||
|
|
||||||
grub_addr_t start;
|
grub_addr_t start;
|
||||||
grub_size_t size;
|
grub_size_t size;
|
||||||
@@ -88,6 +106,8 @@ struct xen_boot_binary
|
|||||||
|
|
||||||
char *cmdline;
|
char *cmdline;
|
||||||
int cmdline_size;
|
int cmdline_size;
|
||||||
|
|
||||||
|
struct fdt_node_info node_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
@@ -96,6 +116,19 @@ static int loaded;
|
|||||||
|
|
||||||
static struct xen_boot_binary *xen_hypervisor;
|
static struct xen_boot_binary *xen_hypervisor;
|
||||||
static struct xen_boot_binary *module_head;
|
static struct xen_boot_binary *module_head;
|
||||||
|
static const grub_size_t module_default_align[] = {
|
||||||
|
MODULE_IMAGE_MIN_ALIGN,
|
||||||
|
MODULE_INITRD_MIN_ALIGN,
|
||||||
|
MODULE_XSM_MIN_ALIGN,
|
||||||
|
MODULE_CUSTOM_MIN_ALIGN
|
||||||
|
};
|
||||||
|
|
||||||
|
static const compat_string_struct_t default_compat_string[] = {
|
||||||
|
FDT_COMPATIBLE (MODULE_IMAGE_COMPATIBLE),
|
||||||
|
FDT_COMPATIBLE (MODULE_INITRD_COMPATIBLE),
|
||||||
|
FDT_COMPATIBLE (MODULE_XSM_COMPATIBLE),
|
||||||
|
FDT_COMPATIBLE (MODULE_CUSTOM_COMPATIBLE)
|
||||||
|
};
|
||||||
|
|
||||||
static __inline grub_addr_t
|
static __inline grub_addr_t
|
||||||
xen_boot_address_align (grub_addr_t start, grub_size_t align)
|
xen_boot_address_align (grub_addr_t start, grub_size_t align)
|
||||||
@@ -103,6 +136,26 @@ xen_boot_address_align (grub_addr_t start, grub_size_t align)
|
|||||||
return (align ? (ALIGN_UP (start, align)) : start);
|
return (align ? (ALIGN_UP (start, align)) : start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Parse the option of xen_module command. For now, we support
|
||||||
|
(1) --type <the compatible stream>
|
||||||
|
We also set up the type of module in this function.
|
||||||
|
If there are some "--type" options in the command line,
|
||||||
|
we make a custom compatible stream in this function. */
|
||||||
|
static grub_err_t
|
||||||
|
set_module_type (grub_command_t cmd, struct xen_boot_binary *module, int *file_name_index)
|
||||||
|
{
|
||||||
|
*file_name_index = 0;
|
||||||
|
|
||||||
|
if (!grub_strcmp (cmd->name, "xen_linux"))
|
||||||
|
module->node_info.type = MODULE_IMAGE;
|
||||||
|
else if (!grub_strcmp (cmd->name, "xen_initrd"))
|
||||||
|
module->node_info.type = MODULE_INITRD;
|
||||||
|
else if (!grub_strcmp (cmd->name, "xen_xsm"))
|
||||||
|
module->node_info.type = MODULE_XSM;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
prepare_xen_hypervisor_params (void *xen_boot_fdt)
|
prepare_xen_hypervisor_params (void *xen_boot_fdt)
|
||||||
{
|
{
|
||||||
@@ -156,11 +209,15 @@ prepare_xen_module_params (struct xen_boot_binary *module, void *xen_boot_fdt)
|
|||||||
grub_fdt_add_subnode (xen_boot_fdt, chosen_node, module_name);
|
grub_fdt_add_subnode (xen_boot_fdt, chosen_node, module_name);
|
||||||
|
|
||||||
retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "compatible",
|
retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "compatible",
|
||||||
MODULE_CUSTOM_COMPATIBLE, sizeof(MODULE_CUSTOM_COMPATIBLE) - 1);
|
module->node_info.compat_string,
|
||||||
|
(grub_uint32_t) module->
|
||||||
|
node_info.compat_string_size);
|
||||||
if (retval)
|
if (retval)
|
||||||
return grub_error (GRUB_ERR_IO, "failed to update FDT");
|
return grub_error (GRUB_ERR_IO, "failed to update FDT");
|
||||||
|
|
||||||
grub_dprintf ("xen_loader", "Module\n");
|
grub_dprintf ("xen_loader", "Module %s compatible = %s size = 0x%lx\n",
|
||||||
|
module->name, module->node_info.compat_string,
|
||||||
|
module->node_info.compat_string_size);
|
||||||
|
|
||||||
retval = grub_fdt_set_reg64 (xen_boot_fdt, module_node,
|
retval = grub_fdt_set_reg64 (xen_boot_fdt, module_node,
|
||||||
xen_boot_address_align (module->start,
|
xen_boot_address_align (module->start,
|
||||||
@@ -172,7 +229,7 @@ prepare_xen_module_params (struct xen_boot_binary *module, void *xen_boot_fdt)
|
|||||||
if (module->cmdline && module->cmdline_size > 0)
|
if (module->cmdline && module->cmdline_size > 0)
|
||||||
{
|
{
|
||||||
grub_dprintf ("xen_loader",
|
grub_dprintf ("xen_loader",
|
||||||
"Module cmdline : %s @ %p size:%d\n",
|
"Module %s cmdline : %s @ %p size:%d\n", module->name,
|
||||||
module->cmdline, module->cmdline, module->cmdline_size);
|
module->cmdline, module->cmdline, module->cmdline_size);
|
||||||
|
|
||||||
retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "bootargs",
|
retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "bootargs",
|
||||||
@@ -182,7 +239,8 @@ prepare_xen_module_params (struct xen_boot_binary *module, void *xen_boot_fdt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_dprintf ("xen_loader", "Module has no bootargs!\n");
|
grub_dprintf ("xen_loader", "Module %s has not bootargs!\n",
|
||||||
|
module->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@@ -199,8 +257,8 @@ finalize_params_xen_boot (void)
|
|||||||
additional_size += FDT_NODE_NAME_MAX_SIZE + xen_hypervisor->cmdline_size;
|
additional_size += FDT_NODE_NAME_MAX_SIZE + xen_hypervisor->cmdline_size;
|
||||||
FOR_LIST_ELEMENTS (module, module_head)
|
FOR_LIST_ELEMENTS (module, module_head)
|
||||||
{
|
{
|
||||||
additional_size += 6 * FDT_NODE_NAME_MAX_SIZE + sizeof(MODULE_CUSTOM_COMPATIBLE) - 1
|
additional_size += 6 * FDT_NODE_NAME_MAX_SIZE + module->
|
||||||
+ module->cmdline_size;
|
node_info.compat_string_size + module->cmdline_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
xen_boot_fdt = grub_fdt_load (additional_size);
|
xen_boot_fdt = grub_fdt_load (additional_size);
|
||||||
@@ -223,7 +281,8 @@ finalize_params_xen_boot (void)
|
|||||||
{
|
{
|
||||||
if (module->start && module->size > 0)
|
if (module->start && module->size > 0)
|
||||||
{
|
{
|
||||||
grub_dprintf ("xen_loader", "Module @ 0x%lx size:0x%lx\n",
|
grub_dprintf ("xen_loader", "Module %s @ 0x%lx size:0x%lx\n",
|
||||||
|
module->name,
|
||||||
xen_boot_address_align (module->start, module->align),
|
xen_boot_address_align (module->start, module->align),
|
||||||
module->size);
|
module->size);
|
||||||
if (prepare_xen_module_params (module, xen_boot_fdt) != GRUB_ERR_NONE)
|
if (prepare_xen_module_params (module, xen_boot_fdt) != GRUB_ERR_NONE)
|
||||||
@@ -231,7 +290,7 @@ finalize_params_xen_boot (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_dprintf ("xen_loader", "Module info error!\n");
|
grub_dprintf ("xen_loader", "Module info error: %s!\n", module->name);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,16 +333,19 @@ single_binary_unload (struct xen_boot_binary *binary)
|
|||||||
{
|
{
|
||||||
grub_free (binary->cmdline);
|
grub_free (binary->cmdline);
|
||||||
grub_dprintf ("xen_loader",
|
grub_dprintf ("xen_loader",
|
||||||
"Module cmdline memory free @ %p size: %d\n",
|
"Module %s cmdline memory free @ %p size: %d\n",
|
||||||
binary->cmdline, binary->cmdline_size);
|
binary->name, binary->cmdline, binary->cmdline_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!binary->is_hypervisor)
|
if (binary->node_info.type == MODULE_CUSTOM)
|
||||||
|
grub_free ((void *) binary->node_info.compat_string);
|
||||||
|
|
||||||
|
if (grub_strcmp (binary->name, XEN_HYPERVISOR_NAME))
|
||||||
grub_list_remove (GRUB_AS_LIST (binary));
|
grub_list_remove (GRUB_AS_LIST (binary));
|
||||||
|
|
||||||
grub_dprintf ("xen_loader",
|
grub_dprintf ("xen_loader",
|
||||||
"Module struct memory free @ %p size: 0x%lx\n",
|
"Module %s struct memory free @ %p size: 0x%lx\n",
|
||||||
binary, sizeof (binary));
|
binary->name, binary, sizeof (binary));
|
||||||
grub_free (binary);
|
grub_free (binary);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -321,7 +383,8 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file,
|
|||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
binary->size = grub_file_size (file);
|
binary->size = grub_file_size (file);
|
||||||
grub_dprintf ("xen_loader", "Xen_boot file size: 0x%lx\n", binary->size);
|
grub_dprintf ("xen_loader", "Xen_boot %s file size: 0x%lx\n",
|
||||||
|
binary->name, binary->size);
|
||||||
|
|
||||||
binary->start
|
binary->start
|
||||||
= (grub_addr_t) grub_efi_allocate_pages (0,
|
= (grub_addr_t) grub_efi_allocate_pages (0,
|
||||||
@@ -334,8 +397,8 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("xen_loader", "Xen_boot numpages: 0x%lx\n",
|
grub_dprintf ("xen_loader", "Xen_boot %s numpages: 0x%lx\n",
|
||||||
GRUB_EFI_BYTES_TO_PAGES (binary->size + binary->align));
|
binary->name, GRUB_EFI_BYTES_TO_PAGES (binary->size + binary->align));
|
||||||
|
|
||||||
if (grub_file_read (file, (void *) xen_boot_address_align (binary->start,
|
if (grub_file_read (file, (void *) xen_boot_address_align (binary->start,
|
||||||
binary->align),
|
binary->align),
|
||||||
@@ -359,7 +422,7 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file,
|
|||||||
grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
|
grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline,
|
||||||
binary->cmdline_size);
|
binary->cmdline_size);
|
||||||
grub_dprintf ("xen_loader",
|
grub_dprintf ("xen_loader",
|
||||||
"Xen_boot cmdline @ %p %s, size: %d\n",
|
"Xen_boot %s cmdline @ %p %s, size: %d\n", binary->name,
|
||||||
binary->cmdline, binary->cmdline, binary->cmdline_size);
|
binary->cmdline, binary->cmdline, binary->cmdline_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -373,11 +436,11 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
|
grub_cmd_xen_module (grub_command_t cmd, int argc, char *argv[])
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
|
|
||||||
struct xen_boot_binary *module = NULL;
|
struct xen_boot_binary *module = NULL;
|
||||||
|
int file_name_index = 0;
|
||||||
grub_file_t file = 0;
|
grub_file_t file = 0;
|
||||||
|
|
||||||
if (!argc)
|
if (!argc)
|
||||||
@@ -398,20 +461,46 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
|
|||||||
if (!module)
|
if (!module)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
module->is_hypervisor = 0;
|
/* process all the options and get module type */
|
||||||
module->align = 4096;
|
if (set_module_type (cmd, module, &file_name_index) !=
|
||||||
|
GRUB_ERR_NONE)
|
||||||
|
goto fail;
|
||||||
|
switch (module->node_info.type)
|
||||||
|
{
|
||||||
|
case MODULE_IMAGE:
|
||||||
|
case MODULE_INITRD:
|
||||||
|
case MODULE_XSM:
|
||||||
|
module->node_info.compat_string =
|
||||||
|
default_compat_string[module->node_info.type].compat_string;
|
||||||
|
module->node_info.compat_string_size =
|
||||||
|
default_compat_string[module->node_info.type].size;
|
||||||
|
break;
|
||||||
|
|
||||||
grub_dprintf ("xen_loader", "Init module and node info\n");
|
case MODULE_CUSTOM:
|
||||||
|
/* we have set the node_info in set_module_type */
|
||||||
|
break;
|
||||||
|
|
||||||
file = grub_file_open (argv[0]);
|
default:
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid argument"));
|
||||||
|
}
|
||||||
|
module->name = module->node_info.compat_string;
|
||||||
|
module->align = module_default_align[module->node_info.type];
|
||||||
|
|
||||||
|
grub_dprintf ("xen_loader", "Init %s module and node info:\n"
|
||||||
|
"compatible %s\ncompat_string_size 0x%lx\n",
|
||||||
|
module->name, module->node_info.compat_string,
|
||||||
|
module->node_info.compat_string_size);
|
||||||
|
|
||||||
|
file = grub_file_open (argv[file_name_index]);
|
||||||
if (!file)
|
if (!file)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
xen_boot_binary_load (module, file, argc, argv);
|
xen_boot_binary_load (module, file, argc - file_name_index,
|
||||||
|
argv + file_name_index);
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
if (grub_errno == GRUB_ERR_NONE)
|
||||||
grub_list_push (GRUB_AS_LIST_P (&module_head), GRUB_AS_LIST (module));
|
grub_list_push (GRUB_AS_LIST_P (&module_head), GRUB_AS_LIST (module));
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (file)
|
if (file)
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
if (grub_errno != GRUB_ERR_NONE)
|
||||||
@@ -455,7 +544,7 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
if (!xen_hypervisor)
|
if (!xen_hypervisor)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
xen_hypervisor->is_hypervisor = 1;
|
xen_hypervisor->name = XEN_HYPERVISOR_NAME;
|
||||||
xen_hypervisor->align = (grub_size_t) sh.optional_header.section_alignment;
|
xen_hypervisor->align = (grub_size_t) sh.optional_header.section_alignment;
|
||||||
|
|
||||||
xen_boot_binary_load (xen_hypervisor, file, argc, argv);
|
xen_boot_binary_load (xen_hypervisor, file, argc, argv);
|
||||||
@@ -479,21 +568,29 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_xen_hypervisor;
|
static grub_command_t cmd_xen_hypervisor;
|
||||||
static grub_command_t cmd_xen_module;
|
static grub_command_t cmd_xen_linux, cmd_xen_initrd, cmd_xen_xsm;
|
||||||
|
|
||||||
GRUB_MOD_INIT (xen_boot)
|
GRUB_MOD_INIT (xen_boot)
|
||||||
{
|
{
|
||||||
cmd_xen_hypervisor =
|
cmd_xen_hypervisor =
|
||||||
grub_register_command ("xen_hypervisor", grub_cmd_xen_hypervisor, 0,
|
grub_register_command ("xen_hypervisor", grub_cmd_xen_hypervisor, 0,
|
||||||
N_("Load a xen hypervisor."));
|
N_("Load a xen hypervisor."));
|
||||||
cmd_xen_module =
|
cmd_xen_linux =
|
||||||
grub_register_command ("xen_module", grub_cmd_xen_module, 0,
|
grub_register_command ("xen_linux", grub_cmd_xen_module, 0,
|
||||||
N_("Load a xen module."));
|
N_("Load a xen linux kernel for dom0."));
|
||||||
|
cmd_xen_initrd =
|
||||||
|
grub_register_command ("xen_initrd", grub_cmd_xen_module, 0,
|
||||||
|
N_("Load a xen initrd for dom0."));
|
||||||
|
cmd_xen_xsm =
|
||||||
|
grub_register_command ("xen_xsm", grub_cmd_xen_module, 0,
|
||||||
|
N_("Load a xen security module."));
|
||||||
my_mod = mod;
|
my_mod = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI (xen_boot)
|
GRUB_MOD_FINI (xen_boot)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd_xen_hypervisor);
|
grub_unregister_command (cmd_xen_hypervisor);
|
||||||
grub_unregister_command (cmd_xen_module);
|
grub_unregister_command (cmd_xen_linux);
|
||||||
|
grub_unregister_command (cmd_xen_initrd);
|
||||||
|
grub_unregister_command (cmd_xen_xsm);
|
||||||
}
|
}
|
||||||
@@ -1889,10 +1889,6 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
void *src;
|
void *src;
|
||||||
|
|
||||||
if (! grub_loader_is_loaded ())
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
N_("you need to load the kernel first"));
|
|
||||||
|
|
||||||
if (kernel_type != KERNEL_TYPE_FREEBSD)
|
if (kernel_type != KERNEL_TYPE_FREEBSD)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no FreeBSD loaded");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no FreeBSD loaded");
|
||||||
|
|
||||||
@@ -1996,10 +1992,6 @@ grub_cmd_netbsd_module (grub_command_t cmd,
|
|||||||
{
|
{
|
||||||
grub_uint32_t type;
|
grub_uint32_t type;
|
||||||
|
|
||||||
if (! grub_loader_is_loaded ())
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
N_("you need to load the kernel first"));
|
|
||||||
|
|
||||||
if (kernel_type != KERNEL_TYPE_NETBSD)
|
if (kernel_type != KERNEL_TYPE_NETBSD)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no NetBSD loaded");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no NetBSD loaded");
|
||||||
|
|
||||||
@@ -2078,10 +2070,6 @@ grub_cmd_openbsd_ramdisk (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||||
|
|
||||||
if (! grub_loader_is_loaded ())
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
N_("you need to load the kernel first"));
|
|
||||||
|
|
||||||
if (kernel_type != KERNEL_TYPE_OPENBSD)
|
if (kernel_type != KERNEL_TYPE_OPENBSD)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "no kOpenBSD loaded");
|
return grub_error (GRUB_ERR_BAD_OS, "no kOpenBSD loaded");
|
||||||
|
|
||||||
|
|||||||
@@ -48,15 +48,15 @@ read_headers (grub_file_t file, const char *filename, Elf_Ehdr *e, char **shdr)
|
|||||||
if (e->e_ident[EI_CLASS] != SUFFIX (ELFCLASS))
|
if (e->e_ident[EI_CLASS] != SUFFIX (ELFCLASS))
|
||||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic"));
|
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic"));
|
||||||
|
|
||||||
*shdr = grub_malloc ((grub_uint32_t) e->e_shnum * e->e_shentsize);
|
*shdr = grub_malloc (e->e_shnum * e->e_shentsize);
|
||||||
if (! *shdr)
|
if (! *shdr)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_file_seek (file, e->e_shoff) == (grub_off_t) -1)
|
if (grub_file_seek (file, e->e_shoff) == (grub_off_t) -1)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_file_read (file, *shdr, (grub_uint32_t) e->e_shnum * e->e_shentsize)
|
if (grub_file_read (file, *shdr, e->e_shnum * e->e_shentsize)
|
||||||
!= (grub_ssize_t) ((grub_uint32_t) e->e_shnum * e->e_shentsize))
|
!= e->e_shnum * e->e_shentsize)
|
||||||
{
|
{
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
@@ -200,8 +200,8 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
|
|||||||
|
|
||||||
if (chunk_size < sizeof (e))
|
if (chunk_size < sizeof (e))
|
||||||
chunk_size = sizeof (e);
|
chunk_size = sizeof (e);
|
||||||
chunk_size += (grub_uint32_t) e.e_phnum * e.e_phentsize;
|
chunk_size += e.e_phnum * e.e_phentsize;
|
||||||
chunk_size += (grub_uint32_t) e.e_shnum * e.e_shentsize;
|
chunk_size += e.e_shnum * e.e_shentsize;
|
||||||
|
|
||||||
{
|
{
|
||||||
grub_relocator_chunk_t ch;
|
grub_relocator_chunk_t ch;
|
||||||
@@ -253,14 +253,14 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
|
|||||||
curload = module + sizeof (e);
|
curload = module + sizeof (e);
|
||||||
|
|
||||||
load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_shoff,
|
load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_shoff,
|
||||||
(grub_uint32_t) e.e_shnum * e.e_shentsize);
|
e.e_shnum * e.e_shentsize);
|
||||||
e.e_shoff = curload - module;
|
e.e_shoff = curload - module;
|
||||||
curload += (grub_uint32_t) e.e_shnum * e.e_shentsize;
|
curload += e.e_shnum * e.e_shentsize;
|
||||||
|
|
||||||
load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_phoff,
|
load (file, argv[0], (grub_uint8_t *) chunk_src + curload - *kern_end, e.e_phoff,
|
||||||
(grub_uint32_t) e.e_phnum * e.e_phentsize);
|
e.e_phnum * e.e_phentsize);
|
||||||
e.e_phoff = curload - module;
|
e.e_phoff = curload - module;
|
||||||
curload += (grub_uint32_t) e.e_phnum * e.e_phentsize;
|
curload += e.e_phnum * e.e_phentsize;
|
||||||
|
|
||||||
*kern_end = curload;
|
*kern_end = curload;
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||||||
|
|
||||||
chunk_size = ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t))
|
chunk_size = ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t))
|
||||||
+ ALIGN_UP (strsize, sizeof (grub_freebsd_addr_t))
|
+ ALIGN_UP (strsize, sizeof (grub_freebsd_addr_t))
|
||||||
+ sizeof (e) + (grub_uint32_t) e.e_shnum * e.e_shentsize;
|
+ sizeof (e) + e.e_shnum * e.e_shentsize;
|
||||||
|
|
||||||
symtarget = ALIGN_UP (*kern_end, sizeof (grub_freebsd_addr_t));
|
symtarget = ALIGN_UP (*kern_end, sizeof (grub_freebsd_addr_t));
|
||||||
{
|
{
|
||||||
@@ -498,10 +498,10 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||||||
s2 = (Elf_Shdr *) curload;
|
s2 = (Elf_Shdr *) curload;
|
||||||
grub_memcpy (curload, s, e.e_shentsize);
|
grub_memcpy (curload, s, e.e_shentsize);
|
||||||
if (s == symsh)
|
if (s == symsh)
|
||||||
s2->sh_offset = sizeof (e) + (grub_uint32_t) e.e_shnum * e.e_shentsize;
|
s2->sh_offset = sizeof (e) + e.e_shnum * e.e_shentsize;
|
||||||
else if (s == strsh)
|
else if (s == strsh)
|
||||||
s2->sh_offset = ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t))
|
s2->sh_offset = ALIGN_UP (symsize, sizeof (grub_freebsd_addr_t))
|
||||||
+ sizeof (e) + (grub_uint32_t) e.e_shnum * e.e_shentsize;
|
+ sizeof (e) + e.e_shnum * e.e_shentsize;
|
||||||
else
|
else
|
||||||
s2->sh_offset = 0;
|
s2->sh_offset = 0;
|
||||||
s2->sh_addr = s2->sh_offset;
|
s2->sh_addr = s2->sh_offset;
|
||||||
|
|||||||
@@ -73,9 +73,6 @@ load_kernel (grub_file_t file, const char *filename,
|
|||||||
if (grub_multiboot_quirks & GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE)
|
if (grub_multiboot_quirks & GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE)
|
||||||
{
|
{
|
||||||
err = grub_multiboot_load_elf (file, filename, buffer);
|
err = grub_multiboot_load_elf (file, filename, buffer);
|
||||||
if (err == GRUB_ERR_NONE) {
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
if (err == GRUB_ERR_UNKNOWN_OS && (header->flags & MULTIBOOT_AOUT_KLUDGE))
|
if (err == GRUB_ERR_UNKNOWN_OS && (header->flags & MULTIBOOT_AOUT_KLUDGE))
|
||||||
grub_errno = err = GRUB_ERR_NONE;
|
grub_errno = err = GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ grub_cmd_truecrypt (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
fail:
|
fail:
|
||||||
|
|
||||||
if (!grub_errno)
|
if (!grub_errno)
|
||||||
grub_error (GRUB_ERR_BAD_OS, "bad truecrypt ISO");
|
return grub_error (GRUB_ERR_BAD_OS, "bad truecrypt ISO");
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/bitmap_scale.h>
|
#include <grub/bitmap_scale.h>
|
||||||
#include <grub/cpu/io.h>
|
#include <grub/cpu/io.h>
|
||||||
#include <grub/random.h>
|
|
||||||
|
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
@@ -339,7 +338,7 @@ grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *
|
|||||||
utf8 = grub_malloc (namelen * 4 + 1);
|
utf8 = grub_malloc (namelen * 4 + 1);
|
||||||
if (!utf8)
|
if (!utf8)
|
||||||
{
|
{
|
||||||
grub_free (utf16);
|
grub_free (utf8);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,31 +577,11 @@ static grub_err_t
|
|||||||
grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
|
grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
|
||||||
{
|
{
|
||||||
struct grub_xnu_devtree_key *efikey;
|
struct grub_xnu_devtree_key *efikey;
|
||||||
struct grub_xnu_devtree_key *chosenkey;
|
|
||||||
struct grub_xnu_devtree_key *cfgtablekey;
|
struct grub_xnu_devtree_key *cfgtablekey;
|
||||||
struct grub_xnu_devtree_key *curval;
|
struct grub_xnu_devtree_key *curval;
|
||||||
struct grub_xnu_devtree_key *runtimesrvkey;
|
struct grub_xnu_devtree_key *runtimesrvkey;
|
||||||
struct grub_xnu_devtree_key *platformkey;
|
struct grub_xnu_devtree_key *platformkey;
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
grub_err_t err;
|
|
||||||
|
|
||||||
chosenkey = grub_xnu_create_key (&grub_xnu_devtree_root, "chosen");
|
|
||||||
if (! chosenkey)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
/* Random seed. */
|
|
||||||
curval = grub_xnu_create_value (&(chosenkey->first_child), "random-seed");
|
|
||||||
if (! curval)
|
|
||||||
return grub_errno;
|
|
||||||
curval->datasize = 64;
|
|
||||||
curval->data = grub_malloc (curval->datasize);
|
|
||||||
if (! curval->data)
|
|
||||||
return grub_errno;
|
|
||||||
/* Our random is not peer-reviewed but xnu uses this seed only for
|
|
||||||
ASLR in kernel. */
|
|
||||||
err = grub_crypto_get_random (curval->data, curval->datasize);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* The value "model". */
|
/* The value "model". */
|
||||||
/* FIXME: may this value be sometimes different? */
|
/* FIXME: may this value be sometimes different? */
|
||||||
@@ -918,28 +897,6 @@ grub_xnu_set_video (struct grub_xnu_boot_params_common *params)
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
total_ram_hook (grub_uint64_t addr __attribute__ ((unused)), grub_uint64_t size,
|
|
||||||
grub_memory_type_t type,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
grub_uint64_t *result = data;
|
|
||||||
|
|
||||||
if (type != GRUB_MEMORY_AVAILABLE)
|
|
||||||
return 0;
|
|
||||||
*result += size;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_uint64_t
|
|
||||||
get_total_ram (void)
|
|
||||||
{
|
|
||||||
grub_uint64_t result = 0;
|
|
||||||
|
|
||||||
grub_mmap_iterate (total_ram_hook, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Boot xnu. */
|
/* Boot xnu. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_xnu_boot (void)
|
grub_xnu_boot (void)
|
||||||
@@ -1016,7 +973,6 @@ grub_xnu_boot (void)
|
|||||||
{
|
{
|
||||||
bootparams_common = &bootparams->v2.common;
|
bootparams_common = &bootparams->v2.common;
|
||||||
bootparams->v2.fsbfreq = fsbfreq;
|
bootparams->v2.fsbfreq = fsbfreq;
|
||||||
bootparams->v2.ram_size = get_total_ram();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
bootparams_common = &bootparams->v1.common;
|
bootparams_common = &bootparams->v1.common;
|
||||||
@@ -1124,7 +1080,7 @@ grub_xnu_boot (void)
|
|||||||
bootparams_common->efi_mmap = memory_map_target;
|
bootparams_common->efi_mmap = memory_map_target;
|
||||||
bootparams_common->efi_mmap_size = memory_map_size;
|
bootparams_common->efi_mmap_size = memory_map_size;
|
||||||
bootparams_common->heap_start = grub_xnu_heap_target_start;
|
bootparams_common->heap_start = grub_xnu_heap_target_start;
|
||||||
bootparams_common->heap_size = curruntimepage * GRUB_XNU_PAGESIZE - grub_xnu_heap_target_start;
|
bootparams_common->heap_size = grub_xnu_heap_size;
|
||||||
|
|
||||||
/* Parameters for asm helper. */
|
/* Parameters for asm helper. */
|
||||||
grub_xnu_stack = bootparams_common->heap_start
|
grub_xnu_stack = bootparams_common->heap_start
|
||||||
|
|||||||
@@ -240,27 +240,20 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
|
|
||||||
#ifndef GRUB_USE_MULTIBOOT2
|
#ifndef GRUB_USE_MULTIBOOT2
|
||||||
grub_multiboot_quirks = GRUB_MULTIBOOT_QUIRKS_NONE;
|
grub_multiboot_quirks = GRUB_MULTIBOOT_QUIRKS_NONE;
|
||||||
int option_found = 0;
|
|
||||||
|
|
||||||
do
|
if (argc != 0 && grub_strcmp (argv[0], "--quirk-bad-kludge") == 0)
|
||||||
{
|
{
|
||||||
option_found = 0;
|
argc--;
|
||||||
if (argc != 0 && grub_strcmp (argv[0], "--quirk-bad-kludge") == 0)
|
argv++;
|
||||||
{
|
grub_multiboot_quirks |= GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE;
|
||||||
argc--;
|
}
|
||||||
argv++;
|
|
||||||
option_found = 1;
|
|
||||||
grub_multiboot_quirks |= GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc != 0 && grub_strcmp (argv[0], "--quirk-modules-after-kernel") == 0)
|
if (argc != 0 && grub_strcmp (argv[0], "--quirk-modules-after-kernel") == 0)
|
||||||
{
|
{
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
option_found = 1;
|
grub_multiboot_quirks |= GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL;
|
||||||
grub_multiboot_quirks |= GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL;
|
}
|
||||||
}
|
|
||||||
} while (option_found);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, voi
|
|||||||
return grub_error (GRUB_ERR_UNKNOWN_OS, N_("this ELF file is not of the right type"));
|
return grub_error (GRUB_ERR_UNKNOWN_OS, N_("this ELF file is not of the right type"));
|
||||||
|
|
||||||
/* FIXME: Should we support program headers at strange locations? */
|
/* FIXME: Should we support program headers at strange locations? */
|
||||||
if (ehdr->e_phoff + (grub_uint32_t) ehdr->e_phnum * ehdr->e_phentsize > MULTIBOOT_SEARCH)
|
if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > MULTIBOOT_SEARCH)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset");
|
return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset");
|
||||||
|
|
||||||
phdr_base = (char *) buffer + ehdr->e_phoff;
|
phdr_base = (char *) buffer + ehdr->e_phoff;
|
||||||
@@ -164,7 +164,7 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, voi
|
|||||||
{
|
{
|
||||||
grub_uint8_t *shdr, *shdrptr;
|
grub_uint8_t *shdr, *shdrptr;
|
||||||
|
|
||||||
shdr = grub_malloc ((grub_uint32_t) ehdr->e_shnum * ehdr->e_shentsize);
|
shdr = grub_malloc (ehdr->e_shnum * ehdr->e_shentsize);
|
||||||
if (!shdr)
|
if (!shdr)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, voi
|
|||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grub_file_read (file, shdr, (grub_uint32_t) ehdr->e_shnum * ehdr->e_shentsize)
|
if (grub_file_read (file, shdr, ehdr->e_shnum * ehdr->e_shentsize)
|
||||||
!= (grub_ssize_t) ehdr->e_shnum * ehdr->e_shentsize)
|
!= (grub_ssize_t) ehdr->e_shnum * ehdr->e_shentsize)
|
||||||
{
|
{
|
||||||
if (!grub_errno)
|
if (!grub_errno)
|
||||||
|
|||||||
@@ -420,7 +420,6 @@ grub_fill_multiboot_mmap_iter (grub_uint64_t addr, grub_uint64_t size,
|
|||||||
(*mmap_entry)->addr = addr;
|
(*mmap_entry)->addr = addr;
|
||||||
(*mmap_entry)->len = size;
|
(*mmap_entry)->len = size;
|
||||||
(*mmap_entry)->type = type;
|
(*mmap_entry)->type = type;
|
||||||
(*mmap_entry)->zero = 0;
|
|
||||||
(*mmap_entry)++;
|
(*mmap_entry)++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -140,17 +140,17 @@ grub_linux_boot (void)
|
|||||||
grub_dprintf ("loader", "Jumping to Linux...\n");
|
grub_dprintf ("loader", "Jumping to Linux...\n");
|
||||||
|
|
||||||
/* Boot the kernel. */
|
/* Boot the kernel. */
|
||||||
asm volatile ("ldx %0, %%o4\n"
|
asm volatile ("sethi %hi(grub_ieee1275_entry_fn), %o1\n"
|
||||||
"ldx %1, %%o6\n"
|
"ldx [%o1 + %lo(grub_ieee1275_entry_fn)], %o4\n"
|
||||||
"ldx %2, %%o5\n"
|
"sethi %hi(grub_ieee1275_original_stack), %o1\n"
|
||||||
"mov %%g0, %%o0\n"
|
"ldx [%o1 + %lo(grub_ieee1275_original_stack)], %o6\n"
|
||||||
"mov %%g0, %%o2\n"
|
"sethi %hi(linux_addr), %o1\n"
|
||||||
"mov %%g0, %%o3\n"
|
"ldx [%o1 + %lo(linux_addr)], %o5\n"
|
||||||
"jmp %%o5\n"
|
"mov %g0, %o0\n"
|
||||||
"mov %%g0, %%o1\n": :
|
"mov %g0, %o2\n"
|
||||||
"m"(grub_ieee1275_entry_fn),
|
"mov %g0, %o3\n"
|
||||||
"m"(grub_ieee1275_original_stack),
|
"jmp %o5\n"
|
||||||
"m"(linux_addr));
|
"mov %g0, %o1\n");
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
@@ -196,26 +196,26 @@ alloc_phys_choose (grub_uint64_t addr, grub_uint64_t len,
|
|||||||
struct alloc_phys_ctx *ctx = data;
|
struct alloc_phys_ctx *ctx = data;
|
||||||
grub_addr_t end = addr + len;
|
grub_addr_t end = addr + len;
|
||||||
|
|
||||||
if (type != GRUB_MEMORY_AVAILABLE)
|
if (type != 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
addr = ALIGN_UP (addr, FOUR_MB);
|
addr = ALIGN_UP (addr, FOUR_MB);
|
||||||
if (addr + ctx->size >= end)
|
if (addr + ctx->size >= end)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* OBP available region contains grub. Start at grub_phys_end. */
|
if (addr >= grub_phys_start && addr < grub_phys_end)
|
||||||
/* grub_phys_start does not start at the beginning of the memory region */
|
{
|
||||||
if ((grub_phys_start >= addr && grub_phys_end < end) ||
|
addr = ALIGN_UP (grub_phys_end, FOUR_MB);
|
||||||
(addr > grub_phys_start && addr < grub_phys_end))
|
if (addr + ctx->size >= end)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((addr + ctx->size) >= grub_phys_start
|
||||||
|
&& (addr + ctx->size) < grub_phys_end)
|
||||||
{
|
{
|
||||||
addr = ALIGN_UP (grub_phys_end, FOUR_MB);
|
addr = ALIGN_UP (grub_phys_end, FOUR_MB);
|
||||||
if (addr + ctx->size >= end)
|
if (addr + ctx->size >= end)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf("loader",
|
|
||||||
"addr = 0x%lx grub_phys_start = 0x%lx grub_phys_end = 0x%lx\n",
|
|
||||||
addr, grub_phys_start, grub_phys_end);
|
|
||||||
|
|
||||||
if (loaded)
|
if (loaded)
|
||||||
{
|
{
|
||||||
@@ -430,7 +430,7 @@ static int
|
|||||||
get_physbase (grub_uint64_t addr, grub_uint64_t len __attribute__ ((unused)),
|
get_physbase (grub_uint64_t addr, grub_uint64_t len __attribute__ ((unused)),
|
||||||
grub_memory_type_t type, void *data __attribute__ ((unused)))
|
grub_memory_type_t type, void *data __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if (type != GRUB_MEMORY_AVAILABLE)
|
if (type != 1)
|
||||||
return 0;
|
return 0;
|
||||||
if (addr < phys_base)
|
if (addr < phys_base)
|
||||||
phys_base = addr;
|
phys_base = addr;
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|||||||
GRUB_MEMORY_AVAILABLE, hook_data);
|
GRUB_MEMORY_AVAILABLE, hook_data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
|
||||||
case GRUB_EFI_RUNTIME_SERVICES_CODE:
|
case GRUB_EFI_RUNTIME_SERVICES_CODE:
|
||||||
hook (desc->physical_start, desc->num_pages * 4096,
|
hook (desc->physical_start, desc->num_pages * 4096,
|
||||||
GRUB_MEMORY_CODE, hook_data);
|
GRUB_MEMORY_CODE, hook_data);
|
||||||
@@ -84,6 +83,10 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|||||||
GRUB_MEMORY_BADRAM, hook_data);
|
GRUB_MEMORY_BADRAM, hook_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
grub_printf ("Unknown memory type %d, considering reserved\n",
|
||||||
|
desc->type);
|
||||||
|
|
||||||
case GRUB_EFI_BOOT_SERVICES_DATA:
|
case GRUB_EFI_BOOT_SERVICES_DATA:
|
||||||
if (!avoid_efi_boot_services)
|
if (!avoid_efi_boot_services)
|
||||||
{
|
{
|
||||||
@@ -91,7 +94,6 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|||||||
GRUB_MEMORY_AVAILABLE, hook_data);
|
GRUB_MEMORY_AVAILABLE, hook_data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
|
||||||
case GRUB_EFI_RESERVED_MEMORY_TYPE:
|
case GRUB_EFI_RESERVED_MEMORY_TYPE:
|
||||||
case GRUB_EFI_RUNTIME_SERVICES_DATA:
|
case GRUB_EFI_RUNTIME_SERVICES_DATA:
|
||||||
case GRUB_EFI_MEMORY_MAPPED_IO:
|
case GRUB_EFI_MEMORY_MAPPED_IO:
|
||||||
@@ -117,18 +119,6 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|||||||
hook (desc->physical_start, desc->num_pages * 4096,
|
hook (desc->physical_start, desc->num_pages * 4096,
|
||||||
GRUB_MEMORY_NVS, hook_data);
|
GRUB_MEMORY_NVS, hook_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_EFI_PERSISTENT_MEMORY:
|
|
||||||
hook (desc->physical_start, desc->num_pages * 4096,
|
|
||||||
GRUB_MEMORY_PERSISTENT, hook_data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
grub_printf ("Unknown memory type %d, considering reserved\n",
|
|
||||||
desc->type);
|
|
||||||
hook (desc->physical_start, desc->num_pages * 4096,
|
|
||||||
GRUB_MEMORY_RESERVED, hook_data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,13 +142,6 @@ make_efi_memtype (int type)
|
|||||||
/* No way to remove a chunk of memory from EFI mmap.
|
/* No way to remove a chunk of memory from EFI mmap.
|
||||||
So mark it as unusable. */
|
So mark it as unusable. */
|
||||||
case GRUB_MEMORY_HOLE:
|
case GRUB_MEMORY_HOLE:
|
||||||
/*
|
|
||||||
* AllocatePages() does not support GRUB_EFI_PERSISTENT_MEMORY,
|
|
||||||
* so no translation for GRUB_MEMORY_PERSISTENT or
|
|
||||||
* GRUB_MEMORY_PERSISTENT_LEGACY.
|
|
||||||
*/
|
|
||||||
case GRUB_MEMORY_PERSISTENT:
|
|
||||||
case GRUB_MEMORY_PERSISTENT_LEGACY:
|
|
||||||
case GRUB_MEMORY_RESERVED:
|
case GRUB_MEMORY_RESERVED:
|
||||||
return GRUB_EFI_UNUSABLE_MEMORY;
|
return GRUB_EFI_UNUSABLE_MEMORY;
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
|
|||||||
grub_memcpy (&gw.ipv4, ptr, sizeof (gw.ipv4));
|
grub_memcpy (&gw.ipv4, ptr, sizeof (gw.ipv4));
|
||||||
rname = grub_xasprintf ("%s:default", name);
|
rname = grub_xasprintf ("%s:default", name);
|
||||||
if (rname)
|
if (rname)
|
||||||
grub_net_add_route_gw (rname, target, gw, NULL);
|
grub_net_add_route_gw (rname, target, gw);
|
||||||
grub_free (rname);
|
grub_free (rname);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user