[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode |
Date: |
Sat, 10 Dec 2022 16:55:00 +0100 |
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
- [PATCH-for-8.0 3/7] hw/mips/bootloader: Implement nanoMIPS NOP opcode, (continued)
- [PATCH-for-8.0 3/7] hw/mips/bootloader: Implement nanoMIPS NOP opcode, Philippe Mathieu-Daudé, 2022/12/10
- [PATCH-for-8.0 1/7] hw/mips/bootloader: Handle buffers as opaque arrays, Philippe Mathieu-Daudé, 2022/12/10
- [PATCH-for-8.0 2/7] hw/mips/bootloader: Pass 32-bit immediate value to LUI opcode generator, Philippe Mathieu-Daudé, 2022/12/10
- [PATCH-for-8.0 4/7] hw/mips/bootloader: Implement nanoMIPS LUI opcode, Philippe Mathieu-Daudé, 2022/12/10
- [PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode,
Philippe Mathieu-Daudé <=
- Re: [PATCH-for-8.0 5/7] hw/mips/bootloader: Implement nanoMIPS SW opcode, Bernhard Beschow, 2022/12/11
- [PATCH-for-8.0 6/7] hw/mips/bootloader: Implement nanoMIPS SW opcode, Philippe Mathieu-Daudé, 2022/12/10
- [PATCH-for-8.0 7/7] hw/mips/malta: Use bootloader generator API for nanoMIPS CPUs, Philippe Mathieu-Daudé, 2022/12/10