Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1592440

[PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual address to C

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject [PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual address to C
Date 2017-03-04 11:00 +0100
Message-ID <theDL-7cX-9@gated-at.bofh.it> (permalink)
References <theDL-7cX-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Borislav Petkov <bp@suse.de>

... so that callees don't have to convert it and can use it directly.
Simplifies C code a bit. Cleanup comments and formatting in the
vicinity, while at it.

Also, document what phys_base really is.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/head64.c  |  8 ++++----
 arch/x86/kernel/head_64.S | 10 +++++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 54a2372f5dbb..17ee20a9b4e4 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -118,7 +118,7 @@ static unsigned long get_cmd_line_ptr(void)
 
 static void __init copy_bootdata(char *real_mode_data)
 {
-	char * command_line;
+	char *command_line;
 	unsigned long cmd_line_ptr;
 
 	memcpy(&boot_params, real_mode_data, sizeof boot_params);
@@ -130,7 +130,7 @@ static void __init copy_bootdata(char *real_mode_data)
 	}
 }
 
-asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
+asmlinkage __visible void __init x86_64_start_kernel(char *real_mode_data)
 {
 	int i;
 
@@ -163,7 +163,7 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
 		set_intr_gate(i, early_idt_handler_array[i]);
 	load_idt((const struct desc_ptr *)&idt_descr);
 
-	copy_bootdata(__va(real_mode_data));
+	copy_bootdata(real_mode_data);
 
 	/*
 	 * Load microcode early on BSP.
@@ -180,7 +180,7 @@ void __init x86_64_start_reservations(char *real_mode_data)
 {
 	/* version is always not zero if it is copied */
 	if (!boot_params.hdr.version)
-		copy_bootdata(__va(real_mode_data));
+		copy_bootdata(real_mode_data);
 
 	x86_early_init_platform_quirks();
 
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ac9d327d2e42..506de36293bc 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -266,9 +266,12 @@ ENTRY(secondary_startup_64)
 	movl	initial_gs+4(%rip),%edx
 	wrmsr
 
-	/* rsi is pointer to real mode structure with interesting info.
-	   pass it to C */
-	movq	%rsi, %rdi
+	/*
+	 * %rsi is pointer to real mode struct boot_params with interesting info.
+	 * Pass its virtual address to C.
+	 */
+	movq	$__PAGE_OFFSET_BASE, %rdi
+	addq	%rsi, %rdi
 
 .Ljump_to_C_code:
 	/*
@@ -487,6 +490,7 @@ early_gdt_descr:
 early_gdt_descr_base:
 	.quad	INIT_PER_CPU_VAR(gdt_page)
 
+/* The physical address the kernel is loaded at. */
 ENTRY(phys_base)
 	/* This must match the first entry in level2_kernel_pgt */
 	.quad   0x0000000000000000
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] x86/head_64.S: Rename start_cpu() Borislav Petkov <bp@alien8.de> - 2017-03-04 11:00 +0100
  [PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual address to C Borislav Petkov <bp@alien8.de> - 2017-03-04 11:00 +0100
    Re: [PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual  address to C Ingo Molnar <mingo@kernel.org> - 2017-03-07 10:20 +0100
      Re: [PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual  address to C Borislav Petkov <bp@alien8.de> - 2017-03-07 12:00 +0100
  Re: [PATCH 1/2] x86/head_64.S: Rename start_cpu() Ingo Molnar <mingo@kernel.org> - 2017-03-07 10:10 +0100
    Re: [PATCH 1/2] x86/head_64.S: Rename start_cpu() Borislav Petkov <bp@alien8.de> - 2017-03-07 12:00 +0100
      Re: [PATCH 1/2] x86/head_64.S: Rename start_cpu() Ingo Molnar <mingo@kernel.org> - 2017-03-07 16:00 +0100
  [tip:x86/boot] x86/boot/64: Rename start_cpu() tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-03-07 14:10 +0100

csiph-web