From nobody Mon Apr 29 10:24:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517844232867860.1879180397594; Mon, 5 Feb 2018 07:23:52 -0800 (PST) Received: from localhost ([::1]:53204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiicZ-0003P1-Tc for importer@patchew.org; Mon, 05 Feb 2018 10:23:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiiJw-00049i-9V for qemu-devel@nongnu.org; Mon, 05 Feb 2018 10:04:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiiJq-0006wi-EY for qemu-devel@nongnu.org; Mon, 05 Feb 2018 10:04:36 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:46212) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eiiJq-0006uY-7w for qemu-devel@nongnu.org; Mon, 05 Feb 2018 10:04:30 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eiiJn-0004P8-Ke; Mon, 05 Feb 2018 15:04:27 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 5 Feb 2018 15:04:26 +0000 Message-Id: <20180205150426.20542-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] hw/core/generic-loader: Allow PC to be set on command line X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The documentation for the generic loader claims that you can set the PC for a CPU with an option of the form -device loader,cpu-num=3D0,addr=3D0x10000004 However if you try this QEMU complains: cpu_num must be specified when setting a program counter This is because we were testing against 0 rather than CPU_NONE. Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- I've also noticed that you can't use this to specify that the starting address should be in Thumb mode for Arm CPUs, but I'm not so sure of the right way to fix that... hw/core/generic-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index 46012673c3..cb0e68486d 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -105,7 +105,7 @@ static void generic_loader_realize(DeviceState *dev, Er= ror **errp) error_setg(errp, "data can not be specified when setting a " "program counter"); return; - } else if (!s->cpu_num) { + } else if (s->cpu_num =3D=3D CPU_NONE) { error_setg(errp, "cpu_num must be specified when setting a " "program counter"); return; --=20 2.16.1