2011-02-09 15:24:34 +07:00
|
|
|
/*
|
|
|
|
* Generate definitions needed by assembly language modules.
|
|
|
|
* This code generates raw asm output which is post-processed to extract
|
|
|
|
* and format the required data.
|
|
|
|
*/
|
|
|
|
#define COMPILE_OFFSETS
|
|
|
|
|
|
|
|
#include <linux/crypto.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
#include <linux/hardirq.h>
|
|
|
|
#include <linux/suspend.h>
|
|
|
|
#include <linux/kbuild.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/thread_info.h>
|
|
|
|
#include <asm/sigframe.h>
|
|
|
|
#include <asm/bootparam.h>
|
|
|
|
#include <asm/suspend.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_XEN
|
|
|
|
#include <xen/interface/xen.h>
|
|
|
|
#endif
|
|
|
|
|
2007-10-11 16:12:08 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
|
|
|
# include "asm-offsets_32.c"
|
|
|
|
#else
|
|
|
|
# include "asm-offsets_64.c"
|
2007-07-19 15:49:26 +07:00
|
|
|
#endif
|
2011-02-09 15:24:34 +07:00
|
|
|
|
|
|
|
void common(void) {
|
|
|
|
BLANK();
|
|
|
|
OFFSET(TI_flags, thread_info, flags);
|
|
|
|
OFFSET(TI_status, thread_info, status);
|
|
|
|
OFFSET(TI_addr_limit, thread_info, addr_limit);
|
|
|
|
|
|
|
|
BLANK();
|
|
|
|
OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
|
|
|
|
|
|
|
|
BLANK();
|
|
|
|
OFFSET(pbe_address, pbe, address);
|
|
|
|
OFFSET(pbe_orig_address, pbe, orig_address);
|
|
|
|
OFFSET(pbe_next, pbe, next);
|
|
|
|
|
2015-04-12 20:14:45 +07:00
|
|
|
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
|
|
|
|
BLANK();
|
|
|
|
OFFSET(IA32_SIGCONTEXT_ax, sigcontext_ia32, ax);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_bx, sigcontext_ia32, bx);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_cx, sigcontext_ia32, cx);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_dx, sigcontext_ia32, dx);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_si, sigcontext_ia32, si);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_di, sigcontext_ia32, di);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_bp, sigcontext_ia32, bp);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_sp, sigcontext_ia32, sp);
|
|
|
|
OFFSET(IA32_SIGCONTEXT_ip, sigcontext_ia32, ip);
|
|
|
|
|
|
|
|
BLANK();
|
|
|
|
OFFSET(TI_sysenter_return, thread_info, sysenter_return);
|
|
|
|
|
|
|
|
BLANK();
|
|
|
|
OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);
|
|
|
|
#endif
|
|
|
|
|
2011-02-09 15:24:34 +07:00
|
|
|
#ifdef CONFIG_PARAVIRT
|
|
|
|
BLANK();
|
|
|
|
OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
|
|
|
|
OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
|
|
|
|
OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
|
|
|
|
OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
|
|
|
|
OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
|
|
|
|
OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
|
2015-04-04 05:51:54 +07:00
|
|
|
#ifdef CONFIG_X86_32
|
2011-02-09 15:24:34 +07:00
|
|
|
OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
|
2015-04-04 05:51:54 +07:00
|
|
|
#endif
|
2011-02-09 15:24:34 +07:00
|
|
|
OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
|
|
|
|
OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_XEN
|
|
|
|
BLANK();
|
|
|
|
OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
|
|
|
|
OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BLANK();
|
|
|
|
OFFSET(BP_scratch, boot_params, scratch);
|
|
|
|
OFFSET(BP_loadflags, boot_params, hdr.loadflags);
|
|
|
|
OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
|
|
|
|
OFFSET(BP_version, boot_params, hdr.version);
|
|
|
|
OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
|
x86, efi: EFI boot stub support
There is currently a large divide between kernel development and the
development of EFI boot loaders. The idea behind this patch is to give
the kernel developers full control over the EFI boot process. As
H. Peter Anvin put it,
"The 'kernel carries its own stub' approach been very successful in
dealing with BIOS, and would make a lot of sense to me for EFI as
well."
This patch introduces an EFI boot stub that allows an x86 bzImage to
be loaded and executed by EFI firmware. The bzImage appears to the
firmware as an EFI application. Luckily there are enough free bits
within the bzImage header so that it can masquerade as an EFI
application, thereby coercing the EFI firmware into loading it and
jumping to its entry point. The beauty of this masquerading approach
is that both BIOS and EFI boot loaders can still load and run the same
bzImage, thereby allowing a single kernel image to work in any boot
environment.
The EFI boot stub supports multiple initrds, but they must exist on
the same partition as the bzImage. Command-line arguments for the
kernel can be appended after the bzImage name when run from the EFI
shell, e.g.
Shell> bzImage console=ttyS0 root=/dev/sdb initrd=initrd.img
v7:
- Fix checkpatch warnings.
v6:
- Try to allocate initrd memory just below hdr->inird_addr_max.
v5:
- load_options_size is UTF-16, which needs dividing by 2 to convert
to the corresponding ASCII size.
v4:
- Don't read more than image->load_options_size
v3:
- Fix following warnings when compiling CONFIG_EFI_STUB=n
arch/x86/boot/tools/build.c: In function ‘main’:
arch/x86/boot/tools/build.c:138:24: warning: unused variable ‘pe_header’
arch/x86/boot/tools/build.c:138:15: warning: unused variable ‘file_sz’
- As reported by Matthew Garrett, some Apple machines have GOPs that
don't have hardware attached. We need to weed these out by
searching for ones that handle the PCIIO protocol.
- Don't allocate memory if no initrds are on cmdline
- Don't trust image->load_options_size
Maarten Lankhorst noted:
- Don't strip first argument when booted from efibootmgr
- Don't allocate too much memory for cmdline
- Don't update cmdline_size, the kernel considers it read-only
- Don't accept '\n' for initrd names
v2:
- File alignment was too large, was 8192 should be 512. Reported by
Maarten Lankhorst on LKML.
- Added UGA support for graphics
- Use VIDEO_TYPE_EFI instead of hard-coded number.
- Move linelength assignment until after we've assigned depth
- Dynamically fill out AddressOfEntryPoint in tools/build.c
- Don't use magic number for GDT/TSS stuff. Requested by Andi Kleen
- The bzImage may need to be relocated as it may have been loaded at
a high address address by the firmware. This was required to get my
macbook booting because the firmware loaded it at 0x7cxxxxxx, which
triggers this error in decompress_kernel(),
if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff))
error("Destination address too large");
Cc: Mike Waychison <mikew@google.com>
Cc: Matthew Garrett <mjg@redhat.com>
Tested-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/1321383097.2657.9.camel@mfleming-mobl1.ger.corp.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-12-13 04:27:52 +07:00
|
|
|
OFFSET(BP_pref_address, boot_params, hdr.pref_address);
|
|
|
|
OFFSET(BP_code32_start, boot_params, hdr.code32_start);
|
2012-08-03 02:05:11 +07:00
|
|
|
|
|
|
|
BLANK();
|
|
|
|
DEFINE(PTREGS_SIZE, sizeof(struct pt_regs));
|
2011-02-09 15:24:34 +07:00
|
|
|
}
|