qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-for-8.0 4/7] hw/mips/bootloader: Implement nanoMIPS LUI opcod


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH-for-8.0 4/7] hw/mips/bootloader: Implement nanoMIPS LUI opcode
Date: Sat, 10 Dec 2022 17:01:39 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 10/12/22 16:54, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/mips/bootloader.c | 29 ++++++++++++++++++++++++++---
  1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
index 7f7d938f2e..997e74ee52 100644
--- a/hw/mips/bootloader.c
+++ b/hw/mips/bootloader.c
@@ -120,11 +120,34 @@ static void bl_gen_jalr(void **p, bl_reg rs)
      bl_gen_r_type(p, 0, rs, 0, BL_REG_RA, 0, 0x09);
  }
+static void bl_gen_lui_nm(void **ptr, bl_reg rt, uint32_t imm20)
+{
+    uint16_t *p = (uint16_t *)*ptr;
+    uint32_t insn = 0;

Hmm we should check if imm20 fits in 20-bit.

+    insn = deposit32(insn, 26, 6, 0b111000);
+    insn = deposit32(insn, 21, 5, rt);
+    insn = deposit32(insn, 12, 9, extract32(imm20, 12, 9));
+    insn = deposit32(insn, 2, 10, extract32(imm20, 21, 10));
+    insn = deposit32(insn, 0, 1, sextract32(imm20, 31, 1));
+
+    stw_p(p, insn >> 16);
+    p++;
+    stw_p(p, insn >> 0);
+    p++;
+
+    *ptr = p;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]