Beispiel #1
0
Value getStateValue(ThreadState& state, Target t)
{
   Value v;
   if (t >= TargetId::GPR0 && t <= TargetId::GPR31) {
      v.type = Value::Type::Uint32;
      v.uint32Value = state.gpr[t - TargetId::GPR0];
   } else if (t >= TargetId::FPR0 && t <= TargetId::FPR31) {
      v.type = Value::Type::Double;
      v.doubleValue = state.fpr[t - TargetId::FPR0].value;
   } else if (t >= TargetId::CRF0 && t <= TargetId::CRF7) {
      v.type = Value::Type::Uint32;
      v.uint32Value = getCRF(&state, t - TargetId::CRF0);
   } else if (t == TargetId::XERSO) {
      v.type = Value::Type::Uint32;
      v.uint32Value = state.xer.so;
   } else if (t == TargetId::XEROV) {
      v.type = Value::Type::Uint32;
      v.uint32Value = state.xer.ov;
   } else if (t == TargetId::XERCA) {
      v.type = Value::Type::Uint32;
      v.uint32Value = state.xer.ca;
   } else if (t == TargetId::XERBC) {
      v.type = Value::Type::Uint32;
      v.uint32Value = state.xer.byteCount;
   } else {
      assert(0);
   }
   return v;
}
// Move Condition Register Field
static void
mcrf(ThreadState *state, Instruction instr)
{
   setCRF(state, instr.crfD, getCRF(state, instr.crfS));
}