e2k: Probe AAU read access once per page.
This commit is contained in:
parent
00502466f2
commit
8a56f792b7
@ -475,6 +475,7 @@ typedef struct {
|
||||
E2KAauPrefInstr pi; /* prefetch instr */
|
||||
uint32_t cdi; /* current data index */
|
||||
uint32_t ldi; /* loaded data index */
|
||||
target_ulong last_page;
|
||||
} E2KAauAreaState;
|
||||
|
||||
typedef struct {
|
||||
|
@ -27,7 +27,7 @@ DEF_HELPER_2(probe_read_access, int, env, tl)
|
||||
DEF_HELPER_2(probe_write_access, int, env, tl)
|
||||
|
||||
DEF_HELPER_1(aau_load_program, void, env)
|
||||
DEF_HELPER_3(mova_ptr, tl, env, int, int)
|
||||
DEF_HELPER_4(mova_ptr, tl, env, int, int, int)
|
||||
DEF_HELPER_3(aau_am, void, env, int, int)
|
||||
DEF_HELPER_4(dam_lock_addr, void, env, i64, int, int)
|
||||
DEF_HELPER_4(dam_unlock_addr, int, env, i64, int, int)
|
||||
|
@ -8,6 +8,7 @@
|
||||
static inline void init_prefetch_area(E2KAauAreaState *s, E2KAauPrefInstr pi,
|
||||
uint32_t *inds)
|
||||
{
|
||||
s->last_page = 0;
|
||||
if (pi.fmt != 0) {
|
||||
s->pi = pi;
|
||||
s->ldi = 0;
|
||||
@ -45,14 +46,23 @@ void HELPER(aau_load_program)(CPUE2KState *env)
|
||||
}
|
||||
}
|
||||
|
||||
target_ulong HELPER(mova_ptr)(CPUE2KState *env, int chan, int area)
|
||||
target_ulong HELPER(mova_ptr)(CPUE2KState *env, int chan, int area, int ind)
|
||||
{
|
||||
E2KAauPrefState *ps = chan < 2 ? &env->aau.pl : &env->aau.pr;
|
||||
E2KAauAreaState *as = &ps->area[area];
|
||||
E2KAauPrefInstr instr = as->pi;
|
||||
E2KAad aad = env->aau.ds[instr.aad];
|
||||
target_ulong ptr = aad.base + as->cdi + instr.disp + ind;
|
||||
target_ulong page = ptr & ~(TARGET_PAGE_SIZE - 1);
|
||||
|
||||
return aad.base + as->cdi + instr.disp;
|
||||
if (as->last_page == 0 || page != as->last_page) {
|
||||
if (!helper_probe_read_access(env, page)) {
|
||||
return 0;
|
||||
}
|
||||
as->last_page = page;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void HELPER(aau_am)(CPUE2KState *env, int chan, int area)
|
||||
|
@ -45,7 +45,6 @@ static void gen_checked_ld(DisasContext *ctx, Mova *instr, TCGv ptr)
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
TCGv_i32 tag = e2k_get_temp_i32(ctx);
|
||||
TCGv_i64 dst = e2k_get_temp_i64(ctx);
|
||||
TCGv_i32 t0 = tcg_temp_new_i32();
|
||||
MemOp memop = instr->be ? MO_BE : MO_LE;
|
||||
|
||||
switch(instr->opc) {
|
||||
@ -58,10 +57,7 @@ static void gen_checked_ld(DisasContext *ctx, Mova *instr, TCGv ptr)
|
||||
break;
|
||||
}
|
||||
|
||||
/* MOVA can try to read inaccessible memory */
|
||||
gen_helper_probe_read_access(t0, cpu_env, ptr);
|
||||
tcg_gen_brcondi_i32(TCG_COND_NE, t0, 0, l0);
|
||||
tcg_temp_free_i32(t0);
|
||||
tcg_gen_brcondi_tl(TCG_COND_NE, ptr, 0, l0);
|
||||
|
||||
/* if address is invalid */
|
||||
tcg_gen_movi_i32(tag, E2K_TAG_NON_NUMBER64);
|
||||
@ -81,12 +77,9 @@ static inline void gen_mova_ptr(TCGv ret, Mova *instr)
|
||||
{
|
||||
TCGv_i32 t0 = tcg_const_i32(instr->chan);
|
||||
TCGv_i32 t1 = tcg_const_i32(instr->area);
|
||||
TCGv t2 = tcg_temp_new();
|
||||
|
||||
gen_helper_mova_ptr(t2, cpu_env, t0, t1);
|
||||
tcg_gen_addi_tl(ret, t2, instr->ind);
|
||||
|
||||
tcg_temp_free(t2);
|
||||
TCGv_i32 t2 = tcg_const_i32(instr->ind);
|
||||
gen_helper_mova_ptr(ret, cpu_env, t0, t1, t2);
|
||||
tcg_temp_free_i32(t2);
|
||||
tcg_temp_free_i32(t1);
|
||||
tcg_temp_free_i32(t0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user