From patchwork Sat Dec 10 15:55:01 2022 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: 632906 Delivered-To: patch@linaro.org Received: by 2002:a17:906:82c7:b0:7c1:1f1c:138d with SMTP id a7csp1887131ejy; Sat, 10 Dec 2022 07:57:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aiK0CjyVUyhxBn0X0TkGETN4BD6ROIAR1y2Qg5aI+pNb3hjbJ9c8k+ypNZ990buj/1L5n X-Received: by 2002:ac8:4414:0:b0:3a5:5a69:d5ef with SMTP id j20-20020ac84414000000b003a55a69d5efmr13520410qtn.39.1670687843309; Sat, 10 Dec 2022 07:57:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670687843; cv=none; d=google.com; s=arc-20160816; b=yTYWS4Xz8wLsSK6/LlkBNn55flk71j8s5I+ltb51m2gAOb9I7aWhCz7BclgCxlJZQ7 knraQs+M+fTLTfCE1L0kLsWDmzAV1+Z7Ujqr+4wVVtMKTLBljC2Z0qONDMEN/dE3hod4 ePkDI6Pqh7cHpLhjvVc9ttIwkwC++vkJEzXcJp/kYyF20vAt/aerOBLqtLtEdG2HDzO5 Y5abX+lZFGrV8Jw8tJ+nC2wHb9jS4KdCLTwAJSddsAvpvlhrkNRQiXrF9YrpQ9vdzA5e kgxIfTNLRNS0pcpLDdeHMBenLAuI3dnKiUi3lnpNHj1bJwxlN2G8PfA7VYR1oV5sCBc4 s0rQ== 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=4QRrKPOgHC81ExTYEFHUZ5O6izEXVdgJCHiyrcpa6dc=; b=sqha4zOeAE8ehTSYjAX2ZCj1uMggHwtT2Pm+e9mdiKN60liZhtI3WzDBll8cUWdJI/ yTH9jaoobbypSOAuhPo+Crk5MbbC0I5xHmpSaPeO77iQprklt9OqYxGPkoyWYMflfvOq 1/DReGRdBFOUfQO0iP7dSU4fSSVzbZCK0nLBjz6Z4ZaduYPHaZZHv95F9hB76H3rrEkt wMLfPK+rb3zaFNzuZrlNpwmlegCyPb0N+8VvVBbKvM6K7POQ8ksgzTX7/PU2S4bLH5Pv ac1iVBYX3dul1XyEZA9iXmfsMEJeTE0/+TwcczIWw9z9QUXAKkjZQEgMI26AX031bdLV 0K2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wj4SZKrF; 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 w22-20020ac87196000000b003a6a81bc96esi2509965qto.152.2022.12.10.07.57.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Dec 2022 07:57:23 -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=Wj4SZKrF; 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 1p42CW-0003hh-5h; Sat, 10 Dec 2022 10:55:44 -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 1p42CU-0003ev-Ak for qemu-devel@nongnu.org; Sat, 10 Dec 2022 10:55:42 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p42CS-0004Tb-QJ for qemu-devel@nongnu.org; Sat, 10 Dec 2022 10:55:42 -0500 Received: by mail-wr1-x42c.google.com with SMTP id f18so8002767wrj.5 for ; Sat, 10 Dec 2022 07:55:40 -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=4QRrKPOgHC81ExTYEFHUZ5O6izEXVdgJCHiyrcpa6dc=; b=Wj4SZKrF4KwF28d17HNYAxQgnwyV3gcvJNe/Xzn8OlDN70bgx47YyfAhGOum4IlIVH LoG/ngrLblmgdMcetVhO9B8kptJumRToOTF2XxKV+K9NGpdzaN+iqHFx8b1qH5tvblQh u+eGpn1cHANIxdaZbjzeJop2ekX0+mJ/6bfOUQrvthPArGR0xOAhT1WiDOwEdERwbcYy XRnOvaThEl2em6Ai99/2Heh1xQCNiLI6ijuA9Mx8LFYJ/U/vaKH/CP2C8VgiOjgACa4Y QId0C6kQ3HNkeFBLRFuBAeH7wvje8ErAryMJiTgHr0UVNd+bVKeXEpo0an6A3UzkFE+g bTpA== 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=4QRrKPOgHC81ExTYEFHUZ5O6izEXVdgJCHiyrcpa6dc=; b=bTyEe2R138wJ6GIxVLVnLt234mVCn9g63yaQr3OWI/hyNFjAFwIjOHr3ZixLaDzZ+x tB32nGGep7v6hsFHM3xEDYhq2VpVn/fzy96sM9BsEPokQDqJDKQQ4aMhBREaHLUGbjHB PzAE+wDDBcklzXgK8AXMn/xSR1M9OktdujLmzMpnWIoylxZR1m4X8FjA+9RHuzXzfeys SnwXO1PJjuCXJfieietyitGrjRHoGSS/ElPeusLwM5lh67SFDk+YQboONLvS5vP7sPQy bZNHNnwsfUGajv3KwtObIpZ21FGaFOUxlcBnWNIfuWpEMlDbt8nUreLG3QhmMcjifnYc +yaA== X-Gm-Message-State: ANoB5plpAIuq0kly6Nt+Nt2rmAVJTc+iCqKejrDgw5ASGC6OYhX+PRrp dLGHKW1ZZJsLi2SqSddwOs2XslyXnj0n7CSeRuY= X-Received: by 2002:adf:e7c3:0:b0:242:eb5:254f with SMTP id e3-20020adfe7c3000000b002420eb5254fmr6967088wrn.48.1670687739261; Sat, 10 Dec 2022 07:55:39 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id o5-20020a5d58c5000000b00241da0e018dsm4111229wrf.29.2022.12.10.07.55.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 10 Dec 2022 07:55:38 -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?= , Milica Lazarevic , Dragan Mladjenovic , Aurelien Jarno , Djordje Todorovic , Jiaxun Yang , Bernhard Beschow Subject: [PATCH-for-8.0 6/7] hw/mips/bootloader: Implement nanoMIPS SW opcode Date: Sat, 10 Dec 2022 16:55:01 +0100 Message-Id: <20221210155502.74609-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221210155502.74609-1-philmd@linaro.org> References: <20221210155502.74609-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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é --- hw/mips/bootloader.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index cc3df385df..541b59bf84 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -177,9 +177,32 @@ static void bl_gen_ori(void **p, bl_reg rt, bl_reg rs, uint16_t imm) } } +static void bl_gen_sw_nm(void **ptr, bl_reg rt, uint8_t rs, uint16_t offset) +{ + uint16_t *p = (uint16_t *)*ptr; + uint32_t insn = 0; + + insn = deposit32(insn, 26, 6, 0b100001); + insn = deposit32(insn, 21, 5, rt); + insn = deposit32(insn, 16, 5, rs); + insn = deposit32(insn, 12, 4, 0b1001); + insn = deposit32(insn, 0, 12, offset); + + stw_p(p, insn >> 16); + p++; + stw_p(p, insn >> 0); + p++; + + *ptr = p; +} + static void bl_gen_sw(void **p, bl_reg rt, uint8_t base, uint16_t offset) { - bl_gen_i_type(p, 0x2b, base, rt, offset); + if (bootcpu_supports_isa(ISA_NANOMIPS32)) { + bl_gen_sw_nm(p, rt, base, offset); + } else { + bl_gen_i_type(p, 0x2b, base, rt, offset); + } } static void bl_gen_sd(void **p, bl_reg rt, uint8_t base, uint16_t offset)