From patchwork Fri Jan 13 15:45:01 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: 641999 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp292351pvb; Fri, 13 Jan 2023 08:16:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXt16qmR8IktyKEYfzkOc9DJeMUW1k9daBsgWTOBAlGksUw1AlOQwgfl5czEvNZk7IaMdjJR X-Received: by 2002:ac8:5557:0:b0:3ab:5b6d:1add with SMTP id o23-20020ac85557000000b003ab5b6d1addmr119536014qtr.66.1673626581355; Fri, 13 Jan 2023 08:16:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673626581; cv=none; d=google.com; s=arc-20160816; b=dZRYpvdMYipGHA/xs8tFpKBQBmF7/yj3EXTDYDSl4A29p9QqQ6w9fjeB1FGplJBeQv gqma8oHib7nDxtHdACIySwupwx/6Njj+K8RxH9iqdk4xnLAIznQZUYjBts4QZpDydnXL mda0QndqZuopQbysxAczUCev+kmZjqhp0qMvpSFkXUse1UHa+1JArWewa6Drhe8Pgk5B khWa3Iq2m1etvMEufgUNXPIY8M9yE9QwSZNCYBJ5ebv9AwQVKPNkPcLv8+VdBTqIzAgy KUBQC3521F3mypQD9PF3CUYBti42gu122pfa1udWseOGpnSm1qHmaa1be0jxbfHdOcnk KNZQ== 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=UbzdZb+OzerP2cRuuXtHruzXTN86VcNwiX22MbAg0J0=; b=BjA5HGRh3vjJu29Ldy9NYLtbX0at+BoG3kg+XS9cPQjEKztmKJG9k+zXUQ+PGWDabA kgDPFpHawyjpXnxZhhJWT4OXXmkusGbGu2xu8Dgltd4dwzpK+r1dHNs7pVEzCZkX8b1q kUo/OKIwOtuIEpVNu+ALFLbfQ8LLFA9xdvEIK+u6da+vLAt6zhLUxRYvwj2HWIYDWs6n VhLWS/lwRhaNpM7Yt03+pcPlBhU89V0bPRxA+Tk2J4vyKRxEFGk/dc2deoO8iUqwfoIL aXfKwUjEzdiFZjx8I2htnH6WP+QcEbASKzN3/5XYzlEL2JXA60G5QvzwB0YiggXtWc9E LRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m8mUDO0Q; 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 e7-20020ac81307000000b003a981b24de3si11855222qtj.1.2023.01.13.08.16.21 for ; Fri, 13 Jan 2023 08:16:21 -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=m8mUDO0Q; 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 1pGMGZ-0001s0-AL; Fri, 13 Jan 2023 10:46:51 -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 1pGMGX-0001rF-QK for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:49 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGMGW-0006CN-0h for qemu-devel@nongnu.org; Fri, 13 Jan 2023 10:46:49 -0500 Received: by mail-wr1-x42f.google.com with SMTP id bk16so21432317wrb.11 for ; Fri, 13 Jan 2023 07:46:47 -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=UbzdZb+OzerP2cRuuXtHruzXTN86VcNwiX22MbAg0J0=; b=m8mUDO0QIXanTl48+f6oFRQmAl2odzqX4xd7eCWIcFOmK3KnAsvBq4vX9ve4pcAss+ YyciNvvnN54s0kHCt7gllC1niX0dODanS2Gk9FrfnM8E7spq1F0HSyhkCb1ZgJj00u/Q fEi4vUORMGT73Rc3Jw3JT04R0TKrhAwxUtlbb8UkP6Ec2tQ8loQ0QH+Bbxr+KZ5rG9WT hu8bAQzATl91kpAiZQTBlq6eGZrjq+q+Bw5miqoXejNZFaxhCPDHgupEBNmeQ2tfPmil 2fpgCFFY0uLGF3enfWsFfHtPhj4yk0WbwvqCYWsKx4qFo6IuOLYyDi5DilChyFgH8/gy hbzQ== 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=UbzdZb+OzerP2cRuuXtHruzXTN86VcNwiX22MbAg0J0=; b=DXKboUxR2UeI1yd0vO+vaY3OV9u3jV7GKzc4dAZ9ZwDlEdQ0RETKNJyVBkQXGyspxs MBt4N1SGhbusMieUz4lB6v8nDxSGrzflvGWg8PyD5FIymHE+oPBBa3k9GtFmZmUzBGBi sgKpJOPhQCv5IkzI2KHnnWGnl2x3r96rblYcbSINbANraWT/xF5HJ4K0AG73o2MGkLX0 bwQftK+tOv01wmtoUkb1bPJZZri+zp9Xul7oa3zhkZr6gVObOizEQ7T8jCf36iJSHvEF 4yVoC0TcB8yJ274gXAU0WSRXp3v3518KXwZHHWvloGJOiEZaBSGaOys70i7Id8lTRicD IPxQ== X-Gm-Message-State: AFqh2krDRfLFByTcb6z9L3fkzzBXbbXGIDg57MqZWh1F1asO5Cxnzjpj pUvNUerO7EEn2WSC+xQF4E5UE401WyYDlsWB X-Received: by 2002:a5d:640c:0:b0:29f:7c0c:5a46 with SMTP id z12-20020a5d640c000000b0029f7c0c5a46mr26091107wru.68.1673624806296; Fri, 13 Jan 2023 07:46:46 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id n6-20020adfe786000000b002bdbde1d3absm9021406wrm.78.2023.01.13.07.46.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 13 Jan 2023 07:46:46 -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 15/46] hw/mips/bootloader: Implement nanoMIPS SW opcode generator Date: Fri, 13 Jan 2023 16:45:01 +0100 Message-Id: <20230113154532.49979-16-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::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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-4-philmd@linaro.org> --- 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)