Make sure a POR doesn't clobber the value of the hpstate.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 14 Nov 2006 06:29:11 +0000 (01:29 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 14 Nov 2006 06:29:11 +0000 (01:29 -0500)
--HG--
extra : convert_revision : 4504f08fd94792819bd4419bbd2e0ebd1d7f29e9

src/arch/sparc/faults.cc

index 4cf411d3bdf7bc17fcc7965f43e49e23399ff191..3ec41ba61eaf38dd9178b74cd22b36f8367d13b3 100644 (file)
@@ -593,7 +593,16 @@ void PowerOnReset::invoke(ThreadContext * tc)
     tc->setMiscReg(MISCREG_PSTATE, 1 << 4);
 
     //Turn on red and hpriv, set everything else to 0
-    tc->setMiscReg(MISCREG_HPSTATE, (1 << 5) | (1 << 2));
+    MiscReg HPSTATE = tc->readMiscReg(MISCREG_HPSTATE);
+    //HPSTATE.red = 1
+    HPSTATE |= (1 << 5);
+    //HPSTATE.hpriv = 1
+    HPSTATE |= (1 << 2);
+    //HPSTATE.ibe = 0
+    HPSTATE &= ~(1 << 10);
+    //HPSTATE.tlz = 0
+    HPSTATE &= ~(1 << 0);
+    tc->setMiscReg(MISCREG_HPSTATE, HPSTATE);
 
     //The tick register is unreadable by nonprivileged software
     tc->setMiscReg(MISCREG_TICK, 1ULL << 63);