Messages in this thread Patch in this message | | | Date | Mon, 14 Jan 2013 15:06:28 -0800 | Subject | Re: [PATCH v7u1 22/31] x86, boot: add fields to support load bzImage and ramdisk above 4G | From | Yinghai Lu <> |
| |
On Mon, Jan 14, 2013 at 1:43 AM, Borislav Petkov <bp@suse.de> wrote: >> >> --- a/arch/x86/boot/compressed/cmdline.c >> >> +++ b/arch/x86/boot/compressed/cmdline.c >> >> @@ -17,6 +17,8 @@ static unsigned long get_cmd_line_ptr(void) >> >> { >> >> unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr; >> >> >> >> + cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32; >> >> + >> >> return cmd_line_ptr; >> >> } >> > >> > On 32-bit, this unsigned long cmd_line_ptr is 4 bytes and the OR doesn't >> > have any effect on the final result. You probably want to do: >> >> yes, that is what we want to keep 32bit and 64bit unified. >> >> > >> > #ifdef CONFIG_64BIT >> > cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32; >> > #endif >> > >> > right? >> > >> > Or instead look at ->sentinel to know whether the ext_* fields are valid >> > or not, and save yourself the OR if not. >> >> no. >> >> that is whole point of sentinel, we don't need to check sentinel everywhere >> because ext_* are valid. > > Dude, do you even read my comments? This line: > > cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32; > > doesn't do a whit on 32-bit. So execute it *only* on 32-bit!
Following should work on 32bit, and keep them same code on 32bit and 64bit.
because ext_cmd_line_ptr is always 0 on 32bit.
Index: linux-2.6/arch/x86/boot/compressed/cmdline.c =================================================================== --- linux-2.6.orig/arch/x86/boot/compressed/cmdline.c +++ linux-2.6/arch/x86/boot/compressed/cmdline.c @@ -17,6 +17,9 @@ static unsigned long get_cmd_line_ptr(vo { unsigned long cmd_line_ptr = real_mode->hdr.cmd_line_ptr;
+ if (real_mode->ext_cmd_line_ptr) + cmd_line_ptr |= (u64)real_mode->ext_cmd_line_ptr << 32; + return cmd_line_ptr; } int cmdline_find_option(const char *option, char *buffer, int bufsize)
| |