qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Milica Lazarevic" <milica.lazarevic@syrmia.com>,
	"Dragan Mladjenovic" <Dragan.Mladjenovic@syrmia.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Djordje Todorovic" <djordje.todorovic@syrmia.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Bernhard Beschow" <shentey@gmail.com>
Subject: [PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode
Date: Sat, 10 Dec 2022 16:55:00 +0100	[thread overview]
Message-ID: <20221210155502.74609-6-philmd@linaro.org> (raw)
In-Reply-To: <20221210155502.74609-1-philmd@linaro.org>

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 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)
-- 
2.38.1



  parent reply	other threads:[~2022-12-10 15:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 15:54 [PATCH-for-8.0 0/7] hw/mips/malta: Generate nanoMIPS bootloader with bootloader generator API Philippe Mathieu-Daudé
2022-12-10 15:54 ` [PATCH-for-8.0 1/7] hw/mips/bootloader: Handle buffers as opaque arrays Philippe Mathieu-Daudé
2022-12-11  0:16   ` BALATON Zoltan
2022-12-11 20:29     ` Philippe Mathieu-Daudé
2022-12-10 15:54 ` [PATCH-for-8.0 2/7] hw/mips/bootloader: Pass 32-bit immediate value to LUI opcode generator Philippe Mathieu-Daudé
2022-12-11 15:57   ` Richard Henderson
2022-12-10 15:54 ` [PATCH-for-8.0 3/7] hw/mips/bootloader: Implement nanoMIPS NOP opcode Philippe Mathieu-Daudé
2022-12-11 16:19   ` Richard Henderson
2022-12-10 15:54 ` [PATCH-for-8.0 4/7] hw/mips/bootloader: Implement nanoMIPS LUI opcode Philippe Mathieu-Daudé
2022-12-10 16:01   ` Philippe Mathieu-Daudé
2022-12-11 10:33     ` Jiaxun Yang
2022-12-10 15:55 ` Philippe Mathieu-Daudé [this message]
2022-12-10 16:02   ` [PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode Philippe Mathieu-Daudé
2022-12-11 16:24     ` Richard Henderson
2022-12-11 20:30       ` Philippe Mathieu-Daudé
2022-12-11  9:44   ` Bernhard Beschow
2022-12-10 15:55 ` [PATCH-for-8.0 6/7] " Philippe Mathieu-Daudé
2022-12-11 10:40   ` Jiaxun Yang
2022-12-11 20:30     ` Philippe Mathieu-Daudé
2022-12-10 15:55 ` [PATCH-for-8.0 7/7] hw/mips/malta: Use bootloader generator API for nanoMIPS CPUs Philippe Mathieu-Daudé
2022-12-11  9:53   ` Bernhard Beschow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221210155502.74609-6-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=Dragan.Mladjenovic@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=djordje.todorovic@syrmia.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=milica.lazarevic@syrmia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shentey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).