lkml.org 
[lkml]   [2023]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/6] x86/boot: Clean up get_cmd_line_ptr()
Date
Pass in the boot_params pointer, and use the appropriate return type.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/kernel/head64.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 6e0f53a66678..08ea521041bf 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -434,19 +434,18 @@ void __init clear_bss(void)
(unsigned long) __brk_limit - (unsigned long) __brk_base);
}

-static unsigned long get_cmd_line_ptr(void)
+static char *get_cmd_line_ptr(struct boot_params *bp)
{
- unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr;
+ unsigned long cmd_line_ptr = bp->hdr.cmd_line_ptr;

- cmd_line_ptr |= (u64)boot_params.ext_cmd_line_ptr << 32;
+ cmd_line_ptr |= (u64)bp->ext_cmd_line_ptr << 32;

- return cmd_line_ptr;
+ return (char *)cmd_line_ptr;
}

static void __init copy_bootdata(char *real_mode_data)
{
- char * command_line;
- unsigned long cmd_line_ptr;
+ char *cmd_line_ptr;

/*
* If SME is active, this will create decrypted mappings of the
@@ -455,11 +454,9 @@ static void __init copy_bootdata(char *real_mode_data)
sme_map_bootdata(real_mode_data);

memcpy(&boot_params, real_mode_data, sizeof(boot_params));
- cmd_line_ptr = get_cmd_line_ptr();
- if (cmd_line_ptr) {
- command_line = __va(cmd_line_ptr);
- memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
- }
+ cmd_line_ptr = get_cmd_line_ptr(&boot_params);
+ if (cmd_line_ptr)
+ memcpy(boot_command_line, __va(cmd_line_ptr), COMMAND_LINE_SIZE);

/*
* The old boot data is no longer needed and won't be reserved,
--
2.39.2
\
 
 \ /
  Last update: 2023-04-12 20:46    [W:0.072 / U:2.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site