[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB
From: |
Richard Henderson |
Subject: |
Re: [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB |
Date: |
Sun, 23 Apr 2023 10:09:30 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
On 4/20/23 22:28, Anton Johansson wrote:
Changes pc and cs_base in TranslationBlock from target_ulong to vaddr.
Auxilliary structs and tb_*()/tlb_*() functions that depend on this
change are also updated to take a vaddr for guest virtual addresses.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/stubs/tcg-stub.c | 2 +-
accel/tcg/cpu-exec.c | 49 +++++-----
accel/tcg/cputlb.c | 179 +++++++++++++++++------------------
accel/tcg/internal.h | 6 +-
accel/tcg/tb-hash.h | 12 +--
accel/tcg/tb-jmp-cache.h | 2 +-
accel/tcg/tb-maint.c | 2 +-
accel/tcg/translate-all.c | 15 +--
include/exec/cpu-defs.h | 4 +-
include/exec/cpu_ldst.h | 6 +-
include/exec/exec-all.h | 82 ++++++++--------
include/qemu/plugin-memory.h | 2 +-
12 files changed, 181 insertions(+), 180 deletions(-)
This is too large and must be split. In addition, there are places where you must take
more care with the replacement.
@@ -412,10 +412,11 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
{
CPUState *cpu = env_cpu(env);
TranslationBlock *tb;
- target_ulong cs_base, pc;
+ vaddr cs_base = 0, pc = 0;
uint32_t flags, cflags;
- cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
+ cpu_get_tb_cpu_state(env, (target_ulong *) &pc,
+ (target_ulong *) &cs_base, &flags);
This simply will not work on big-endian hosts.
@@ -543,7 +544,8 @@ void cpu_exec_step_atomic(CPUState *cpu)
g_assert(!cpu->running);
cpu->running = true;
- cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
+ cpu_get_tb_cpu_state(env, (target_ulong *) &pc,
+ (target_ulong *) &cs_base, &flags);
Likewise.
@@ -946,10 +948,11 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
while (!cpu_handle_interrupt(cpu, &last_tb)) {
TranslationBlock *tb;
- target_ulong cs_base, pc;
+ vaddr cs_base = 0, pc = 0;
uint32_t flags, cflags;
- cpu_get_tb_cpu_state(cpu->env_ptr, &pc, &cs_base, &flags);
+ cpu_get_tb_cpu_state(cpu->env_ptr, (target_ulong *) &pc,
+ (target_ulong *) &cs_base, &flags);
Likewise. And one more in translate-all.c.
@@ -560,15 +557,15 @@ static void tlb_flush_page_by_mmuidx_async_0(CPUState
*cpu,
static void tlb_flush_page_by_mmuidx_async_1(CPUState *cpu,
run_on_cpu_data data)
{
- target_ulong addr_and_idxmap = (target_ulong) data.target_ptr;
- target_ulong addr = addr_and_idxmap & TARGET_PAGE_MASK;
+ vaddr addr_and_idxmap = (vaddr) data.target_ptr;
run_on_cpu_data.target_ptr is already vaddr, no need for cast.
r~
- [PATCH 0/8] Start replacing target_ulong with vaddr, Anton Johansson, 2023/04/20
- [PATCH 3/8] accel/tcg: Replace target_ulong with vaddr in *_mmu_lookup(), Anton Johansson, 2023/04/20
- [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB, Anton Johansson, 2023/04/20
- Re: [PATCH 1/8] accel: Replace `target_ulong` with `vaddr` in TB/TLB,
Richard Henderson <=
- [PATCH 2/8] accel: Replace target_ulong with vaddr in probe_*(), Anton Johansson, 2023/04/20
- [PATCH 5/8] accel/tcg: Replace target_ulong with vaddr in translator_*(), Anton Johansson, 2023/04/20
- [PATCH 8/8] tcg: Replace target_ulong with vaddr in tcg_gen_code(), Anton Johansson, 2023/04/20
- [PATCH 7/8] cpu: Replace target_ulong with vaddr in tb_invalidate_phys_addr(), Anton Johansson, 2023/04/20