Re: [PATCH v2 4/6] kexec, x86: set ext_cmd_line_ptr when boot_param is put high

Eric W. Biederman
2012-11-19T17:22:44Z

Yinghai Lu <yinghai@kernel.org> writes:

> only do that for bzImage64, and it could have command line above 4g.

Just a small nit.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> kexec/arch/i386/x86-linux-setup.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index b0e6119..c929166 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -105,7 +105,13 @@ void setup_linux_bootloader_parameters(
> /* setup_move_size */
> /* } */
> if (real_mode->protocol_version >= 0x0202) {
> - real_mode->cmd_line_ptr = real_mode_base + cmdline_offset;
> + unsigned long cmd_line_ptr = real_mode_base + cmdline_offset;
> +
> + real_mode->cmd_line_ptr = cmd_line_ptr & 0xffffffff;
> + if (real_mode->protocol_version >= 0x020c)

It probably makes sense to guard this with a test to see if the
cmd_line_ptr value exceeds 4G before doing the >> 32 in case a 32bit
kernel uses boot protocol 0x020c and we have a 32bit kexec.

+ if ((real_mode->protocol_version >= 0x020c) &&
+ ((cmd_line_ptr & 0xffffffffUL) != cmd_line_ptr))

> + real_mode->ext_cmd_line_ptr = cmd_line_ptr >> 32;
> +
> + printf("cmd_line_ptr: %lx\n", cmd_line_ptr);
> }
>
> /* Fill in the command line */

Eric