Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86ec090e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from H. Peter Anvin.

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x32, siginfo: Provide proper overrides for x32 siginfo_t
  asm-generic: Allow overriding clock_t and add attributes to siginfo_t
  x32: Check __ILP32__ instead of __LP64__ for x32
  x86, acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler
  ACPI: Convert wake_sleep_flags to a value instead of function
  x86, apic: APIC code touches invalid MSR on P5 class machines
  i387: ptrace breaks the lazy-fpu-restore logic
  x86/platform: Remove incorrect error message in x86_default_fixup_cpu_id()
  x86, efi: Add dedicated EFI stub entry point
  x86/amd: Remove broken links from comment and kernel message
  x86, microcode: Ensure that module is only loaded on supported AMD CPUs
  x86, microcode: Fix sysfs warning during module unload on unsupported CPUs
parents bdd4f709 89b8835e
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -33,6 +33,9 @@
	__HEAD
	__HEAD
ENTRY(startup_32)
ENTRY(startup_32)
#ifdef CONFIG_EFI_STUB
#ifdef CONFIG_EFI_STUB
	jmp	preferred_addr

	.balign	0x10
	/*
	/*
	 * We don't need the return address, so set up the stack so
	 * We don't need the return address, so set up the stack so
	 * efi_main() can find its arugments.
	 * efi_main() can find its arugments.
@@ -41,12 +44,17 @@ ENTRY(startup_32)


	call	efi_main
	call	efi_main
	cmpl	$0, %eax
	cmpl	$0, %eax
	je	preferred_addr
	movl	%eax, %esi
	movl	%eax, %esi
	call	1f
	jne	2f
1:
1:
	/* EFI init failed, so hang. */
	hlt
	jmp	1b
2:
	call	3f
3:
	popl	%eax
	popl	%eax
	subl	$1b, %eax
	subl	$3b, %eax
	subl	BP_pref_address(%esi), %eax
	subl	BP_pref_address(%esi), %eax
	add	BP_code32_start(%esi), %eax
	add	BP_code32_start(%esi), %eax
	leal	preferred_addr(%eax), %eax
	leal	preferred_addr(%eax), %eax
+16 −6
Original line number Original line Diff line number Diff line
@@ -200,18 +200,28 @@ ENTRY(startup_64)
	 * entire text+data+bss and hopefully all of memory.
	 * entire text+data+bss and hopefully all of memory.
	 */
	 */
#ifdef CONFIG_EFI_STUB
#ifdef CONFIG_EFI_STUB
	pushq	%rsi
	/*
	 * The entry point for the PE/COFF executable is 0x210, so only
	 * legacy boot loaders will execute this jmp.
	 */
	jmp	preferred_addr

	.org 0x210
	mov	%rcx, %rdi
	mov	%rcx, %rdi
	mov	%rdx, %rsi
	mov	%rdx, %rsi
	call	efi_main
	call	efi_main
	popq	%rsi
	cmpq	$0,%rax
	je	preferred_addr
	movq	%rax,%rsi
	movq	%rax,%rsi
	call	1f
	cmpq	$0,%rax
	jne	2f
1:
1:
	/* EFI init failed, so hang. */
	hlt
	jmp	1b
2:
	call	3f
3:
	popq	%rax
	popq	%rax
	subq	$1b, %rax
	subq	$3b, %rax
	subq	BP_pref_address(%rsi), %rax
	subq	BP_pref_address(%rsi), %rax
	add	BP_code32_start(%esi), %eax
	add	BP_code32_start(%esi), %eax
	leaq	preferred_addr(%rax), %rax
	leaq	preferred_addr(%rax), %rax
+11 −4
Original line number Original line Diff line number Diff line
@@ -205,8 +205,13 @@ int main(int argc, char ** argv)
	put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);
	put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);


#ifdef CONFIG_X86_32
#ifdef CONFIG_X86_32
	/* Address of entry point */
	/*
	put_unaligned_le32(i, &buf[pe_header + 0x28]);
	 * Address of entry point.
	 *
	 * The EFI stub entry point is +16 bytes from the start of
	 * the .text section.
	 */
	put_unaligned_le32(i + 16, &buf[pe_header + 0x28]);


	/* .text size */
	/* .text size */
	put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]);
	put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]);
@@ -217,9 +222,11 @@ int main(int argc, char ** argv)
	/*
	/*
	 * Address of entry point. startup_32 is at the beginning and
	 * Address of entry point. startup_32 is at the beginning and
	 * the 64-bit entry point (startup_64) is always 512 bytes
	 * the 64-bit entry point (startup_64) is always 512 bytes
	 * after.
	 * after. The EFI stub entry point is 16 bytes after that, as
	 * the first instruction allows legacy loaders to jump over
	 * the EFI stub initialisation
	 */
	 */
	put_unaligned_le32(i + 512, &buf[pe_header + 0x28]);
	put_unaligned_le32(i + 528, &buf[pe_header + 0x28]);


	/* .text size */
	/* .text size */
	put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]);
	put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]);
+3 −3
Original line number Original line Diff line number Diff line
@@ -7,9 +7,9 @@
#else
#else
# ifdef __i386__
# ifdef __i386__
#  include "posix_types_32.h"
#  include "posix_types_32.h"
# elif defined(__LP64__)
# elif defined(__ILP32__)
#  include "posix_types_64.h"
# else
#  include "posix_types_x32.h"
#  include "posix_types_x32.h"
# else
#  include "posix_types_64.h"
# endif
# endif
#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -257,7 +257,7 @@ struct sigcontext {
	__u64 oldmask;
	__u64 oldmask;
	__u64 cr2;
	__u64 cr2;
	struct _fpstate __user *fpstate;	/* zero when no FPU context */
	struct _fpstate __user *fpstate;	/* zero when no FPU context */
#ifndef __LP64__
#ifdef __ILP32__
	__u32 __fpstate_pad;
	__u32 __fpstate_pad;
#endif
#endif
	__u64 reserved1[8];
	__u64 reserved1[8];
Loading