From nobody Sun Nov 16 18:52:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) client-ip=209.85.221.67; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f67.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1601224789; cv=none; d=zohomail.com; s=zohoarc; b=D+/WoWAc6v0XLeJKVnRtbQ4LFOg++jyRxgnwacH6nvfTib5eu43a5TPtnyZkhFKuIFnrUdP9H3mRRrlda+SZUGQgK00NkENze2TLbk53ujVLbvUUCeC8lRBzdHw2+76Txcd9AzwPPpk0TBEwXzsxhI1VDWQwFxtdWkLytJYtJNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601224789; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wcij9GO4gLo8n4f2y2Sh6IBkKvCpAomrBCYklDDmQdw=; b=KFSUlLLXW6Rik1LZj+U2PVNK0o0O3YLKOfidEX0JqvqTmucchqkakxFEiQbRvV8RUB0UdlrJkljHs4JaLLQojbAAke+idQEcA4SfOYJ/l6EPoX8bD/PZjAGMudUG/C+DRnnnoQl5oBKTAb/4TgoiJacI56u4XSPjfRYfaR49i3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.zohomail.com with SMTPS id 1601224789080284.97360103387064; Sun, 27 Sep 2020 09:39:49 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id s12so9142663wrw.11 for ; Sun, 27 Sep 2020 09:39:48 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id m10sm5820184wmi.9.2020.09.27.09.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2020 09:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wcij9GO4gLo8n4f2y2Sh6IBkKvCpAomrBCYklDDmQdw=; b=fuxpqudZwh1ft/RJqtRtR2byLfUT/nc8uWACxJX6YyI0b9IsdpM9QOK5jIKW/GSAbn TwfmOMF0gl/in4ANDJU6DK2kvqS2PhLZ0HEnEhEJFn2BID8J7Qs43zsJuoidNzD/IMDb L2BHm8JoT9hLnV+j233x81Lb+mNwfrNG59w0q2drWhYaLyVIKAbCtiUGZrVRJnDOrBVq Ul6K6ZbIJji5xFRd6l531+zpd1V0nO51cJcLW/NvVgkxkTeCjMWR1SLUzczC1zbcYBws TBUXwe2w0dysleakmmSGvvgrpTDM8ITKIwcc5XpMQ45G77mQZRilyg4l2ESS0R4ysPzK bXgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wcij9GO4gLo8n4f2y2Sh6IBkKvCpAomrBCYklDDmQdw=; b=sbEfvX7VjAe2fvZVkm3MPQbi4cMZojWtmyqrU0P1KHB7x7BoPNp9U/BRTvgQxzzkbi BX700mwCjXsw2EGYVX99DjTItZzUNk2CrysjAqFrjWW1TDp3L/u5iSO6JsGKYbluQrI2 Y4k+3+S26Qki4oWpxnhJkcqe9834IbZO/RE2Q0XPRIALGDZR211My6lAbcWxHHf640JG dDygZAcCA9CC8+urjIbSgXquofxKH8Yrg4WD4OIxGv6ziNxQCNb2+z9ddXzrUcGIbnTF fPVf7ruo3tPk/DIDCZXK/m+5Ih23BUEJjjLU5Ca0ZAJjFdVlhmWeWrNcPCYCZ7htnZrI Ao8g== X-Gm-Message-State: AOAM5336Kp9Us7tE1ujwvY68c5nd5EsTTHzi6NGM4lCFFMTUG4OUdU8l RevSegrxPIL0/c8tzX+VjQ8= X-Google-Smtp-Source: ABdhPJyutFygH37n6cayc8Nm+sya0joDBCNlf8HDoGOMnfQormB6elJNj0HrXRLKTgSfiN0Q9A+udg== X-Received: by 2002:adf:ef0a:: with SMTP id e10mr14502107wro.362.1601224787118; Sun, 27 Sep 2020 09:39:47 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aleksandar Rikalo , Aleksandar Markovic , Jiaxun Yang , Huacai Chen , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/2] hw/mips: Simplify loading 64-bit ELF kernels Date: Sun, 27 Sep 2020 18:39:42 +0200 Message-Id: <20200927163943.614604-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200927163943.614604-1-f4bug@amsat.org> References: <20200927163943.614604-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Since 82790064116 ("Cast ELF datatypes properly to host 64bit types") we don't need to sign-extend the entry_point address. Remove this unnecessary code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/mips/mipssim.c | 6 +----- hw/mips/r4k.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 1b3b7622035..3aeb1207e1a 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -76,11 +76,7 @@ static int64_t load_kernel(void) (uint64_t *)&entry, NULL, (uint64_t *)&kernel_high, NULL, big_endian, EM_MIPS, 1, 0); - if (kernel_size >=3D 0) { - if ((entry & ~0x7fffffffULL) =3D=3D 0x80000000) { - entry =3D (int32_t)entry; - } - } else { + if (kernel_size < 0) { error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c index 3487013a4a1..74f916a3982 100644 --- a/hw/mips/r4k.c +++ b/hw/mips/r4k.c @@ -101,11 +101,7 @@ static int64_t load_kernel(void) (uint64_t *)&entry, NULL, (uint64_t *)&kernel_high, NULL, big_endian, EM_MIPS, 1, 0); - if (kernel_size >=3D 0) { - if ((entry & ~0x7fffffffULL) =3D=3D 0x80000000) { - entry =3D (int32_t)entry; - } - } else { + if (kernel_size < 0) { error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); --=20 2.26.2