[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 08/24] riscv: tcg-target: Add the immediate enc
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [RFC v2 08/24] riscv: tcg-target: Add the immediate encoders |
Date: |
Wed, 28 Nov 2018 11:36:38 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 |
On 11/27/18 1:07 PM, Alistair Francis wrote:
> +void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr,
> + uintptr_t addr)
> +{
> + intptr_t offset = (intptr_t)addr - (intptr_t)jmp_addr;
> + tcg_debug_assert(offset == (int32_t)offset);
> +
> + int32_t hi20 = ((offset + 0x800) >> 12) << 12;
> + int32_t lo12 = offset - hi20;
> +
> + atomic_set((uint32_t *)jmp_addr, encode_uimm20(hi20));
> + atomic_set((uint32_t *)jmp_addr + 4, encode_imm12(lo12));
> +
> + flush_icache_range(jmp_addr, jmp_addr + 8);
> +}
Two atomic_sets do not help. You want a single 64-bit atomic_set updating both
insns simultaneously. But since you're currently setting
> +#define TCG_TARGET_HAS_direct_jump 0
this code isn't used at all. Better to simply remove it for now.
Otherwise,
Reviewed-by: Richard Henderson <address@hidden>
r~
- [Qemu-devel] [RFC v2 01/24] elf.h: Add the RISCV ELF magic numbers, (continued)
- [Qemu-devel] [RFC v2 01/24] elf.h: Add the RISCV ELF magic numbers, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 02/24] linux-user: Add host dependency for RISC-V 32-bit, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 03/24] linux-user: Add host dependency for RISC-V 64-bit, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 04/24] exec: Add RISC-V GCC poison macro, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 05/24] riscv: Add the tcg-target header file, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 06/24] riscv: Add the tcg target registers, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 07/24] riscv: tcg-target: Add support for the constraints, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 08/24] riscv: tcg-target: Add the immediate encoders, Alistair Francis, 2018/11/27
- Re: [Qemu-devel] [RFC v2 08/24] riscv: tcg-target: Add the immediate encoders,
Richard Henderson <=
- [Qemu-devel] [RFC v2 09/24] riscv: tcg-target: Add the instruction emitters, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 10/24] riscv: tcg-target: Add the relocation functions, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 11/24] riscv: tcg-target: Add the mov and movi instruction, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 12/24] riscv: tcg-target: Add the extract instructions, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 13/24] riscv: tcg-target: Add the out load and store instructions, Alistair Francis, 2018/11/27
- [Qemu-devel] [RFC v2 14/24] riscv: tcg-target: Add branch and jump instructions, Alistair Francis, 2018/11/27