Commit Graph

872 Commits

Author SHA1 Message Date
Andrei Borzenkov 67dba97e45 support modules without symbol table
all_video module does not have any code or data and exists solely for
.moddeps section to pull in dependencies. This makes all symbols unneeded.

While in current binutils (last released version as of this commit is 2.26)
``strip --strip-unneeded'' unintentionally adds section symbols for each
existing section, this behavior was considered a bug and changed in commit
14f2c699ddca1e2f706342dffc59a6c7e23e844c to completely strip symbol table
in this case.

Older binutils (verified with 2.17) and some other toolchains (at least
elftoolchain r3223M), both used in FreeBSD, remove symbol table in all_video
as well.

Relax run-time check and do not return error for modules without symbol table.
Add additional checks to module verifier to make sure such modules

a) have non-empty .moddeps section. Without either externally visible symbols
or .moddeps modules are completely useless and should not be built.

b) do not have any relocations.

Closes: 46986

v2: add run-time check for empty symbol table if relocations are present as
    suggested by Vladimir.
2016-02-03 20:34:55 +03:00
Vladimir Serbinenko 605eecc985 arm64: Add support for relocations needed for linaro gcc 2016-01-22 19:09:37 +01:00
Michael Chang 64e2d139fe Restore terminal settings on grub-emu exit. 2016-01-22 11:05:32 +01:00
Vladimir Serbinenko 7c6c2ad42c i386-ieee1275: Increase maximum heap size to accomodate highres graphi tests 2016-01-22 10:12:43 +01:00
Andrei Borzenkov 4f8fe948b9 loader: Unintended sign extension
CID: 96707, 96699, 96693, 96691, 96711, 96709, 96708, 96703, 96702,
96700, 96698, 96696, 96695, 96692, 96710, 96705
2016-01-15 19:18:05 +03:00
Andrei Borzenkov 269a522c7d hostdisk: fix device detection
Condition was apparently reversed so GRUB assumed all devices were
files. This later made it skip BLKFLSBUF ioctl on Linux which caused
various page cache coherency issues. Observed were

- failure to validate blocklist install (read content did not match
  just written)

- failure to detect Linux MD on disk after online hot addition
  (GRUB got stale superblock)

Closes: 46691
2016-01-10 10:41:04 +03:00
Andrei Borzenkov 9fecb0588e kern/elf: fix unintended sign extension
Found by: Coverity scan.
CID: 73729, 73735, 73758, 73760
2016-01-09 19:41:26 +03:00
Andrei Borzenkov bd60f5a207 rescue_parser: restructure code to avoid Coverity false positive
If line contains single word, line and argv[0] are aliases, so
no NULL dereference is possible, but Coverity does not know it.
Change code to avoid ambiguity and also remove redundant call to
grub_strchr.

CID: 86725
2016-01-09 18:15:27 +03:00
Mark Salter 7eb27a49e9 arm-efi: Reduce timer event frequency by 10
Timer event to keep grub msec counter was running at 1000HZ. This was too
fast for UEFI timer driver and resulted in a 10x slowdown in grub time
versus wallclock. Reduce the timer event frequency and increase tick
increment accordingly to keep better time.
2016-01-07 20:54:20 +01:00
Vladimir Serbinenko f86fd54cf0 Add memdisk support to grub-emu.
Use it to add custom files, so that tests which need them work.
2016-01-05 21:10:27 +01:00
Vladimir Serbinenko 3f430a0126 Move file loading functions to grub-emu.
So that we can use it in grub-emu as well as utils.
2016-01-05 21:10:27 +01:00
Andrei Borzenkov 609c049dcc kernel: print and reset grub_errno after each embedded config line
Otherwise it causes subsequent file open to fail, because grub_file_open
misinterprets set grub_errno for grub_file_get_device_name failure.

Closes: 46540
2015-12-16 21:20:30 +03:00
Michael Chang a03c1034f6 i386: fix TSC calibration using PIT
Condition was accidentally reversed, so PIT calibration always failed
when PIT was present and always succeeded when PIT was missing, but in
the latter case resulted in absurdly fast clock.

Reported and tested by Vitaly Kuznetsov <vkuznets@redhat.com>
2015-12-01 18:49:38 +03:00
Andrei Borzenkov f4c143789a Replace numbers with grub_memory_type_t enums 2015-11-27 19:52:16 +03:00
Vladimir Serbinenko d43a5ee651 tsc: Use alternative delay sources whenever appropriate.
PIT isn't available on some of new hardware including Hyper-V. So
use pmtimer for calibration. Moreover pmtimer calibration is faster, so
use it on coreboor where booting time is important.

Based on patch by Michael Chang.
2015-11-27 11:39:55 +01:00
Vladimir Serbinenko 254f92815b kern/elf: Ignore cast-align warnings 2015-11-09 11:39:30 +01:00
Andrei Borzenkov c1fbc26203 Add comments to code for commit d313218 2015-11-07 13:01:23 +03:00
Paulo Flabiano Smorigo bf3df4070f Implement cross-endian ELF load for powerpc 2015-10-26 22:07:26 +01:00
Vladimir Serbinenko 285540e448 mips: Make the assembly-code N32-compatible.
There are no $t4 or $t5 in N32 but there are $a4 and $a5.
2015-10-11 13:20:26 +02:00
Andrei Borzenkov d31321835e file: ignore host disk in blocklist check
It cannot work anyway because host disk cannot be read. This fixes hostfs access
on native Windows build where filenames start with '\' or do not have initial
separator at all (d:\foo).

Issue was observed when running grub-fstest on Windows. On UNIX image name is
canonicalized to always start with `/' so this was not noticed.

This has side effect of allowing relative path names on host, but this already
was the case with `ls' command, so it just extends it to all commands.

Reported-By: Arch Stack <archstacker@gmail.com>
Also-By: Arch Stack <archstacker@gmail.com>
2015-10-10 10:02:20 +03:00
Vladimir Serbinenko c2443e49bc mips/dl: Handle addend in RELA entries. 2015-10-09 23:32:06 +02:00
Ignat Korchagin d5847bf594 efi: fix GetVariable return status check in 81ca24a
GetVariable should return EFI_BUFFER_TOO_SMALL if given buffer of size
zero; commit incorrectly checked for EFI_SUCCESS.
2015-07-24 20:46:02 +03:00
Ignat Korchagin 81ca24a59c efi: fix memory leak in variable handling 2015-07-23 21:13:09 +03:00
Vladimir Serbinenko eecdbebc84 Remove mips_attributes.
mips_attributes was introduced to work around clang problems with
-msoft-float. Those problems are now fixed and moreover .gnu_attributes
itself is unportable and creates problem with clang.

Revert "mips: Fix soft-float handling."

This partially reverts commit 6a4ecd276e.
2015-07-22 21:05:11 +02:00
Vladimir Serbinenko f250c337f1 ARM: provide __aeabi_memclr* and __aeabi_memcpy* symbols
Fixes compilation with recent clang.
2015-07-22 20:40:13 +02:00
Mark Salter c945ca75c3 Fix exit to EFI firmware
The current code for EFI grub_exit() calls grub_efi_fini() before
returning to firmware. In the case of ARM, this leaves a timer
event running which could lead to a firmware crash. This patch
changes this so that grub_machine_fini() is called with a NORETURN
flag. This allows machine-specific shutdown to happen as well
as the shutdown done by grub_efi_fini().

Signed-off-by: Mark Salter <msalter@redhat.com>
2015-06-12 13:08:36 +03:00
Andrei Borzenkov 2498dc7a3a hostdisk: fix crash with NULL device.map
grub-macbless calls grub_util_biosdisk_init with NULL device.map.
2015-05-17 14:16:36 +03:00
Andrei Borzenkov 7b386b7031 efidisk: move device path helpers in core for efinet 2015-05-07 20:37:16 +03:00
Leif Lindholm d47e8ab4b9 dl_helper: Cleanup
Use the new thumb_get_instruction_word/thumb_set_instruction_word
helpers throughout.

Style cleanup (missing spaces).

Move Thumb MOVW/MOVT handlers into Thumb relocation section of file.
2015-03-27 14:37:16 +01:00
Colin Watson 5974d4ba65 hostfs: Drop unnecessary feature test macros
_BSD_SOURCE was added to allow the use of DT_DIR, but that was removed
in e768b77068.  While adding
_DEFAULT_SOURCE as well works around problems with current glibc,
neither is in fact needed nowadays.
2015-03-23 14:32:30 +00:00
Vladimir Serbinenko 27d1a67f8a Fix canonicalize_file_name clash.
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Vladimir Serbinenko 064360e667 Remove libgcc dependency.
libgcc for boot environment isn't always present and compatible.
libgcc is often absent if endianness or bit-size at boot is different
from running OS.
libgcc may use optimised opcodes that aren't available on boot time.
So instead of relying on libgcc shipped with the compiler, supply
the functions in GRUB directly.
Tests are present to ensure that those replacement functions behave the
way compiler expects them to.
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko 66b0e6649b emu/cache: Change declaration of __clear_cache to match builtin declaration.
Fixes compile of arm64-emu.
2015-02-26 22:20:59 +01:00
Vladimir Serbinenko 38b7a30269 arm/dl: Fix handling of nonstandard relocation sizes 2015-02-26 22:10:29 +01:00
Vladimir Serbinenko 6a4ecd276e mips: Fix soft-float handling.
Add -msoft-float alongside clang arguments to specify ABI.
Specify ABI in asm files explicitly.
This trigers asm warning due to gcc failing to propagate -msoft-float
but it's tolerable.
2015-02-23 22:33:28 +01:00
Vladimir Serbinenko 7ea452a142 Add missing grub_ prefix in memcpy invocation 2015-02-23 22:29:33 +01:00
Vladimir Serbinenko f034fab620 Supply signed division to fix ARM compilation.
Previously we supplied only unsigned divisions on platforms that need software
division.
Yet compiler may itself use a signed division. A typical example would be a
difference between 2 pointers which involves division by object size.
2015-02-23 04:12:04 +01:00
Vladimir Serbinenko 50ebc8f5f3 i386/tsc: Fix unused function warning on xen. 2015-02-22 13:12:44 +01:00
Vladimir Serbinenko da9f30b455 mips: Switch to more portable .org
Binary is unchanged.
2015-02-21 20:43:57 +01:00
Vladimir Serbinenko 49e5fcb9fb sparc64: Switch to more portable .org.
Binaries are unchanged.
2015-02-21 20:32:03 +01:00
Vladimir Serbinenko 3c6043245e qemu: Switch to more portable .org
Binary is checked identical.
2015-02-21 20:13:58 +01:00
Vladimir Serbinenko e62ca2a870 qemu: Fix compilation 2015-02-21 19:55:53 +01:00
Vladimir Serbinenko 44ff462e83 Remove realmode.S from coreboot and qemu.
It's not used there.
2015-02-21 19:53:18 +01:00
Vladimir Serbinenko 37353f0ae5 i386: Remove needless ADDR32 prefixes when address is known and fixed.
Shaves off 6 bytes in lzma_decompress.img.
2015-02-21 17:38:56 +01:00
Vladimir Serbinenko f571dc1af8 i386: Move from explicit ADDR32/DATA32 prefixes to instruction suffixes.
Is more portable.
Binary is unchanged (verified).
2015-02-21 17:13:23 +01:00
Vladimir Serbinenko aee2502cb5 Provide __aeabi_mem{cpy,set}
Fixes ARM compilation
2015-02-21 16:07:59 +01:00
Leif Lindholm c0f529ea67 arm: implement additional relocations generated by gcc 4.9 at -O3
GCC 4.9 also generates R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS,
as an alternative to ABS32.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
2015-02-03 22:50:08 +00:00
Vladimir Serbinenko 21f22c7107 i386/pc/mmap: Fix memset size.
Found by: Coverity scan.
2015-01-26 09:38:11 +01:00
Vladimir Serbinenko 69aee43fa6 * grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a
descriptor_size==0 to avoid potential divisions by zero.
2015-01-21 17:42:15 +01:00
Vladimir Serbinenko 4e0a25a4c0 rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid division by zero. 2015-01-21 17:42:14 +01:00
Vladimir Serbinenko 2e62352bc2 * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
no division by 0 occurs.
2015-01-21 17:42:14 +01:00
Vladimir Serbinenko 59d4036594 Replace explicit sizeof divisions by ARRAY_SIZE. 2015-01-21 17:37:31 +01:00
David Kozub 17328db3b3 grub-core/kern/arm/misc.S: fix unaligned grub_uint64_t local variable
The unaligned local in __aeabi_uidivmod leads to a store to a 64bit
value at an address that is not divisible by 8 (in grub_divmod64).
The compiler most likely generates a STRD instruction to store it and
this causes an exception.

Fixes Savannah bug #43632.

This includes improvements done by Leif Lindholm.
2014-12-07 20:16:29 +03:00
Leif Lindholm 004a2b1efd efi: check *path non-null before grub_strrchr
The EFI version of grub_machine_get_bootlocation crops the boot image
name back to the last / in order to get a directory path. However, it
does not check that *name is actually set before calling grub_strrchr
to do this, and neither does grub_strrchr before dereferencing a NULL
pointer.

Parent function, grub_set_prefix_and_root, does check the pointer
before using.
2014-11-17 14:11:01 +00:00
Khem Raj a276b84046 Fix build with glibc 2.20
* grub-core/kern/emu/hostfs.c: squahes below warning
  warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-Status: Submitted
2014-09-15 19:59:27 +04:00
Colin Watson 2a5a532c00 Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
* configure.ac: Remove -m64 from checks for -mcmodel=large and
-mno-red-zone.  These are always either unnecessary (x86_64-emu) or
already in TARGET_CFLAGS at this point, and they produce incorrect
results when building for x32.
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast
pointers to Elf64_Xword via grub_addr_t, in order to work on x32.
* include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P,
GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32.
2014-09-07 23:04:50 +01:00
Colin Watson 1de3a48098 * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation):
Initialise pend to pacify GCC.
2014-08-25 15:19:48 -07:00
Vladimir Serbinenko d1224d209b * grub-core/kern/disk_common.c: Clump disk size to 1EiB. 2014-08-10 11:27:36 +02:00
Vladimir Serbinenko 4b8b9135f1 * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL.
Reported by: Yves Blusseau <blusseau@zetam.org>.
2014-04-20 16:12:41 +02:00
Nikunj A Dadhania e4a1fe3919 ieee1275: check for IBM pseries emulated machine
is_qemu is not being set lead to disabling of feature like
GRUB_IEEE1275_FLAG_HAS_CURSORONOFF. This resulted in cursor not being
displayed during the grub-menu edit.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-24 15:44:33 +00:00
Vladimir Serbinenko bec35dad2a * grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
if E820 failed to return any regions.
2014-02-28 10:07:11 +01:00
Vladimir Serbinenko f94b2b4eeb * grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000
region.
2014-02-28 09:47:57 +01:00
Paulo Flabiano Smorigo 9585647a25 add bootpath parser for open firmware
It enables net boot even when there is no bootp/dhcp server.

* grub-core/net/drivers/ieee1275/ofnet.c: Add grub_ieee1275_parse_bootpath and
call it at grub_ieee1275_net_config_real.
* grub-core/kern/ieee1275/init.c: Add bootpath to grub_ieee1275_net_config.
* include/grub/ieee1275/ieee1275.h: Likewise.
2014-02-04 19:02:16 -02:00
Vladimir Serbinenko 7e7293d745 * grub-core/kern/efi/efi.c: Ensure that the result starts with /
and has no //.
2014-01-18 16:41:47 +01:00
Vladimir Serbinenko 093dec7370 Don't abort() on unavailable coreboot tables if not running on coreboot. 2013-12-28 17:25:14 +01:00
Andrey Borzenkov 989af02582 remove unused error.h from kern/emu/misc.c
Fixes compilation on mingw32, where include is apparently missing.
2013-12-28 09:04:10 +04:00
Vladimir Serbinenko 5bda44d7f9 * grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
As these functions are used on pre-ARMv6 CPUs as well we don't want
	to make assembler assume that architecture is higher than default one.
2013-12-25 23:31:42 +01:00
Vladimir Serbinenko 09c479006c Fix buffer overflow in grub_efi_print_device_path. 2013-12-24 19:04:46 +01:00
Vladimir Serbinenko 4d6c69536e Show SATA device path. 2013-12-24 18:10:28 +01:00
Vladimir Serbinenko fba31b5f69 Dump type and vendor specific data when printing device path. 2013-12-24 14:05:48 +01:00
Vladimir Serbinenko 0c930a841e Remove leftover options defines. 2013-12-23 18:17:02 +01:00
Vladimir Serbinenko bbc52c228f Enable cache on ARM U-Boot port.
Without it the port is reidiculously slow.
2013-12-23 05:01:58 +01:00
Vladimir Serbinenko 943981ff65 Fix ARM cache maintainance.
More code was converted from ASM to C for easier handling.
2013-12-23 04:27:53 +01:00
Vladimir Serbinenko adabfb5418 * grub-core/kern/arm/cache.c (grub_arm_disable_caches_mmu): Use v6
algorithm on v5.

	Suggested by: Leif Lindholm.
2013-12-22 22:33:35 +01:00
Vladimir Serbinenko 313fb3cef8 Add module loading and parsing boot time checkpoints. 2013-12-22 18:14:42 +01:00
Vladimir Serbinenko 5ad9f728eb Workaround buggy timer in raspberry pie by using our own timer
implementation.
2013-12-22 02:48:42 +01:00
Vladimir Serbinenko 96650a82ec * grub-core/kern/emu/main.c: Build fix for emu. 2013-12-21 18:09:19 +01:00
Vladimir Serbinenko ca3e20886e Build fixes for argp.h with older gcc. 2013-12-21 18:08:25 +01:00
Vladimir Serbinenko 05126706b0 * grub-core/kern/dl.c: Don't discard const attribute. 2013-12-21 13:26:27 +01:00
Vladimir Serbinenko 2f9c48041a * grub-core/kern/disk.c: Fix potential overflow. 2013-12-21 13:23:37 +01:00
Vladimir Serbinenko 72c9a50773 Remove xen VFB.
Due to XEN bug it prevents Linux boot. Remove it at least, until
	workaround is found.
2013-12-18 18:43:09 +01:00
Vladimir Serbinenko 57a691b7e7 Decrease number of strings to translate. 2013-12-18 07:26:13 +01:00
Vladimir Serbinenko 74fa9417e5 * grub-core/kern/arm/dl.c: Remove unnecessarry execution mode check. 2013-12-18 07:06:23 +01:00
Vladimir Serbinenko daaa89dbe5 Use AT keyboard on Yeeloong 3A. 2013-12-17 22:54:30 +01:00
Vladimir Serbinenko 25a7863d77 Add Yeeloong 3A reboot and halt. 2013-12-17 22:53:18 +01:00
Vladimir Serbinenko 184c61ddce Add Radeon Yeeloong 3A support. 2013-12-17 22:52:04 +01:00
Vladimir Serbinenko fd4650a556 Add bonito 3A support. 2013-12-17 22:49:27 +01:00
Vladimir Serbinenko 18e76955be Use %I64 and not %ll when using OS printf if compiling for windows. 2013-12-17 16:04:47 +01:00
Vladimir Serbinenko d45067a290 Add explicit thumb interwork bx in asm files.
Shouldn't matter for armv >= 5 but let's be safe.
2013-12-17 14:50:44 +01:00
Vladimir Serbinenko 296f76068d Change to v1 xen grants. 2013-12-17 13:55:47 +01:00
Vladimir Serbinenko 71669c3b76 Implement XEN VFB support. 2013-12-17 13:07:26 +01:00
Vladimir Serbinenko 60d1dd3d72 Remove grub_bios_interrupt on coreboot.
It's not used currently and cannot be used safely currently.
2013-12-17 12:54:11 +01:00
Vladimir Serbinenko 316c8d9a18 Make grub_xen_hypercall on i386 cdecl rather than stdcall to avoid
linker trying to "fixup" the code.
2013-12-16 18:10:50 +01:00
Vladimir Serbinenko 8fcce8d50f * grub-core/kern/x86_64/xen/startup.S: Align stack. 2013-12-16 17:44:10 +01:00
Vladimir Serbinenko f4171ebd34 Handle X86_64_PC64 relocation.
Those are generated by some cygwin compilers.
2013-12-16 14:24:19 +01:00
Vladimir Serbinenko 252a289cb3 Determine the need for mingw-related stubs at compile time rather than
using not very significant $target_os.
2013-12-16 14:18:15 +01:00
Ian Campbell 80b865bdc8 * grub-core/kern/uboot/init.c: Fix units of uboot timer. 2013-12-15 17:59:40 +01:00
Vladimir Serbinenko 48ba5c0c86 * grub-core/kern/elfXX.c: Use grub_addr_t rather than long when
appropriate.
2013-12-15 14:33:22 +01:00
Vladimir Serbinenko 8fa2627942 * grub-core/kern/i386/coreboot/cbtable.c: Use char * arithmetic rather
than converting to long.
2013-12-15 14:24:34 +01:00
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir Serbinenko 6a5fe1328b * grub-core/kern/i386/qemu/init.c (resource): Decrease struct size
by using bitfields.
2013-12-14 23:15:47 +01:00
Vladimir Serbinenko 6dc3337774 Fix definition of grub_efi_hard_drive_device_path. Take care that
existing code would work even if by some reason bogus definition is
	used by EFI implementations.
2013-12-14 22:04:02 +01:00
Vladimir Serbinenko 607a39f9f0 * include/grub/efi/api.h: Rename protocol and interface to avoid
conflict.
2013-12-14 21:48:46 +01:00
Vladimir Serbinenko 316dda716c Introduce grub_efi_packed_guid and use it where alignment is not
guaranteed.
2013-12-11 15:57:08 +01:00
Vladimir Serbinenko 30d0053799 * grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Add checks
for relocation range.
2013-12-11 11:29:35 +01:00
Vladimir Serbinenko 979742bc7e * grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Handle
non-function pcrel21b relocation. It happens with .text.unlikely
	section.
2013-12-11 11:28:48 +01:00
Leif Lindholm 16c8f78513 efi: mm: make MAX_USABLE_ADDRESS platform-specific 2013-12-10 18:05:29 +00:00
Vladimir Serbinenko 7a148da6dd Implement sparc64 trampolines (needed for sparc64-emu). 2013-12-10 00:01:27 +01:00
Vladimir Serbinenko 21eee750b7 * grub-core/kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Check
range of R_SPARC_HI22.
	Implement R_SPARC_LM22.
2013-12-09 15:51:12 +01:00
Vladimir Serbinenko 7b54b62682 * grub-core/kern/powerpc/dl_helper.c (grub_arch_dl_get_tramp_got_size):
Do not explicitly check for symbol table as it's already checked in
	platform-independent layer.
2013-12-09 15:43:27 +01:00
Vladimir Serbinenko 9a945e2a24 * grub-core/kern/emu/cache.c [__ia64__]: Use our cache cleaning routine
on ia64 as __clear_cache is a dummy on ia64.
2013-12-09 14:24:56 +01:00
Vladimir Serbinenko 4f4ea1b449 * grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
Do not explicitly check for symbol table as it's already checked in
	platform-independent layer.
2013-12-09 14:22:31 +01:00
Vladimir Serbinenko 78b2b0a1a0 * grub-core/kern/ia64/efi/init.c (grub_arch_sync_caches): Move to ...
* grub-core/kern/ia64/cache.c (grub_arch_sync_caches): ... here.
2013-12-08 18:27:40 +01:00
Vladimir Serbinenko d14772c455 * grub-core/kern/emu/main.c: Silence missing prototypes to allow emu
compilation with GCC <= 4.2.
	* grub-core/kern/emu/argp_common.c: Likewise.
2013-12-08 18:21:10 +01:00
Vladimir Serbinenko fa7eb63dec * grub-core/kern/emu/lite.c: Add missing include of ../ia64/dl_helper.c. 2013-12-08 18:14:32 +01:00
Vladimir Serbinenko 50b3a68db9 Remove grub_memalign on emu. 2013-12-08 18:12:20 +01:00
Vladimir Serbinenko fbbfb6ab11 * grub-core/kern/ia64/efi/init.c: Fix alignment code so it doesn't
truncate incomplete lines but instead flushes them.
2013-12-08 18:10:05 +01:00
Vladimir Serbinenko a19293cb75 Move OS-dependent mprotect for module loading to grub-core/osdep/*/dl.c
and implement windows variant.
2013-12-08 18:08:23 +01:00
Vladimir Serbinenko d5c14e1e26 Fix mips-emu compilation. 2013-12-08 17:49:02 +01:00
Vladimir Serbinenko c311ced5d7 Make arm-emu work. 2013-12-08 02:59:21 +01:00
Vladimir Serbinenko 8c534b85f1 Revamp relocation handling.
Move more code to common dl.c. Add missing veneers for arm and arm64.
	Decreases kernel size by 70 bytes on i386-pc (40-50 compressed)
2013-12-06 09:18:55 +01:00
Vladimir Serbinenko e5ed2f6947 Handle unaligned .bss on sparc64.
Current code improperly assumes that both __bss_start and _end are
	aligned to 8-bytes. Eliminating this assumption and explicitly align
	modules.
2013-12-05 06:35:19 +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 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
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 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 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 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 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 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 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 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
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
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