From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757543Ab2KVUSU (ORCPT ); Thu, 22 Nov 2012 15:18:20 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:65070 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754108Ab2KVUSQ (ORCPT ); Thu, 22 Nov 2012 15:18:16 -0500 MIME-Version: 1.0 In-Reply-To: <50AE7429.6030308@zytor.com> References: <1353482170-10160-1-git-send-email-yinghai@kernel.org> <1353482170-10160-12-git-send-email-yinghai@kernel.org> <50AD0CA1.8000904@zytor.com> <50AD291A.10600@zytor.com> <50AE70E7.6060204@zytor.com> <50AE7429.6030308@zytor.com> Date: Thu, 22 Nov 2012 12:18:15 -0800 X-Google-Sender-Auth: q7Aftm0X44KfhUWivkxnkYnY5kw Message-ID: Subject: Re: [PATCH v3 11/12] x86, boot: add fields to support load bzImage and ramdisk high From: Yinghai Lu To: "H. Peter Anvin" Cc: Thomas Gleixner , Ingo Molnar , "Eric W. Biederman" , linux-kernel@vger.kernel.org, Rob Landley , Matt Fleming Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2012 at 10:51 AM, H. Peter Anvin wrote: > On 11/22/2012 10:50 AM, Yinghai Lu wrote: >> >> >> ok, I will use 0xc0 instead, and at the same time try to fix that from >> kexec. >> >> then user will still have chance to use old kexec tools without enable >> CONFIG_EFI_STUB in kernel. >> > > If we can get the sentinel hack to work that would probably be useful, but > we need to understand the exact pathology. for kexec bzImage --real-mode-entry, code after setup_header will be executed. so we could clear value before setup_header after copy 16bit section from bzImage... Index: kexec-tools/kexec/arch/i386/kexec-bzImage.c =================================================================== --- kexec-tools.orig/kexec/arch/i386/kexec-bzImage.c +++ kexec-tools/kexec/arch/i386/kexec-bzImage.c @@ -212,6 +212,16 @@ int do_bzImage_load(struct kexec_info *i setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE; real_mode = xmalloc(setup_size); memcpy(real_mode, kernel, kern16_size); + /* + * clear value before header + * not not clear value after header, --real-mode-entry + * need code after header. + */ + memset(real_mode, 0, 0x1f1); + if (!real_mode_entry) { + /* clear value after setup_header */ + memset((unsigned char *)real_mode + 0x290, 0, kern16_size - 0x290); + } if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) { /* If using bzImage for capture kernel, then we will not be