From patchwork Sun Dec 11 20:45:25 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: 633103 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2105674pvb; Sun, 11 Dec 2022 12:48:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+MS83wtnMsvWzK55NPRIYGwK18Ua9L/Ed5lClxe1F8K5tGc6PA8xgzxx7Q1gb5+4U14VB X-Received: by 2002:ac8:4e18:0:b0:3a5:3009:f844 with SMTP id c24-20020ac84e18000000b003a53009f844mr18643283qtw.24.1670791706548; Sun, 11 Dec 2022 12:48:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670791706; cv=none; d=google.com; s=arc-20160816; b=LuyZ6a8Jj792E4n8PVUQeL8MRtTo6sV+Z5f6QCQHflKthra1ScT4UuRM0dBt5XHkRL UOvXK0t7XsMgN6Wxx1s5sSWdm1KitejYuIpVkKovSQtvQ2iHcMgvKYm7aiT8gcP22iYu skX57QlpbBuztlWmgK0R7XK0DCk2XxP2rBp8jd3/i/ZRc5qVDUEUsV/wjWqhqhlbfMTH 3+RVgN78jnKW4BjtmsYU+FMqivvaE/UNC9jkoQt89hkeJxcdsLKV7IGslugUxLoPwiH9 WS6yYuntHK0wLUYDZgAwMYsW5Gsc/Hx3pJfqg6WfdiUo8R0vrE4eOhjDDZDAJKg4eLbW KMzg== 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=U4rIDZ7SV5XNk1rUwM4p0SKpFhukmmdzChpWUah/f+E=; b=h525tibAX9RVoCr6GsAecGGETCst8IVUyJvC0A9+Y3YZIiqcQBEx2Q1eFqDp1M8rt1 9oNWCKCobMmudo8QCLmxJWmqPnhEofePtNtCFw0+g1vI8RfHH8kyKeZt47no/jAfEuCC 73pUH3dPPOXIiaMBfAfajqQ7GlYL2pwuz6Z4I5jv0KXJnPyt9iloIFNR7OllCeeK8DBQ FhBKkpVnYku2zGtMqsYBjXhM9ccllbQJ74tgC957pwpOYvml0vkuyHJakJJBdJvqmdPo vXXX5mkUC2FngSUcQpVra0SQVippZZP/qJ5FuhgD7l2ZPKrnX9h/Dzbfybev3hA9sILX Mdvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y51PhjNT; 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 f26-20020ac8471a000000b003a4f22dc695si3904191qtp.694.2022.12.11.12.48.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Dec 2022 12:48:26 -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=y51PhjNT; 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 1p4TCy-0005Cx-BW; Sun, 11 Dec 2022 15:46: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 1p4TCv-0005CS-Ly for qemu-devel@nongnu.org; Sun, 11 Dec 2022 15:45:57 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4TCt-0003RN-Mk for qemu-devel@nongnu.org; Sun, 11 Dec 2022 15:45:57 -0500 Received: by mail-ej1-x62b.google.com with SMTP id kw15so23287141ejc.10 for ; Sun, 11 Dec 2022 12:45:55 -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=U4rIDZ7SV5XNk1rUwM4p0SKpFhukmmdzChpWUah/f+E=; b=y51PhjNTCSJNQuD5BfHr+WXnBI4LoofxnE0OnWzz5DEcHjjgwqza0BoDZsgZZp+TLA H8NaW76qEDTu/6XgBj6zHHuU5ny0I+BUwwHDUF/0hEEmUK9iQN/WGDZLtqNt0ztHLwtX yp72nXcyp4RB/9YDGQ4WE5uz4OihCMWiBWwHMZoYey+qpJbpnLuUG0fSYjFQM5s0FP+I X1os4H5u811fOtA50dDKYJFrxkyO8YKRnhgdUr9xblFyUTu4cD4tSV+sb9ZfqfMwQ5Y6 g590plxOdFEZi3x/mds8VTVdmfxFrP5unEvat9LQZO7F4R4XL6t4VQoa2zSjOJlwcLWo OIhA== 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=U4rIDZ7SV5XNk1rUwM4p0SKpFhukmmdzChpWUah/f+E=; b=0coIdCBli7RskV2I6gGz0DH1WxW35P5zIybU73GkkRwmc1TZ2iCtzrdJ6VIFGVdReT JzVAAJ55nQ0AIwq1knFjLvcj46NkZ+XpOGodsN+hlN2rmIBgt8Yi0IkQQ3p88vG+5Uqu DasmvZz18Jo5b1MEcO89W3ySXX80PVRj7WfdjJzgst7dhGEH4NOP9iAl/CMia5WJXKCl ogaDUYkzyOCZu9CnqbjYyH4t7a21EnLAvaLPwNF5EUvz1v+S07hW9yvzgb4RPybCGO8E ZwbB1hQEveP3NOdRott4STVS55AcdY0dJIb5mejPua42JTxtYaMz7l8/xiSXHQ8/15cd dGwQ== X-Gm-Message-State: ANoB5pnOX4pJTg6d8CxJ6NzjjJ4MI8qYHTWIemXHFe57nUuGiXjbMDAJ uu/bgpi48twsnqrXF+z6QhiCD3KV3qniRAc5yKc= X-Received: by 2002:a17:906:411b:b0:7c0:a48b:2dff with SMTP id j27-20020a170906411b00b007c0a48b2dffmr11414670ejk.43.1670791554076; Sun, 11 Dec 2022 12:45:54 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id lb22-20020a170907785600b00780982d77d1sm2409021ejc.154.2022.12.11.12.45.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 11 Dec 2022 12:45:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Dragan Mladjenovic , Milica Lazarevic , Jiaxun Yang , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Djordje Todorovic , Aurelien Jarno , Bernhard Beschow Subject: [PATCH-for-8.0 v2 03/11] hw/mips/bootloader: Implement nanoMIPS SW opcode generator Date: Sun, 11 Dec 2022 21:45:25 +0100 Message-Id: <20221211204533.85359-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221211204533.85359-1-philmd@linaro.org> References: <20221211204533.85359-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.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 --- hw/mips/bootloader.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c index 0035f37335..3e1e73360f 100644 --- a/hw/mips/bootloader.c +++ b/hw/mips/bootloader.c @@ -143,9 +143,27 @@ 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); } +static void bl_gen_sw_nm(void **ptr, bl_reg rt, uint8_t rs, uint16_t ofs12) +{ + uint32_t insn = 0; + + assert(extract32(ofs12, 0, 12) == ofs12); + 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, ofs12); + + st_nm32_p(ptr, insn); +} + 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)