Skip to content

Commit

Permalink
target-sh4: Make increment_urc() take SuperHCPU
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Apr 13, 2012
1 parent b6cd130 commit 6242f56
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions target-sh4/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,18 @@ static int find_tlb_entry(CPUSH4State * env, target_ulong address,
return match;
}

static void increment_urc(CPUSH4State * env)
static void increment_urc(SuperHCPU *cpu)
{
uint8_t urb, urc;

/* Increment URC */
urb = ((env->mmucr) >> 18) & 0x3f;
urc = ((env->mmucr) >> 10) & 0x3f;
urb = ((cpu->env.mmucr) >> 18) & 0x3f;
urc = ((cpu->env.mmucr) >> 10) & 0x3f;
urc++;
if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1))
if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1)) {
urc = 0;
env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10);
}
cpu->env.mmucr = (cpu->env.mmucr & 0xffff03ff) | (urc << 10);
}

/* Copy and utlb entry into itlb
Expand Down Expand Up @@ -324,7 +325,7 @@ static int find_itlb_entry(CPUSH4State * env, target_ulong address,
static int find_utlb_entry(CPUSH4State * env, target_ulong address, int use_asid)
{
/* per utlb access */
increment_urc(env);
increment_urc(sh_env_get_cpu(env));

/* Return entry */
return find_tlb_entry(env, address, env->utlb, UTLB_SIZE, use_asid);
Expand Down Expand Up @@ -660,7 +661,7 @@ uint32_t cpu_sh4_read_mmaped_utlb_addr(CPUSH4State *s,
int index = (addr & 0x00003f00) >> 8;
tlb_t * entry = &s->utlb[index];

increment_urc(s); /* per utlb access */
increment_urc(sh_env_get_cpu(s)); /* per utlb access */

return (entry->vpn << 10) |
(entry->v << 8) |
Expand Down Expand Up @@ -702,7 +703,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,
entry->d = d;
utlb_match_entry = entry;
}
increment_urc(s); /* per utlb access */
increment_urc(sh_env_get_cpu(s)); /* per utlb access */
}

/* search ITLB */
Expand Down Expand Up @@ -735,7 +736,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,
entry->vpn = vpn;
entry->d = d;
entry->v = v;
increment_urc(s);
increment_urc(sh_env_get_cpu(s));
}
}

Expand All @@ -746,7 +747,7 @@ uint32_t cpu_sh4_read_mmaped_utlb_data(CPUSH4State *s,
int index = (addr & 0x00003f00) >> 8;
tlb_t * entry = &s->utlb[index];

increment_urc(s); /* per utlb access */
increment_urc(sh_env_get_cpu(s)); /* per utlb access */

if (array == 0) {
/* ITLB Data Array 1 */
Expand All @@ -773,7 +774,7 @@ void cpu_sh4_write_mmaped_utlb_data(CPUSH4State *s, target_phys_addr_t addr,
int index = (addr & 0x00003f00) >> 8;
tlb_t * entry = &s->utlb[index];

increment_urc(s); /* per utlb access */
increment_urc(sh_env_get_cpu(s)); /* per utlb access */

if (array == 0) {
/* UTLB Data Array 1 */
Expand Down

0 comments on commit 6242f56

Please sign in to comment.