require_supervisor;
-require64;
+
+reg_t val;
switch(insn.rtype.rb)
{
case 0:
- RA = sr;
+ val = sr;
break;
case 1:
- RA = epc;
+ val = epc;
break;
case 2:
- RA = badvaddr;
+ val = badvaddr;
break;
case 3:
- RA = ebase;
+ val = ebase;
break;
case 8:
- RA = MEMSIZE >> 12;
+ val = MEMSIZE >> 12;
break;
case 17:
- RA = sim->get_fromhost();
+ val = sim->get_fromhost();
break;
default:
- RA = -1;
+ val = -1;
}
+
+RA = gprlen == 64 ? val : sext32(val);
ebase = 0;
epc = 0;
badvaddr = 0;
- set_sr(SR_S);
+ set_sr(SR_S | (support_64bit ? SR_KX : 0));
set_fsr(0);
memset(counters,0,sizeof(counters));
void processor_t::set_sr(uint32_t val)
{
sr = val & ~SR_ZERO;
- if(support_64bit)
- sr |= SR_KX;
- else
+ if(!support_64bit)
sr &= ~(SR_KX | SR_UX);
+printf("kx,ux now %d,%d %llx\n",!!(sr & SR_KX),!!(sr & SR_UX),pc);
gprlen = ((sr & SR_S) ? (sr & SR_KX) : (sr & SR_UX)) ? 64 : 32;
}
catch(trap_t t)
{
i++;
- take_trap(t);
+ take_trap(t,noisy);
}
}
-void processor_t::take_trap(trap_t t)
+void processor_t::take_trap(trap_t t, bool noisy)
{
demand(t < NUM_TRAPS, "internal error: bad trap number %d", int(t));
demand(sr & SR_ET, "error mode on core %d!\ntrap %s, pc 0x%016llx",
id, trap_name(t), (unsigned long long)pc);
+ if(noisy)
+ printf("core %3d: trap %s, pc 0x%016llx\n",
+ id, trap_name(t), (unsigned long long)pc);
set_sr((((sr & ~SR_ET) | SR_S) & ~SR_PS) | ((sr & SR_S) ? SR_PS : 0));
epc = pc;
// functions
void set_sr(uint32_t val);
void set_fsr(uint32_t val);
- void take_trap(trap_t t);
+ void take_trap(trap_t t, bool noisy);
void disasm(insn_t insn, reg_t pc);
friend class sim_t;