Commit graph

2959 commits

Author SHA1 Message Date
Vladimir Serbinenko
4a73746a04 * grub-core/boot/sparc64/ieee1275/boot.S [CDBOOT]: Move scratchpad
so it doesn't land in the middle of loaded image.
2013-12-04 19:54:37 +01:00
Vladimir Serbinenko
8a3f0a24b5 * grub-core/kern/emu/main.c: Ignore missing prototype for main. 2013-12-04 10:28:23 +01:00
Vladimir Serbinenko
6f07c4e407 Pass font config to config.h and not by TARGET_CFLAGS as adding
arguments doesn't work if TARGET_CFLAGS is specified on command
	line.
2013-12-04 10:25:53 +01:00
Vladimir Serbinenko
cd15c394cc * grub-core/osdep/windows/emuconsole.c (grub_console_putchar):
Remove variable length arrays.
	* grub-core/term/efi/console.c (grub_console_putchar): Likewise.
2013-12-04 10:05:33 +01:00
Vladimir Serbinenko
bb6e299ccb * grub-core/kern/i386/qemu/init.c: Remove variable length arrays. 2013-12-04 09:48:36 +01:00
Vladimir Serbinenko
47f88cc94e * grub-core/kern/efi/efi.c: Remove variable length arrays. 2013-12-04 08:39:22 +01:00
Vladimir Serbinenko
40b5739ff9 * grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71
minutes.
2013-12-04 08:26:39 +01:00
Vladimir Serbinenko
234d93464a * grub-core/disk/ieee1275/ofdisk.c: Remove variable length arrays.
* grub-core/net/drivers/ieee1275/ofnet.c: Likewise.
2013-12-04 08:10:01 +01:00
Colin Watson
0c0eab527f * grub-core/Makefile.core.def (setjmp): Distribute
lib/arm64/setjmp.S.
2013-12-03 18:11:18 +00:00
Colin Watson
44d4884779 Merge branch 'cjwatson/timeout-style' 2013-12-03 16:15:45 +00:00
Colin Watson
f315b508ae Reduce nesting level. 2013-12-03 16:11:00 +00:00
Andrey Borzenkov
5037aa9a7b fix libgrub.pp build post arm64 merge
grub-core/kern/arm64/dl_helper.c:26:28: fatal error: grub/cpu/reloc.h: No such file or directory
2013-11-30 22:36:10 +04:00
Leif Lindholm
b29b77fee2 New port arm64-efi 2013-11-30 16:50:31 +01:00
Vladimir Serbinenko
35de6d4bac * grub-core/lib/libgcrypt/mpi/longlong.h: Fix compilation error with
-march=armv3.
2013-11-30 11:19:06 +01:00
Vladimir Serbinenko
ce55ed0389 Remove leftover GRUB_IA64_DL_TRAMP_SIZE. 2013-11-30 11:14:30 +01:00
Vladimir Serbinenko
eec893ae49 * grub-core/kern/emu/hostfs.c (is_dir): Remove variable length arrays. 2013-11-29 05:52:20 +01:00
Vladimir Serbinenko
d54f647a4a * grub-core/osdep/linux/ofpath.c: Check return value of read. 2013-11-29 05:46:19 +01:00
Vladimir Serbinenko
469021b4b3 Remove libgnulib.a and use its sources in dependencies directly.
This was the only instance of "library" in core config. A bug was
	reported that -fno-stack-protector wasn't passed to it. Instead of
	figuring out why it failed just remove this construction used
	needlessly.
2013-11-29 03:36:50 +01:00
Vladimir Serbinenko
83c256ba42 * grub-core/osdep/unix/password.c (grub_password_get): Check that
fgets succeeded.
2013-11-29 03:32:57 +01:00
Colin Watson
8f236c1419 Revamp hidden timeout handling
Add a new timeout_style environment variable and a corresponding
GRUB_TIMEOUT_STYLE configuration key for grub-mkconfig.  This
controls hidden-timeout handling more simply than the previous
arrangements, and pressing any hotkeys associated with menu entries
during the hidden timeout will now boot the corresponding menu entry
immediately.

GRUB_HIDDEN_TIMEOUT=<non-empty> + GRUB_TIMEOUT=<non-zero> now
generates a warning, and if it shows the menu it will do so as if
the second timeout were not present.  Other combinations are
translated into reasonable equivalents.
2013-11-28 02:29:15 +00:00
Vladimir Serbinenko
2d76b4d81e Eliminate variable length arrays in grub_vsnprintf_real.
A bit tricky because this function has to continue to work without
	heap for short strings. Fixing prealloc to 32 arguments is reasonable
	but make all stack references use 32-bit offset rather than 8-bit one.
	So split va_args preparsing to separate function and put the prealloc
	into the caller.
2013-11-27 15:16:09 +01:00
Vladimir Serbinenko
4f9541226c Introduce grub_util_file_sync and use it instead of fsync(fileno(f)).
Fixes build for windows.
2013-11-27 14:13:50 +01:00
Colin Watson
16ef26fd3a * grub-core/osdep/unix/exec.c (grub_util_exec_redirect): Remove
references to mdadm from otherwise generic code.
(grub_util_exec_pipe): Likewise.
(grub_util_exec_pipe_stderr): Likewise.
* grub-core/osdep/unix/getroot.c (grub_util_pull_lvm_by_command):
This function calls vgs, not mdadm; adjust variable names
accordingly.
2013-11-27 11:22:31 +00:00
Colin Watson
5c7206e45e Speed up test suite by avoiding fsync
Add grub_util_disable_fd_syncs call to turn grub_util_fd_sync calls into
no-ops, and use it in programs that copy files but do not need to take
special care to sync writes (grub-mknetdir, grub-rescue,
grub-mkstandalone).

On my laptop, this reduces partmap_test's runtime from 1236 seconds to
204 seconds.
2013-11-27 10:10:22 +00:00
Vladimir Serbinenko
1e4b358720 Add PCI command activation to all PCI drivers as required for coreboot
and maybe some other firmwares.
2013-11-26 14:21:11 +01:00
Vladimir Serbinenko
9208367d3f * grub-core/Makefile.am: Reduce gratuituous differences between Apple
and non-Apple variants of efiemu compile.
2013-11-26 11:38:12 +01:00
Andrey Borzenkov
c2b70d0981 Explicitly check for linking format to use for efiemu64 module
Similar to check for target linking format, also check for efiemu64
instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
variants. We cannot easily reuse main target check because platforms
are different (main target is 32 bit and efiemu64 - 64 bit).

This commit adds EFIEMU64_LINK_FORMAT that contains detected
link option and is used in efiemu64.o linking instead of hardcoded
value.

Reported-By: Beeblebrox <zaphod@berentweb.com>
2013-11-25 22:32:55 +04:00
Vladimir Serbinenko
d2f7902af0 Make arm64 compileable with clang 2013-11-25 13:06:56 +01:00
Vladimir Serbinenko
1005bed722 Use b.ge form for instructions 2013-11-25 13:04:44 +01:00
Vladimir Serbinenko
d6c92cdc34 Merge branch 'master' into leiflindholm/arm64
Conflicts:
	include/grub/util/install.h
2013-11-25 13:02:27 +01:00
Vladimir Serbinenko
61e1b9a49d * grub-core/osdep/unix/platform.c (get_ofpathname): Trim ending newline.
Don't rely on PATH_MAX.
2013-11-25 07:34:49 +01:00
Vladimir Serbinenko
c98dd165b0 * grub-core/genmoddep.awk: Use more portable && rather than and. 2013-11-25 07:32:51 +01:00
Vladimir Serbinenko
5c066a81c2 Apple assembly doesn't handle symbol arithmetic well. So define an
offset symbol in boot.S and use it.
2013-11-24 07:12:12 +01:00
Vladimir Serbinenko
78f961efe9 Apple assembly doesn't handle symbol arithmetic well. So instead
of getting addres of kernel_sector + 4 define kernel_sector_high.
	It also makes code more readable.
2013-11-24 07:11:00 +01:00
Vladimir Serbinenko
09bc0a577d With Apple assembly in .macro environvemnt you have to use $$ instead
of $. So introduce new preprocessor macro MACRO_DOLLAR(x) which expands
	to $$x on Apple and to $x on everything else.
2013-11-24 07:08:18 +01:00
Vladimir Serbinenko
b700a427d2 * grub-core/Makefile.am: Use correct TARGET_OBJCONV rather than
OBJCONV.
2013-11-24 05:27:20 +01:00
Vladimir Serbinenko
4480b95dcd * grub-core/gdb/i386/machdep.S: Use xorl %eax, %eax on both Apple
and non-Apple. This instruction is shorter and faster,
	so no reason not to use it on both.
2013-11-24 05:17:24 +01:00
Vladimir Serbinenko
e77c81f6f8 * grub-core/lib/reed_solomon.c: Use section _text, _text rather than
.text when compiling for Apple.
2013-11-24 05:14:11 +01:00
Vladimir Serbinenko
971dbee521 * grub-core/term/arc/console.c: Add missing cast to silence warning. 2013-11-24 05:05:34 +01:00
Vladimir Serbinenko
6f2e82be3a * grub-core/boot/i386/pc/boot.S: Fix floppy probe. Due to missing
%dx restore the probe worked on non-existant drive. Reorganize the
	code a little bit to free 2 bytes necessary for push/pop.
2013-11-24 05:05:33 +01:00
Vladimir Serbinenko
9eec9699b9 * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation):
Add missing cast to silence warning.
2013-11-23 15:35:01 +01:00
Vladimir Serbinenko
1bba40f578 Move common BIOS/coreboot memory map declarations to
include/grub/i386/memory_raw.h and eliminate duplicate declarations.
2013-11-23 12:39:21 +01:00
Vladimir Serbinenko
a92b5cb8d8 * grub-core/lib/libgcrypt/mpi/longlong.h: Use C version with mips
clang.
2013-11-23 00:36:13 +01:00
Vladimir Serbinenko
e1c22419ac * grub-core/kern/xen/init.c: Do not map more pages than we can address. 2013-11-22 13:04:29 +01:00
Vladimir Serbinenko
189090cee9 * grub-core/kern/efi/mm.c: Limit allocations to 2GiB when not compiling
with -mcmodel=large.
2013-11-22 13:03:19 +01:00
Vladimir Serbinenko
1a5b7b404f * grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Add
range-checking for 32-bit quantities.
2013-11-22 13:01:14 +01:00
Vladimir Serbinenko
4a0aaad022 clang emits calls to abort () under some unknown conditions.
Export abort () when compiling with clang.
2013-11-22 12:42:58 +01:00
Vladimir Serbinenko
ddb3efc906 * grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_open): Ensure
at compile time that enough of scratch size is available.
2013-11-22 12:00:10 +01:00
Vladimir Serbinenko
4e42521d8c * grub-core/kern/x86_64/efi/callwrap.S: Fix stack alignment.
Previously we misaligned stack by 8 in startup.S and compensated
	for it in callwrap.S. According to ABI docs (EFI and sysv amd64)
	right behaviour is to align stack in startup.S and keep it aligned
	in callwrap.S. startup.S part was committed few commits before. This
	takes care of callwrap.S.
	Reported by: Gary Lin.
2013-11-22 05:40:32 +01:00
Vladimir Serbinenko
054efe541f * grub-core/boot/mips/startup_raw.S: Handle the case of gap between
.data and .bss. May happen if compiler and assembly use different
	alignment.
2013-11-22 05:07:32 +01:00
Vladimir Serbinenko
a0e1befb57 On MIPS handle got16 relocations to local symbols in an ABI-compliant
way.
2013-11-22 05:03:17 +01:00
Vladimir Serbinenko
c36c73f681 Add support for a new magic symbol _gp_disp on mips to handle PIC
binaries.
2013-11-22 04:56:10 +01:00
Vladimir Serbinenko
6f4a19f59f Use $t9 for indirect calls from asm to C as PIC ABI requires. 2013-11-22 04:45:05 +01:00
Vladimir Serbinenko
0d8f04cd83 Remove -march=mips3 from TARGET_CCASFLAGS as it creates linking problem
when rest of GRUB is compiled for hisher stepping. Instead use
	.set mips3/.set mips1 around cache and sync opcodes.
2013-11-22 04:36:53 +01:00
Vladimir Serbinenko
4906052019 Unify GOT/trampoline handling between PPC, MIPS and IA64 as they
do essentially the same thing, do it in similar way.
2013-11-21 21:54:33 +01:00
Colin Watson
b7f9aedfac * grub-core/normal/progress.c: Remove unused file. 2013-11-21 15:37:57 +00:00
Vladimir Serbinenko
7dd0a30361 * grub-core/lib/crypto.c (grub_crypto_hash): Remove variable length
array.
2013-11-20 20:09:18 +01:00
Josh Triplett
7960d3e182 * grub-core/kern/x86_64/efi/startup.S (_start): Align the stack to a
16-byte boundary, as required by the x86-64 ABI, before calling
	grub_main.  In some cases, GCC emits code that assumes this
	alignment, which crashes if not aligned.  The EFI firmware is also
	entitled to assume that stack alignment without checking.
2013-11-19 14:31:40 +01:00
Leif Lindholm
8a07b55a04 arm64: cache maintenance code rework + bugfix 2013-11-19 10:05:23 +00:00
Josh Triplett
d53f4900d7 * grub-core/mmap/efi/mmap.c (grub_mmap_register): Round up/down to
4k page boundaries as expected by firmware rather than 1k
	boundaries.
	(grub_mmap_malign_and_register): Likewise.
2013-11-18 18:00:52 +01:00
Vladimir Serbinenko
96fa2d9d02 Merge branch 'master' into leiflindholm/arm64 2013-11-18 17:51:28 +01:00
Vladimir Serbinenko
45bf8b3a75 * grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the
pointer to 32K. This is the size of cache element which is the most
	common allocation >1K. This way the pointer is always around blocks
	of 32K and so we keep performance while decreasing fragmentation.
2013-11-18 17:41:37 +01:00
Vladimir Serbinenko
39ff43c579 * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to
current memory when allocating large chunks. This significantly
	decreases memory fragmentation.
2013-11-18 16:58:55 +01:00
Vladimir Serbinenko
74e632fea8 * grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Update
clock frequency to 200 MHz,
2013-11-18 16:39:45 +01:00
Vladimir Serbinenko
4d5b72cdb4 Merge branch 'master' of git.sv.gnu.org:/srv/git/grub 2013-11-18 14:54:01 +01:00
Vladimir Serbinenko
ea7c1a7d90 * grub-core/tests/videotest_checksum.c: Don't reload unifont if it's
already loaded. This saves memory needed for tests,
2013-11-18 14:38:31 +01:00
Vladimir Serbinenko
5e3cb8a747 * grub-core/term/terminfo.c (grub_cmd_terminfo): Fix a typo to make -g
work again.
2013-11-18 14:35:18 +01:00
Colin Watson
3bf4088b8b * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file):
Handle errors from mkstemp.
(grub_util_make_temporary_dir): Handle errors from mkdtemp.
2013-11-18 12:27:44 +00:00
Vladimir Serbinenko
f8b4c3b6b3 * grub-core/tests/gfxterm_menu.c: Skip high-resolution tests on
low-memory platforms where we don't have enough memory for them.
	* grub-core/tests/videotest_checksum.c: Likewise.
2013-11-18 11:48:07 +01:00
Vladimir Serbinenko
4bf703206d * grub-core/tests/cmdline_cat_test.c: Don't reload unifont if it's
already loaded. This saves memory needed for tests,
2013-11-18 11:45:55 +01:00
Vladimir Serbinenko
2df8f43d3e * grub-core/lib/sparc64/setjmp.S: Force spilling of current window. 2013-11-18 10:01:36 +01:00
Vladimir Serbinenko
6f1bc8bc0f On i386-ieee1275 we run in paged mode. So we need to explicitly map
the devices before accessing them.
2013-11-18 04:32:33 +01:00
Vladimir Serbinenko
04f39f6df8 * grub-core/lib/relocator.c (grub_mm_check_real): Accept const char *
as file argument.
2013-11-18 02:45:25 +01:00
Vladimir Serbinenko
35d4761ce2 * grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak. 2013-11-18 02:43:29 +01:00
Vladimir Serbinenko
33d02a42d6 * grub-core/kern/file.c (grub_file_open): Free file->name on failure.
(grub_file_close): Free file->name.
2013-11-18 02:41:42 +01:00
Vladimir Serbinenko
7bbb60cfbd * grub-core/commands/verify.c (free_pk): Plug memory leak.
(grub_load_public_key): Likewise.
	(grub_verify_signature_real): Likewise.
	(grub_cmd_verify_signature): Likewise.
2013-11-18 02:40:17 +01:00
Vladimir Serbinenko
da93d6753b * grub-core/commands/legacycfg.c (grub_legacy_check_md5_password): Plug
memory leak.
2013-11-18 02:37:46 +01:00
Vladimir Serbinenko
59c943ecf6 * grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31.
(grub_longjmp): Restore r31.
	* include/grub/powerpc/setjmp.h (grub_jmp_buf): Reserve space for r31.
2013-11-18 02:35:32 +01:00
Ian Campbell
7d400406a7 * grub-core/disk/uboot/ubootdisk.c: Include SCSI disks. 2013-11-17 15:38:09 +01:00
Vladimir Serbinenko
0ab8e025c1 * grub-core/tests/cmdline_cat_test.c (cmdline_cat_test): Ignore errors
of loading gfxterm as gfxterm is embed in kernel on some platforms.
	* grub-core/tests/gfxterm_menu.c (gfxterm_menu): Likewise.
	Load gfxmenu.
2013-11-17 02:13:33 +01:00
Leif Lindholm
15a463d742 ARM 64 port by Leif Lindholm 2013-11-16 20:52:55 +01:00
Vladimir Serbinenko
cd46aa6cef Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir
the function of these files exceeds what can be sanely handled in shell
	in posix-comaptible way. Also writing it in C extends the functionality
	to non-UNIX-like OS and minimal environments.
2013-11-16 20:21:16 +01:00
Vladimir Serbinenko
9ef81064a3 * grub-core/kern/arm/cache.S: Don't switch back to ARM mode when
compiling to thumb2.
	* grub-core/kern/arm/cache_armv7.S: Likewise.
	* grub-core/lib/arm/setjmp.S: Likewise.
2013-11-16 17:37:06 +01:00
Leif Lindholm
11a7793221 arm: delete superflouous save of r8 in grub_uboot_syscall 2013-11-16 15:56:09 +00:00
Vladimir Serbinenko
080603f0b0 Decrease stack usage in lexer.
We have only 92K of stack and using over 4K per frame is wasteful

	* grub-core/script/yylex.l (yyalloc), (yyfree), (yyrealloc): Declare
	as macros so that compiler would remove useless structure on stack.
	Better solution would be to fix flex not to put this structure on
	the stack but flex is external program.
2013-11-16 16:37:59 +01:00
Vladimir Serbinenko
4f84ae0ec8 Decrease stack usage in signature verification.
We have only 92K of stack and using over 4K per frame is wasteful

	* grub-core/commands/verify.c (grub_load_public_key): Allocate on heap
	rather than stack.
	(grub_verify_signature_real): Likewise.
2013-11-16 16:34:51 +01:00
Vladimir Serbinenko
e6a6182d95 Decrease stack usage in mdraid 0.9x.
We have only 92K of stack and using over 4K per frame is wasteful

	* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Allocate on heap
	rather than stack.
2013-11-16 16:16:48 +01:00
Vladimir Serbinenko
1a454efe89 Decrease stack usage in BtrFS.
We have only 92K of stack and using over 4K per frame is wasteful

	* grub-core/fs/btrfs.c (grub_btrfs_lzo_decompress): Allocate on heap
	rather than stack.
2013-11-16 16:15:26 +01:00
Vladimir Serbinenko
7b5d51d837 Decrease stack usage in JFS.
We have only 92K of stack and using over 4K per frame is wasteful

	* grub-core/fs/jfs.c (getblk): Allocate on heap rather than on
	stack. Note: this function is recursive.
	(grub_jfs_read_inode): Read only part we care about.
2013-11-16 16:00:42 +01:00
Leif Lindholm
593865b907 arm: fix u-boot port syscall interface va_arg handling
Commit c9cd02c broke the u-boot syscall API for va_args that spill over
to the stack, causing the disk support to stop working. This patch
resolves the problem, while keeping the new, cleaner transition_space
handling.
2013-11-16 14:12:12 +00:00
Andrey Borzenkov
9e18dfe277 MIPS grub_machine_get_bootlocation arguments are used 2013-11-16 16:59:07 +04:00
Vladimir Serbinenko
6fcec43954 Replace libgcc version of ctz with our own.
On upcoming arm64 port libgcc ctz* are not usable in standalone
	environment. Since we need ctz* for this case and implementation is
	in C we may as well use it on all concerned platforms.
2013-11-15 03:28:34 +01:00
Vladimir Serbinenko
a9f25a0819 * configure.ac: Probe for linking format rather than guessing it based
on target_os.
2013-11-14 23:17:18 +01:00
Vladimir Serbinenko
c7995256e4 * grub-core/disk/xen/xendisk.c (grub_xendisk_fini): Set state to
"1" prior to handoff.

	Reported by: M A Young.
2013-11-14 22:42:54 +01:00
Vladimir Serbinenko
e1aa5b6620 * grub-core/kern/xen/init.c (grub_xenstore_write_file): Don't add
\0 to all files.

	Reported by: M A Young.
2013-11-14 22:40:50 +01:00
Vladimir Serbinenko
da5ed5cf6b * grub-core/osdep/bsd/hostdisk.c (grub_util_get_fd_size_os): Fix
compilation on NetBSD.
2013-11-14 22:38:36 +01:00
Andrey Borzenkov
a5986276ec add grub-core/tests/signatures.h to distfiles 2013-11-15 00:51:30 +04:00
Matthew Garrett
1fe26ab4a0 * grub-core/kern/main.c (grub_set_prefix_and_root): Set variable
cmdpath to firmware directory.
2013-11-14 15:53:32 +01:00
Vladimir Serbinenko
83e9c273e5 * grub-core/kern/efi/efi.c (grub_efi_get_filename): Reset the pointer
at the start of second iteration.
2013-11-14 15:50:43 +01:00
Vladimir Serbinenko
ec525c18e1 * grub-core/Makefile.am (efiemu64.o): Explicitly set link format. 2013-11-14 12:05:48 +01:00