mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
x86, boot: Add get_cmd_line_ptr()
Add an accessor function for the command line address. Later we will add support for holding a 64-bit address via ext_cmd_line_ptr. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1359058816-7615-17-git-send-email-yinghai@kernel.org Cc: Gokul Caushik <caushik1@gmail.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Joe Millenbach <jmillenbach@gmail.com> Cc: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
a8a51a88d5
commit
f1da834cd9
2 changed files with 19 additions and 4 deletions
|
@ -13,13 +13,19 @@ static inline char rdfs8(addr_t addr)
|
||||||
return *((char *)(fs + addr));
|
return *((char *)(fs + addr));
|
||||||
}
|
}
|
||||||
#include "../cmdline.c"
|
#include "../cmdline.c"
|
||||||
|
static unsigned long get_cmd_line_ptr(void)
|
||||||
|
{
|
||||||
|
unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr;
|
||||||
|
|
||||||
|
return cmd_line_ptr;
|
||||||
|
}
|
||||||
int cmdline_find_option(const char *option, char *buffer, int bufsize)
|
int cmdline_find_option(const char *option, char *buffer, int bufsize)
|
||||||
{
|
{
|
||||||
return __cmdline_find_option(real_mode->hdr.cmd_line_ptr, option, buffer, bufsize);
|
return __cmdline_find_option(get_cmd_line_ptr(), option, buffer, bufsize);
|
||||||
}
|
}
|
||||||
int cmdline_find_option_bool(const char *option)
|
int cmdline_find_option_bool(const char *option)
|
||||||
{
|
{
|
||||||
return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option);
|
return __cmdline_find_option_bool(get_cmd_line_ptr(), option);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,14 +112,23 @@ static void __init clear_bss(void)
|
||||||
(unsigned long) __bss_stop - (unsigned long) __bss_start);
|
(unsigned long) __bss_stop - (unsigned long) __bss_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long get_cmd_line_ptr(void)
|
||||||
|
{
|
||||||
|
unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr;
|
||||||
|
|
||||||
|
return cmd_line_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
static void __init copy_bootdata(char *real_mode_data)
|
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);
|
memcpy(&boot_params, real_mode_data, sizeof boot_params);
|
||||||
sanitize_boot_params(&boot_params);
|
sanitize_boot_params(&boot_params);
|
||||||
if (boot_params.hdr.cmd_line_ptr) {
|
cmd_line_ptr = get_cmd_line_ptr();
|
||||||
command_line = __va(boot_params.hdr.cmd_line_ptr);
|
if (cmd_line_ptr) {
|
||||||
|
command_line = __va(cmd_line_ptr);
|
||||||
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
|
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue