diff options
author | H. Peter Anvin (Intel) <hpa@zytor.com> | 2019-03-25 14:49:24 -0700 |
---|---|---|
committer | H. Peter Anvin (Intel) <hpa@zytor.com> | 2019-03-25 14:49:24 -0700 |
commit | 5233e1ad742a7d943b3e1e5f054a62786cf76601 (patch) | |
tree | de896e816160686548ff9816f3f5adba9798ebd2 | |
parent | 80b516df534ff9d6cb0659d7eff6022d959cb334 (diff) | |
download | syslinux-5233e1ad742a7d943b3e1e5f054a62786cf76601.tar.gz syslinux-5233e1ad742a7d943b3e1e5f054a62786cf76601.tar.xz syslinux-5233e1ad742a7d943b3e1e5f054a62786cf76601.zip |
lib: factor out more BIOS-specific code
Don't build BIOS-specific code for EFI. Just... don't.
Work more on eliminating the firmware structure; it is completely
unnecessary and should be replaced by just normalizing symbols.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r-- | com32/lib/Makefile | 11 | ||||
-rw-r--r-- | com32/lib/bios/boot.c (renamed from com32/lib/syslinux/biosboot.c) | 0 | ||||
-rw-r--r-- | com32/lib/bios/i386/setjmp.S (renamed from com32/lib/i386/setjmp.S) | 0 | ||||
-rw-r--r-- | com32/lib/bios/load_linux.c (renamed from com32/lib/syslinux/load_linux.c) | 21 | ||||
-rw-r--r-- | com32/lib/x86_64/setjmp.S | 54 | ||||
-rw-r--r-- | core/efi/main.c | 17 |
6 files changed, 23 insertions, 80 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile index 4c9ca6c9..5091e3fa 100644 --- a/com32/lib/Makefile +++ b/com32/lib/Makefile @@ -144,6 +144,17 @@ CORELIBOBJS = \ $(LIBENTRY_OBJS) \ $(LIBMODULE_OBJS) +# Firmware-specific modules +FWSRCS := $(sort $(shell find '$(SRC)/$(fwclass)' \ + -name $(ARCH) -type d -true -o \ + -regex '.*/arch/[^/]+' -type d -prune -o \ + -type -f -print)) +FWCSRCS := $(filter %.c, $(FWSRCS)) +FWSSRCS := $(filter %.S, $(FWSRCS)) +FWOBJS := $(FWCSRCS:%(SRC)/%.c=%.o) $(FWSSRCS:%(SRC)/%.S=%.o) + +CORELIBOBJS += $(FWOBJS) + ifneq ($(FWCLASS),EFI) # For EFI, these are part of gnu-efi CORELIBOBJS += $(ARCH)/setjmp.o memcpy.o memset.o diff --git a/com32/lib/syslinux/biosboot.c b/com32/lib/bios/boot.c index 5e599bb5..5e599bb5 100644 --- a/com32/lib/syslinux/biosboot.c +++ b/com32/lib/bios/boot.c diff --git a/com32/lib/i386/setjmp.S b/com32/lib/bios/i386/setjmp.S index 658df485..658df485 100644 --- a/com32/lib/i386/setjmp.S +++ b/com32/lib/bios/i386/setjmp.S diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/bios/load_linux.c index f7a57dc2..495f0605 100644 --- a/com32/lib/syslinux/load_linux.c +++ b/com32/lib/bios/load_linux.c @@ -151,10 +151,10 @@ static size_t calc_cmdline_offset(const struct syslinux_memmap *mmap, return (0x9ff0 - cmdline_size) & ~15; /* Legacy value: pure hope... */ } -int bios_boot_linux(void *kernel_buf, size_t kernel_size, - struct initramfs *initramfs, - struct setup_data *setup_data, - char *cmdline) +int syslinux_boot_linux(void *kernel_buf, size_t kernel_size, + struct initramfs *initramfs, + struct setup_data *setup_data, + char *cmdline) { struct linux_header hdr, *whdr; size_t real_mode_size, prot_mode_size; @@ -512,16 +512,3 @@ bail: syslinux_free_memmap(amap); return -1; } - -int syslinux_boot_linux(void *kernel_buf, size_t kernel_size, - struct initramfs *initramfs, - struct setup_data *setup_data, - char *cmdline) -{ - if (firmware->boot_linux) - return firmware->boot_linux(kernel_buf, kernel_size, initramfs, - setup_data, cmdline); - - return bios_boot_linux(kernel_buf, kernel_size, initramfs, - setup_data, cmdline); -} diff --git a/com32/lib/x86_64/setjmp.S b/com32/lib/x86_64/setjmp.S deleted file mode 100644 index 45f547b4..00000000 --- a/com32/lib/x86_64/setjmp.S +++ /dev/null @@ -1,54 +0,0 @@ -# -# arch/x86_64/setjmp.S -# -# setjmp/longjmp for the x86-64 architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# %rbx -# %rsp (post-return) -# %rbp -# %r12 -# %r13 -# %r14 -# %r15 -# <return address> -# - - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: - pop %rsi # Return address, and adjust the stack - xorl %eax,%eax # Return value - movq %rbx,(%rdi) - movq %rsp,8(%rdi) # Post-return %rsp! - push %rsi # Make the call/return stack happy - movq %rbp,16(%rdi) - movq %r12,24(%rdi) - movq %r13,32(%rdi) - movq %r14,40(%rdi) - movq %r15,48(%rdi) - movq %rsi,56(%rdi) # Return address - ret - - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: - movl %esi,%eax # Return value (int) - movq (%rdi),%rbx - movq 8(%rdi),%rsp - movq 16(%rdi),%rbp - movq 24(%rdi),%r12 - movq 32(%rdi),%r13 - movq 40(%rdi),%r14 - movq 48(%rdi),%r15 - jmp *56(%rdi) - - .size longjmp,.-longjmp diff --git a/core/efi/main.c b/core/efi/main.c index 27923d38..a513ad55 100644 --- a/core/efi/main.c +++ b/core/efi/main.c @@ -459,7 +459,7 @@ struct efi_info { #define BOOT_SIGNATURE 0xaa55 #define SYSLINUX_EFILDR 0x30 /* Is this published value? */ -#define DEFAULT_TIMER_TICK_DURATION 500000 /* 500000 == 500000 * 100 * 10^-9 == 50 msec */ +#define DEFAULT_TIMER_TICK_DURATION 500000 /* 500000 == 500000 * 100 * 10^-9 == 50 msec */ #define DEFAULT_MSTIMER_INC 0x32 /* 50 msec */ struct e820_entry { uint64_t start; @@ -486,7 +486,7 @@ struct boot_params { * emalloc()/efree, alloc_pages/free_pages * allocate_pool()/free_pool() * memory_map() - */ + */ extern void kernel_jump(EFI_PHYSICAL_ADDRESS kernel_start, struct boot_params *boot_params); #if __SIZEOF_POINTER__ == 4 @@ -1097,23 +1097,23 @@ static int exit_boot(struct boot_params *bp) return 0; } -/* efi_boot_linux: +/* syslinux_boot_linux: * Boots the linux kernel using the image and parameters to boot with. * The EFI boot loader is reworked taking the cue from * http://git.kernel.org/?p=boot/efilinux/efilinux.git on the need to * cap key kernel data structures at * 0x3FFFFFFF. * The kernel image, kernel command line and boot parameter block are copied * into allocated memory areas that honor the address capping requirement - * prior to kernel handoff. + * prior to kernel handoff. * * FIXME * Can we move this allocation requirement to com32 linux loader in order * to avoid double copying kernel image? */ -int efi_boot_linux(void *kernel_buf, size_t kernel_size, - struct initramfs *initramfs, - struct setup_data *setup_data, - char *cmdline) +int syslinux_boot_linux(void *kernel_buf, size_t kernel_size, + struct initramfs *initramfs, + struct setup_data *setup_data, + char *cmdline) { struct linux_header *hdr; struct boot_params *bp; @@ -1251,7 +1251,6 @@ struct firmware efi_fw = { .i_ops = &efi_iops, .get_serial_console_info = serialcfg, .adv_ops = &efi_adv_ops, - .boot_linux = efi_boot_linux, .vesa = &efi_vesa_ops, }; |