25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: cpu_sh_instr.c,v 1.61 2007/06/04 06:32:25 debug Exp $ |
* $Id: cpu_sh_instr.c,v 1.64 2007/06/28 13:36:47 debug Exp $ |
29 |
* |
* |
30 |
* SH instructions. |
* SH instructions. |
31 |
* |
* |
102 |
|
|
103 |
if (cpu->machine->ncpus == 1) { |
if (cpu->machine->ncpus == 1) { |
104 |
static int x = 0; |
static int x = 0; |
105 |
|
|
106 |
if ((++x) == 600) { |
if ((++x) == 600) { |
107 |
usleep(10); |
usleep(10); |
108 |
x = 0; |
x = 0; |
109 |
} |
} |
110 |
|
|
111 |
cpu->n_translated_instrs += N_SAFE_DYNTRANS_LIMIT / 6; |
cpu->n_translated_instrs += N_SAFE_DYNTRANS_LIMIT / 6; |
112 |
} |
} |
113 |
} |
} |
2882 |
*/ |
*/ |
2883 |
X(to_be_translated) |
X(to_be_translated) |
2884 |
{ |
{ |
2885 |
uint64_t addr, low_pc; |
uint32_t addr, low_pc, iword; |
|
uint32_t iword; |
|
2886 |
unsigned char *page; |
unsigned char *page; |
2887 |
unsigned char ib[2]; |
unsigned char ib[2]; |
2888 |
int main_opcode, isize = sizeof(ib); |
int main_opcode, isize = sizeof(ib); |
2907 |
addr &= ~((1 << SH_INSTR_ALIGNMENT_SHIFT) - 1); |
addr &= ~((1 << SH_INSTR_ALIGNMENT_SHIFT) - 1); |
2908 |
|
|
2909 |
/* Read the instruction word from memory: */ |
/* Read the instruction word from memory: */ |
|
#ifdef MODE32 |
|
2910 |
page = cpu->cd.sh.host_load[(uint32_t)addr >> 12]; |
page = cpu->cd.sh.host_load[(uint32_t)addr >> 12]; |
|
#else |
|
|
{ |
|
|
const uint32_t mask1 = (1 << DYNTRANS_L1N) - 1; |
|
|
const uint32_t mask2 = (1 << DYNTRANS_L2N) - 1; |
|
|
const uint32_t mask3 = (1 << DYNTRANS_L3N) - 1; |
|
|
uint32_t x1 = (addr >> (64-DYNTRANS_L1N)) & mask1; |
|
|
uint32_t x2 = (addr >> (64-DYNTRANS_L1N-DYNTRANS_L2N)) & mask2; |
|
|
uint32_t x3 = (addr >> (64-DYNTRANS_L1N-DYNTRANS_L2N- |
|
|
DYNTRANS_L3N)) & mask3; |
|
|
struct DYNTRANS_L2_64_TABLE *l2 = cpu->cd.sh.l1_64[x1]; |
|
|
struct DYNTRANS_L3_64_TABLE *l3 = l2->l3[x2]; |
|
|
page = l3->host_load[x3]; |
|
|
} |
|
|
#endif |
|
2911 |
|
|
2912 |
if (page != NULL) { |
if (page != NULL) { |
2913 |
/* fatal("TRANSLATION HIT!\n"); */ |
/* fatal("TRANSLATION HIT!\n"); */ |