From nobody Tue May 7 12:15:15 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499786388265328.17714005837456; Tue, 11 Jul 2017 08:19:48 -0700 (PDT) Received: from localhost ([::1]:46971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwwv-000823-4k for importer@patchew.org; Tue, 11 Jul 2017 11:19:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwtk-0005j1-2Q for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUwth-0005xu-4a for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:24 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:36075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwtg-0005wv-Uv for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:21 -0400 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id B9BBAADA4F336 for ; Tue, 11 Jul 2017 16:16:13 +0100 (IST) Received: from localhost.localdomain (192.168.169.30) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 11 Jul 2017 16:16:17 +0100 From: Yongbok Kim To: Date: Tue, 11 Jul 2017 16:16:04 +0100 Message-ID: <1499786165-9404-2-git-send-email-yongbok.kim@imgtec.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1499786165-9404-1-git-send-email-yongbok.kim@imgtec.com> References: <1499786165-9404-1-git-send-email-yongbok.kim@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.169.30] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.59.15.196 Subject: [Qemu-devel] [PULL 1/2] target/mips: fix msa copy_[s|u]_df rd = 0 corner case 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: Miodrag Dinic 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 Content-Type: text/plain; charset="utf-8" From: Miodrag Dinic This patch fixes the msa copy_[s|u]_df instruction emulation when the destination register rd is zero. Without this patch the zero register would get clobbered, which should never happen because it is supposed to be hardwired to 0. Fix this corner case by explicitly checking rd =3D 0 and effectively making these instructions emulation no-op in that case. Signed-off-by: Miodrag Dinic Reviewed-by: Aurelien Jarno Acked-by: Aurelien Jarno Signed-off-by: Yongbok Kim --- target/mips/translate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 559f8fe..befb87f 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -18712,10 +18712,14 @@ static void gen_msa_elm_df(CPUMIPSState *env, Dis= asContext *ctx, uint32_t df, #endif switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_COPY_S_df: - gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); + if (likely(wd !=3D 0)) { + gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); + } break; case OPC_COPY_U_df: - gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); + if (likely(wd !=3D 0)) { + gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); + } break; case OPC_INSERT_df: gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn); --=20 2.7.4 From nobody Tue May 7 12:15:15 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499786272044216.2050684828912; Tue, 11 Jul 2017 08:17:52 -0700 (PDT) Received: from localhost ([::1]:46959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwuz-0006Rb-MI for importer@patchew.org; Tue, 11 Jul 2017 11:17:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwtk-0005j2-2R for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUwtg-0005xo-VO for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:24 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:33714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwtg-0005xb-PH for qemu-devel@nongnu.org; Tue, 11 Jul 2017 11:16:20 -0400 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 317CB13C099D; Tue, 11 Jul 2017 16:16:16 +0100 (IST) Received: from localhost.localdomain (192.168.169.30) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 11 Jul 2017 16:16:19 +0100 From: Yongbok Kim To: Date: Tue, 11 Jul 2017 16:16:05 +0100 Message-ID: <1499786165-9404-3-git-send-email-yongbok.kim@imgtec.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1499786165-9404-1-git-send-email-yongbok.kim@imgtec.com> References: <1499786165-9404-1-git-send-email-yongbok.kim@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.169.30] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.59.15.196 Subject: [Qemu-devel] [PULL 2/2] mips/malta: load the initrd at the end of the low memory 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: Aurelien Jarno 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 Content-Type: text/plain; charset="utf-8" From: Aurelien Jarno Currently the malta board is loading the initrd just after the kernel. This doesn't work for kaslr enabled kernels, as the initrd ends-up being overwritten. Move the initrd at the end of the low memory, that should leave a sufficient gap for kaslr. Signed-off-by: Aurelien Jarno Tested-by: Yongbok Kim Signed-off-by: Yongbok Kim --- hw/mips/mips_malta.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 95cdabb..dad2f37 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -841,8 +841,9 @@ static int64_t load_kernel (void) if (loaderparams.initrd_filename) { initrd_size =3D get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { - initrd_offset =3D (kernel_high + ~INITRD_PAGE_MASK) & INITRD_P= AGE_MASK; - if (initrd_offset + initrd_size > ram_size) { + initrd_offset =3D (loaderparams.ram_low_size - initrd_size + - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; + if (kernel_high >=3D initrd_offset) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\= n", loaderparams.initrd_filename); --=20 2.7.4