From patchwork Fri Jan 13 15:45:03 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: 642001 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp295280pvb; Fri, 13 Jan 2023 08:21:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXvi9qDDHxLOivO8vNesjiSWaHREsGfHTk6oJP79kr6YWw1CHUeR7fIVbkHTtkWWk5RiQEL7 X-Received: by 2002:a25:d95:0:b0:7ca:a827:7a99 with SMTP id 143-20020a250d95000000b007caa8277a99mr4022877ybn.56.1673626917271; Fri, 13 Jan 2023 08:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673626917; cv=none; d=google.com; s=arc-20160816; b=k0QhOgpmf2GUM4vA+ZjqZqiSivreGh97slhAcm0y9Q9pIZ9D3IYw69QO4ez+8XkB5G gU8ah/FWG5nxFQ+e8fONCAhp6NutT9CA1D23cDdr9Yc2TqGnED4wK8nPUZKAxRpXNNfM wyrnsuGqQIyWcCGRTmLrUqdUxEvAhI5sN58Folys4OBHNE1qUgO+8hcE2oUTB5Se8TtI YgvnZMm3/FbW/ABTfsdxGeJ8+wYjJRPg4xMVfps7X2MSSyp11tw3fWFVy7eqNr6FQj2B h+AUdr/0Ws3Ke2lFZP2rQZnlNc0cqnhHqaqzVNVbicTa37cSGRc/LZWepubLUZGfiFwt 6FFw== 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=1qPfxBX17QwjQQWrVKyI6Qs1xSLlsiE1fYEVpC7zrok=; b=jlWXbkzrt+dVG/NXqAxeO7sgcvmNE+JDm87w3VY4n+YqBb9UM/CDe1HbsL/9lKAc7t F2b2oSxSCZ2TMnMBHhWYcYsVz7Kl9aFrX7XKdEj6u1Vb3zZWkqFh4lvxOAp1bbPFeYKE /SsA2vT4TKlAIEgzcKFB+MQfcRHZz61jzWUl+eNjkGn5N5NAfRKLJ/OTFZryV+UhDzLy ksHmXmxV3FsNVoevr1ZJxb7RNO1hjfWSGCz731q5hwW/c4en6M728y5YYYGRPed2tHL2 vas6Tzhwqo8qegZpXXg8zhevgYvf0SyJ+X0KdYL54uzmMdP6wlCvmzVQvW0COuYH7/yM Xh9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rnCr6ONs; 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 ESMTPS id p2-20020a05620a132200b006fa958d0898si11268730qkj.695.2023.01.13.08.21.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jan 2023 08:21:57 -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=rnCr6ONs; 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 1pGMGi-0001xl-3t; Fri, 13 Jan 2023 10:47:00 -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 1pGMGg-0001xP-PX for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:58 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGMGf-0006GR-9K for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:58 -0500 Received: by mail-wm1-x32e.google.com with SMTP id g10so15553548wmo.1 for ; Fri, 13 Jan 2023 07:46:56 -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=1qPfxBX17QwjQQWrVKyI6Qs1xSLlsiE1fYEVpC7zrok=; b=rnCr6ONs9ou+aMrbfAhsXS4kWDbDTLdT95lSvvnmUJMh85rqoeA2Pph8koWdLS5bJU ZoQ2cjZH54VioNeAZU9UGdafSjiPLxe/m5p6nPzzLhat+rIvLFpw/ay+IrnenPBZOO23 chFw0s9rNA32qvKc1+pakQJqFG7A+zzsBG5IZ3QBNjIaYdSiV1YPx9+y/hbFLV9iILUR Qrf0iI2IA/v2bCOVSZIJOnHQ+FUrsV0zr9RaGIY+TI/UvZ2zSSb4baqkoBMQgcY/SMJS 2u58ddzZujAZ2io52H1S//R176Rj5bpsGgs53s9AdAbYH8HjxQJanqEvg0MD5FoJ7d9o /liQ== 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=1qPfxBX17QwjQQWrVKyI6Qs1xSLlsiE1fYEVpC7zrok=; b=Bui3nIixX9E6snzy2Z0G3qsxcO1tmjtUGPUkXeoQ9P70sD/VI6hP/NykoNH2Z//bGx vNDfk9TsU/6uu5c70wXifgb0TsOde8W98tekg1dIrlyAzlRc66xVsVjnMKwwRlqIch15 fXYpNzQ4dOdbMcYsigcIE9EsnMRB4AgucdTkpnV+YIxegWLjLM9Zde7tglECzi24Zl82 YHZsvB0X9YIeFD0nuMuLMeA8RPtDUh22CZaxF2ob+q9a58IT5mQxEJDo/GRv6fC1JyFN LjedDsEMq6oCyhmni5B+6AyK284RdxPch1ZjnunbMKIVRP19RGSv8U7y1j1NLAcu5CUB Un6Q== X-Gm-Message-State: AFqh2kpsHJJ77HSqO6AlPMNkBuQCG4CC4H2X2j7qpKvWB+lvPIgNa9q7 al+VU1RIFVU0V7KSSBLVvLZavKJKpfJ0l+BB X-Received: by 2002:a05:600c:4f88:b0:3da:e4d:e6ba with SMTP id n8-20020a05600c4f8800b003da0e4de6bamr7855745wmq.14.1673624815820; Fri, 13 Jan 2023 07:46:55 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h19-20020a05600c351300b003d9a86a13bfsm27617575wmq.28.2023.01.13.07.46.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 13 Jan 2023 07:46:55 -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 17/46] hw/mips/bootloader: Implement nanoMIPS JALRc opcode generator Date: Fri, 13 Jan 2023 16:45:03 +0100 Message-Id: <20230113154532.49979-18-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20221211204533.85359-6-philmd@linaro.org> --- hw/mips/bootloader.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 9fc926d83f..1dd6ef2096 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -129,7 +129,17 @@ static void bl_gen_dsll(void **p, bl_reg rd, bl_reg rt, uint8_t sa) static void bl_gen_jalr(void **p, bl_reg rs) { - bl_gen_r_type(p, 0, rs, 0, BL_REG_RA, 0, 0x09); + if (bootcpu_supports_isa(ISA_NANOMIPS32)) { + uint32_t insn = 0; + + insn = deposit32(insn, 26, 6, 0b010010); /* JALRC */ + insn = deposit32(insn, 21, 5, BL_REG_RA); + insn = deposit32(insn, 16, 5, rs); + + st_nm32_p(p, insn); + } else { + bl_gen_r_type(p, 0, rs, 0, BL_REG_RA, 0, 0x09); + } } static void bl_gen_lui_nm(void **ptr, bl_reg rt, uint32_t imm20)