From patchwork Sat Dec 10 15:55:00 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: 632900 Delivered-To: patch@linaro.org Received: by 2002:a17:906:82c7:b0:7c1:1f1c:138d with SMTP id a7csp1886052ejy; Sat, 10 Dec 2022 07:56:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4q7J/vW1FrbUhBQw+ecsWUEn/+e8Gqa7EltKfsxyIPJyxjZ5YX77j4tXLcXjs6/C3cFGb6 X-Received: by 2002:a0c:dd01:0:b0:4c6:fb9f:a327 with SMTP id u1-20020a0cdd01000000b004c6fb9fa327mr13049481qvk.29.1670687763698; Sat, 10 Dec 2022 07:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670687763; cv=none; d=google.com; s=arc-20160816; b=qjaekRJiWKZ9W41LUWarYdZ76nHqFBGtKyLYqnS5z+b12IRlXcLxSn2QJzuKi9whSZ qrWL18SycCWzE9tWt8igKSdjnVX+w4PIG0pwUUSUW7k/gHi8jzJkHiQUZ1jgQgK+Mx9V CSbjuTfnyqYJQN9UL/xFexdiIQeNndYV9EmWow8q6RV1Ti0/ehJrVkBTBRyZnTYCYhCo 3K3MugqvrgeNSEdibXrn27dB6oopNkG4QKmahNuIoKqYcxkqZhlWHV6FhX7bJQZNRFPs hHDbFNm8Q5d8+8zJMdO7PFz+/Wqv3ZtbzOBykfgBPn091ZdafFpiXEoE2tZmhGrP1YbN bhVA== 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=mSN/vxmvjzjZWG1Yzr7yo5qjrH7L/P4OnxN/YhyWvKE=; b=SfMAO+cc96H7C7rT9wo++0Nl49laMvz1WXcLMAI3hJ1dKYjCXl7+yIRCkSZX5RJkAH Q2vDcDHX8YHtVRyd7CeODG7RZR9mc7ZhrIyYPKIZm5Z4bL6QQ2E3vu8PQppKntqN5qIx WIjqqaqXxFnUxd7NfPALBP3Ty8/gAndzQQDo6fdMG+5aSP+tO/AYpe7HsWKieKUwIbN9 xkJjZzjniTZvyiW3qLoslSoD7uPvL3oGCwtbt+dyraFEt8s0qpnqx+sXOFLyFGfpz3eG 3gcKHetPESTn6KO8OX1rU7vDWsocrLsqeHRiBkjA6hv+Zw+I2EX+na+Ceit7uM2ACokU pTVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hL7pbh/w"; 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 t14-20020a0562140c6e00b004c79a3d16f3si2446059qvj.261.2022.12.10.07.56.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Dec 2022 07:56:03 -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="hL7pbh/w"; 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 1p42CQ-0003YK-Mg; Sat, 10 Dec 2022 10:55:38 -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 1p42CO-0003Vk-OW for qemu-devel@nongnu.org; Sat, 10 Dec 2022 10:55:36 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p42CN-0004S5-76 for qemu-devel@nongnu.org; Sat, 10 Dec 2022 10:55:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id n7so1943238wms.3 for ; Sat, 10 Dec 2022 07:55:34 -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=mSN/vxmvjzjZWG1Yzr7yo5qjrH7L/P4OnxN/YhyWvKE=; b=hL7pbh/woT31F3BVD6BSyogDelr+oUTeVcoPMl96aqzIWzxQ//hX6sjRAZMr188Uhx oPBjqz7zgFcXzm2x5Yndg2uxG4OPOxF6xwR8QpF5yLipE/1jG4EIw4w+frWV34u7orGq QgJMmTSaEogP1N8621KnpPi4mskq4wlEkEkQWH1C3ua6SVOcaKc3IoDnkf7ptqAjUj4r SaRiVrOuAZUYtnB8+HC2bEZh0HUbdcOyX0ZTVJjY+KTi2DNfSjiSxnzRqVurD9YUf8e4 dttbSCLciBB+k0h3aosAdRG/sSa8qKC/tcQU7axH0WIPWaxsHSFqHPmGx2TWYn/eemKI MNhA== 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=mSN/vxmvjzjZWG1Yzr7yo5qjrH7L/P4OnxN/YhyWvKE=; b=g4Nep87g5d79AUp2FHTiJcaaISXablCQ4adJrNQRVuQbOWOcunua272jvHH28rISL/ dFTHG2ZfzbCVFwUbxFKcNAwVe55BkDY9K4QnG+mPQ/vj5pR8evkySe7VKAkFNtyLEmlG EOtwYmQOIpe8mEZI+FiPa0z8WYOyMgnlJGK+bhvPRAu3LYRkhuz+yVkoHVIlPdbiE8a2 DQ0QQlWRMmrDVYWufKY/z30r8bvJCIB97Sa7v9iYb6AoahG2OglDpo9CNNSFeUPjow1T 2hwZETlXVpmmpkSFPO/UJSjWe41zFJKskkuhfON9DjO/Zw5nxkAkryH0mFvlA8Pi9otC G0yw== X-Gm-Message-State: ANoB5pmRSI0gBhOucunHpMZBTp3BbPskHl1iOjCWZ2oyX3SZ3O71gdA2 J0SA4IiWDvA2qgRa9IiTc3nxFyu0lJPdusQBnTM= X-Received: by 2002:a05:600c:4fd0:b0:3d1:c0a1:4804 with SMTP id o16-20020a05600c4fd000b003d1c0a14804mr7958693wmq.17.1670687733567; Sat, 10 Dec 2022 07:55:33 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id d15-20020a5d538f000000b00242442c8ebdsm4137165wrv.111.2022.12.10.07.55.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 10 Dec 2022 07:55:33 -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 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode Date: Sat, 10 Dec 2022 16:55:00 +0100 Message-Id: <20221210155502.74609-6-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 997e74ee52..cc3df385df 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -150,9 +150,31 @@ static void bl_gen_lui(void **p, bl_reg rt, uint32_t imm32) } } +static void bl_gen_ori_nm(void **ptr, bl_reg rt, bl_reg rs, uint16_t imm) +{ + uint16_t *p = (uint16_t *)*ptr; + uint32_t insn = 0; + + insn = deposit32(insn, 26, 6, 0b100000); + insn = deposit32(insn, 21, 5, rt); + insn = deposit32(insn, 16, 5, rs); + insn = deposit32(insn, 0, 12, imm); + + stw_p(p, insn >> 16); + p++; + stw_p(p, insn >> 0); + p++; + + *ptr = p; +} + static void bl_gen_ori(void **p, bl_reg rt, bl_reg rs, uint16_t imm) { - bl_gen_i_type(p, 0x0d, rs, rt, imm); + if (bootcpu_supports_isa(ISA_NANOMIPS32)) { + bl_gen_ori_nm(p, rt, rs, imm); + } else { + bl_gen_i_type(p, 0x0d, rs, rt, imm); + } } static void bl_gen_sw(void **p, bl_reg rt, uint8_t base, uint16_t offset)