From patchwork Fri Jan 13 15:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 642024 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp310230pvb; Fri, 13 Jan 2023 08:54:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXumDnBwE5m86FoGXO/BB9zwdlgRdZHZuUNQJnOK9y9LFdoFKJ9cudSXADInMdN4+0h+TBBD X-Received: by 2002:a05:622a:59cb:b0:3a8:299a:9843 with SMTP id gc11-20020a05622a59cb00b003a8299a9843mr118697907qtb.39.1673628851666; Fri, 13 Jan 2023 08:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673628851; cv=none; d=google.com; s=arc-20160816; b=Z63pVHDHnzWn1On7iw6vGC7yIgVE+YXnIF5X572ACx9JndYrkEMn7YnKdw7Cx2cqDK VUocvMkiUCr5O/O0NdmhVMcpWF05KC6GjC1/G8CRXRkAemThxUyqvetY9sLJJWsjzmXy nK7ETt44syEA8dcUvtTrlkdbZx8QXHR66FK5ip/xuKL+GfEhZk+9+IteFYKkwmQDkY3M LBzuX9n2XJr+KslvbIItMZMBmjm9owxk6fcsoRpnlHT6lW1nE35Duf8lNxR9fa9rN4rX 0R7mRUQ+VYd+Um/Hp2AK45Jdzwwq1ys+/xVv3QZeohKczS9Y+5feQJGMbgxCwrviWmGS 0HMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J0uzoxyewG1CZd1qWugKwgkYzf3Ypnm7BiOFvHDY2zE=; b=ESzNTa3mU8w9MBp7lPRdjKf5TjCgLmRpI7EFpR1Rx9KUG9RUL0UyKOdApu/fnknr1D EnjmGroLbMYQVK0D0NDpIjAw1b9FpO+opieATtiVTjgDOydv9r+erBizBuWNwhcFhnxG tbElY+YIkYwajziI4qJXx6NFepR9LHfVH4ql7995vOIRzQ4PkSE6HEp+zLYnTEJ9zIM7 /PN6vjkKM8aUBFbTF41dOjTlDglIKQ1V8XMWXZFHcRzxHod7lYewzOMgnW3f7QQzeBHb /gJgS5kBIfEKZH6m/rXUh8BOMkOiW4bFI4P0pQ/RFvVJWxt3gQFI9b79sequcrUZopD/ Xihg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LB6hXVzk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTP id t28-20020a05622a181c00b003ae7148c300si9407101qtc.701.2023.01.13.08.54.11 for ; Fri, 13 Jan 2023 08:54:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LB6hXVzk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMGW-0001pa-Ij; Fri, 13 Jan 2023 10:46:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMGT-0001np-9t for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:46 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGMGR-00066B-Oz for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:45 -0500 Received: by mail-wr1-x433.google.com with SMTP id bs20so21462698wrb.3 for ; Fri, 13 Jan 2023 07:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J0uzoxyewG1CZd1qWugKwgkYzf3Ypnm7BiOFvHDY2zE=; b=LB6hXVzkjzaI5ZlsZ7G/6yCU+EKu+Qp7QcCn9SYK/bJkaxz53Pdau4aPsentQWbTMD ao2tbCaLOzoLfwkUklS4Ie3VgXpDj1xE+YMe7DhoB4cXjl+XctTfENRPH3hykU43HBS1 Py0NYys2lYXLm/Jey6/cus/wNGFMBx1JcvJl4dY0d7QJW766ttYLTOBBNE9+2q652lOI NtRqNOUyoUp/XnPVuqolbBN0CKlVP445hJ44IGw4HEa9gc4bhOGsSZwbnoHVS8xv5ClM 4HVoVa/9G0fstVo0w/f1UFkq9q9rLFEKcgVu3Rnx1z+unKw+3G4phl5WeGccOT1CT5PX Ny2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J0uzoxyewG1CZd1qWugKwgkYzf3Ypnm7BiOFvHDY2zE=; b=Kq08dLI7xH0j3LxWIzaJo4K4SESvQyDUKSwuf8OcM9Zle9jpMyrZApb3z5yHmnpIwC p+qO3w5jPsiz2QbBE6MaAciJF3lwlo3ep1D48MP8cC/Ruf9w7C2PjAi8QmXloufN5yPO E+A6Wutfnh+5i2DJrVLW8AzvctBXWunsQh1lLcsS7ETb+WQI1Q6raJSmwMdV9ll9IG7l lCtnhkrq2FbfbIrMsn4mpj//3gUjrVEXnV8XoFtDIZIZ3HW17bCwKqFFwH3wz7HOI7XR FAX6LirjbR3NAsgWqkB5/vJWRx6g1uc9iUOfK141CT+Jh7Jf6grswbK78hqLijY8s4bG 5Frg== X-Gm-Message-State: AFqh2kpDt+7uZmqmVPLL4ka8fOXNG6xTcWVc2L6AB48vN+/uZrdMz1jf rBXW2OFe4VW2AlhElBUduio6GGwSTz5pfVt1 X-Received: by 2002:a05:6000:a19:b0:2bd:c477:8d6b with SMTP id co25-20020a0560000a1900b002bdc4778d6bmr8143745wrb.42.1673624801640; Fri, 13 Jan 2023 07:46:41 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id b2-20020a056000054200b0022584c82c80sm19288392wrf.19.2023.01.13.07.46.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 13 Jan 2023 07:46:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 14/46] hw/mips/bootloader: Implement nanoMIPS NOP opcode generator Date: Fri, 13 Jan 2023 16:45:00 +0100 Message-Id: <20230113154532.49979-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230113154532.49979-1-philmd@linaro.org> References: <20230113154532.49979-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20221211204533.85359-3-philmd@linaro.org> --- hw/mips/bootloader.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 21ffd4d772..0035f37335 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -54,14 +54,30 @@ static bool bootcpu_supports_isa(uint64_t isa_mask) return cpu_supports_isa(&MIPS_CPU(first_cpu)->env, isa_mask); } +static void st_nm32_p(void **ptr, uint32_t insn) +{ + uint16_t *p = *ptr; + + stw_p(p, insn >> 16); + p++; + stw_p(p, insn >> 0); + p++; + + *ptr = p; +} + /* Base types */ static void bl_gen_nop(void **ptr) { - uint32_t *p = *ptr; + if (bootcpu_supports_isa(ISA_NANOMIPS32)) { + st_nm32_p(ptr, 0x8000c000); + } else { + uint32_t *p = *ptr; - stl_p(p, 0); - p++; - *ptr = p; + stl_p(p, 0); + p++; + *ptr = p; + } } static void bl_gen_r_type(void **ptr, uint8_t opcode,