1226 |
|
|
1227 |
|
// Decoded operand type |
1228 |
|
struct ia64_operand_t { |
1229 |
< |
unsigned char commit; |
1230 |
< |
unsigned char valid; |
1231 |
< |
signed char index; |
1232 |
< |
unsigned char nat; |
1233 |
< |
unsigned long value; |
1229 |
> |
unsigned char commit; // commit result of operation to register file? |
1230 |
> |
unsigned char valid; // XXX: not really used, can be removed (debug) |
1231 |
> |
signed char index; // index of GPR, or -1 if immediate value |
1232 |
> |
unsigned char nat; // NaT state before operation |
1233 |
> |
unsigned long value; // register contents or immediate value |
1234 |
|
}; |
1235 |
|
|
1236 |
|
// Decoded instruction type |
1237 |
|
struct ia64_instruction_t { |
1238 |
< |
unsigned char mnemo; |
1239 |
< |
unsigned char pred; |
1240 |
< |
unsigned char no_memory; |
1241 |
< |
unsigned long inst; |
1238 |
> |
unsigned char mnemo; // operation to perform |
1239 |
> |
unsigned char pred; // predicate register to check |
1240 |
> |
unsigned char no_memory; // used to emulated main fault instruction |
1241 |
> |
unsigned long inst; // the raw instruction bits (41-bit wide) |
1242 |
|
ia64_operand_t operands[IA64_N_OPERANDS]; |
1243 |
|
}; |
1244 |
|
|
1614 |
|
|
1615 |
|
static bool ia64_emulate_instruction(ia64_instruction_t *inst, unsigned long *ctx) |
1616 |
|
{ |
1617 |
+ |
// XXX: handle Register NaT Consumption fault? |
1618 |
+ |
// XXX: this simple emulator assumes instructions in a bundle |
1619 |
+ |
// don't depend on effects of other instructions in the same |
1620 |
+ |
// bundle. It probably would be simpler to JIT-generate code to be |
1621 |
+ |
// executed natively but probably more costly (inject/extract CPU state) |
1622 |
|
if (inst->mnemo == IA64_INST_UNKNOWN) |
1623 |
|
return false; |
1624 |
|
if (inst->pred && !IA64_GET_PR(inst->pred)) |