Skip to content

Commit

Permalink
accel/tcg: Unify user and softmmu do_[st|ld]*_mmu()
Browse files Browse the repository at this point in the history
The prototype of do_[st|ld]*_mmu() is unified between system- and
user-mode allowing a large chunk of helper_[st|ld]*() and cpu_[st|ld]*()
functions to be expressed in same manner between both modes. These
functions will be moved to ldst_common.c.inc in a following commit.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20230912153428.17816-11-anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
Anton Johansson authored and rth7680 committed Oct 4, 2023
1 parent 623912c commit e20f73f
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 82 deletions.
16 changes: 11 additions & 5 deletions accel/tcg/cputlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2922,18 +2922,24 @@ static void do_st_8(CPUState *cpu, MMULookupPageData *p, uint64_t val,
}
}

void helper_stb_mmu(CPUArchState *env, uint64_t addr, uint32_t val,
MemOpIdx oi, uintptr_t ra)
static void do_st1_mmu(CPUState *cpu, vaddr addr, uint8_t val,
MemOpIdx oi, uintptr_t ra)
{
MMULookupLocals l;
bool crosspage;

tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_8);
cpu_req_mo(TCG_MO_LD_ST | TCG_MO_ST_ST);
crosspage = mmu_lookup(env_cpu(env), addr, oi, ra, MMU_DATA_STORE, &l);
crosspage = mmu_lookup(cpu, addr, oi, ra, MMU_DATA_STORE, &l);
tcg_debug_assert(!crosspage);

do_st_1(env_cpu(env), &l.page[0], val, l.mmu_idx, ra);
do_st_1(cpu, &l.page[0], val, l.mmu_idx, ra);
}

void helper_stb_mmu(CPUArchState *env, uint64_t addr, uint32_t val,
MemOpIdx oi, uintptr_t ra)
{
tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_8);
do_st1_mmu(env_cpu(env), addr, val, oi, ra);
}

static void do_st2_mmu(CPUState *cpu, vaddr addr, uint16_t val,
Expand Down

0 comments on commit e20f73f

Please sign in to comment.