[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions |
Date: |
Thu, 19 Jul 2018 11:28:10 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 07/19/2018 05:54 AM, Stefan Markovic wrote:
> +/* Used for 16-bit store instructions. */
> +static int decode_gpr_gpr3_src_store(int r)
> +{
> + static const int map[] = { 0, 17, 18, 19, 4, 5, 6, 7 };
> +
> + return map[r & 0x7];
> +}
Same comment re comment as before.
> case NM_P16_LB:
> + {
> + uint32_t u = extract32(ctx->opcode, 0, 2);
> + switch (((ctx->opcode) >> 2) & 0x03) {
> + case NM_LB16:
> + gen_ld(ctx, OPC_LB, rt, rs, u);
> + break;
> + case NM_SB16:
> + {
> + int rt = decode_gpr_gpr3_src_store(
> + NANOMIPS_EXTRACT_RD(ctx->opcode));
Shadowing outer rt variable. And indeed, NANOMIPS_EXTRACT_RD has already been
extracted into it, so this becomes just
rt = decode_gpr_gpr3_src_store(rt);
Similarly throughout the rest of this file.
Consider creating one "int imm" variable at the top of the function that you
can reuse for all of these immediate value extractions and not have to create
these local variable blocks.
r~
- [Qemu-devel] [PATCH v3 00/40] Add nanoMIPS support to QEMU, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 12/40] target/mips: Add emulation of nanoMIPS FP instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions, Stefan Markovic, 2018/07/19
- Re: [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 19/40] target/mips: Add emulation of nanoMIPS branch instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 24/40] target/mips: Add updating BadInstr and BadInstrP registers for nanoMIPS, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 33/40] elf: Relax MIPS' elf_check_arch() to accept EM_NANOMIPS too, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 31/40] target/mips: Fix ERET/ERETNC behavior related to ADEL exception, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 39/40] gdbstub: Add XML support for GDB for nanoMIPS, Stefan Markovic, 2018/07/19