aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-01-24 15:19:57 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-01-29 18:25:45 -0500
commitf1da834cd902f5e5df0b11a3948fc43c6071b590 (patch)
treeb5af62bf482c592d589aab96f6910e5dd4d10220
parenta8a51a88d5152aa40e5e07dcdd939c7fafc42224 (diff)
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>
-rw-r--r--arch/x86/boot/compressed/cmdline.c10
-rw-r--r--arch/x86/kernel/head64.c13
2 files changed, 19 insertions, 4 deletions
diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
index 10f6b1178c68..b4c913c5c4ad 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -13,13 +13,19 @@ static inline char rdfs8(addr_t addr)
13 return *((char *)(fs + addr)); 13 return *((char *)(fs + addr));
14} 14}
15#include "../cmdline.c" 15#include "../cmdline.c"
16static unsigned long get_cmd_line_ptr(void)
17{
18 unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr;
19
20 return cmd_line_ptr;
21}
16int cmdline_find_option(const char *option, char *buffer, int bufsize) 22int cmdline_find_option(const char *option, char *buffer, int bufsize)
17{ 23{
18 return __cmdline_find_option(real_mode->hdr.cmd_line_ptr, option, buffer, bufsize); 24 return __cmdline_find_option(get_cmd_line_ptr(), option, buffer, bufsize);
19} 25}
20int cmdline_find_option_bool(const char *option) 26int cmdline_find_option_bool(const char *option)
21{ 27{
22 return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option); 28 return __cmdline_find_option_bool(get_cmd_line_ptr(), option);
23} 29}
24 30
25#endif 31#endif
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index b88a1fab2158..62c8ce44cac4 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -112,14 +112,23 @@ static void __init clear_bss(void)
112 (unsigned long) __bss_stop - (unsigned long) __bss_start); 112 (unsigned long) __bss_stop - (unsigned long) __bss_start);
113} 113}
114 114
115static unsigned long get_cmd_line_ptr(void)
116{
117 unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr;
118
119 return cmd_line_ptr;
120}
121
115static void __init copy_bootdata(char *real_mode_data) 122static void __init copy_bootdata(char *real_mode_data)
116{ 123{
117 char * command_line; 124 char * command_line;
125 unsigned long cmd_line_ptr;
118 126
119 memcpy(&boot_params, real_mode_data, sizeof boot_params); 127 memcpy(&boot_params, real_mode_data, sizeof boot_params);
120 sanitize_boot_params(&boot_params); 128 sanitize_boot_params(&boot_params);
121 if (boot_params.hdr.cmd_line_ptr) { 129 cmd_line_ptr = get_cmd_line_ptr();
122 command_line = __va(boot_params.hdr.cmd_line_ptr); 130 if (cmd_line_ptr) {
131 command_line = __va(cmd_line_ptr);
123 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 132 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
124 } 133 }
125} 134}