From patchwork Fri Jul 25 15:23:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 34289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8FBF9235AB for ; Fri, 25 Jul 2014 15:25:13 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ij19sf12842635vcb.0 for ; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=atSbCvpjgmUK9Hp0aXUCmaOAclp14kd44LbfE8RQGYE=; b=TNp04FGJoo5K4gkgioLm+uoqWlIoRlx5jfSmS59oP2TPkQ8TmTGyM6VkPlwQlU+C3H dXiMGafWiozVj50o27xeqaREM3/5Un0Lf/HsdzxGNwoYOwOegYyVdHhF6fmlSYkhbI4B fnJodAebzbjhmsezVBaLDbH8tL+Tkr3Jx4nGvvR2D4vi86h6FN4fO15BfVvSMy0xQuOy Qt0TB3YDtxHHCch9DNOL8+ze3lV0vl5JJhNQW2Op3yKaLE71loaaZomr426CUW7/Uw4h fTFENluFqXKQQhZhDVQMyBS1BKmcLPVK22+T7HeFf0X7fJR72qs33ut+BcADGNrDdyRI tItg== X-Gm-Message-State: ALoCoQmPsYYVSZCtMthY/dU/zoYjC0pO2/I1uWPokTmW4IxeCkOxQhOBc0JheO073wyhvC2kTCb6 X-Received: by 10.224.46.3 with SMTP id h3mr7978922qaf.1.1406301913353; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.140 with SMTP id b12ls1106101qge.88.gmail; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) X-Received: by 10.52.12.229 with SMTP id b5mr2896103vdc.52.1406301913240; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id cn9si7657774vcb.71.2014.07.25.08.25.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Jul 2014 08:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu12so7573519vcb.28 for ; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr18438518vdc.24.1406301913162; Fri, 25 Jul 2014 08:25:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp46184vcb; Fri, 25 Jul 2014 08:25:12 -0700 (PDT) X-Received: by 10.224.5.5 with SMTP id 5mr1138156qat.74.1406301912638; Fri, 25 Jul 2014 08:25:12 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o8si16801608qai.119.2014.07.25.08.25.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 25 Jul 2014 08:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:55416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhMt-0004l1-VR for patch@linaro.org; Fri, 25 Jul 2014 11:25:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhLY-0003CX-Ot for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:23:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAhLV-0004Up-UV for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:23:48 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhLV-0004TC-OJ; Fri, 25 Jul 2014 11:23:45 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1XAhLN-0005PP-K0; Fri, 25 Jul 2014 16:23:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 25 Jul 2014 16:23:37 +0100 Message-Id: <1406301817-20766-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Christopher Covington , qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH] hw/arm/boot: Set PC correctly when loading AArch64 ELF files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The code in do_cpu_reset() correctly handled AArch64 CPUs when running Linux kernels, but was missing code in the branch of the if() that deals with loading ELF files. Correctly jump to the ELF entry point on reset rather than leaving the reset PC at zero. Reported-by: Christopher Covington Signed-off-by: Peter Maydell Cc: qemu-stable@nongnu.org Tested-by: Christopher Covington --- hw/arm/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 3d1f4a2..1241761 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -417,8 +417,12 @@ static void do_cpu_reset(void *opaque) if (info) { if (!info->is_linux) { /* Jump to the entry point. */ - env->regs[15] = info->entry & 0xfffffffe; - env->thumb = info->entry & 1; + if (env->aarch64) { + env->pc = info->entry; + } else { + env->regs[15] = info->entry & 0xfffffffe; + env->thumb = info->entry & 1; + } } else { if (CPU(cpu) == first_cpu) { if (env->aarch64) {