merge my index fix and lisa's fix
authorAli Saidi <saidi@eecs.umich.edu>
Tue, 6 Feb 2007 23:47:42 +0000 (18:47 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Tue, 6 Feb 2007 23:47:42 +0000 (18:47 -0500)
--HG--
extra : convert_revision : 5f2c7d46c96fa061bbfb66edf188d405ca600020

1  2 
src/arch/sparc/interrupts.hh

index 3af4f6342919c013c17edcc709330519a8e51644,42bbfc5cf40ddc196f43fc6a608f98f128340258..dc3b235fe075480accf63575e0eb8abbd0460e4a
@@@ -46,97 -46,67 +46,69 @@@ enum interrupts_t 
      num_interrupt_types
  };
  
    class Interrupts
    {
+ class Interrupts
+ {
  
-       private:
+   private:
  
-         bool interrupts[num_interrupt_types];
-         int numPosted;
+     bool interrupts[num_interrupt_types];
+     int numPosted;
  
-       public:
-         Interrupts()
-         {
-             for (int i = 0; i < num_interrupt_types; ++i) {
-                 interrupts[i] = false;
-             }
-             numPosted = 0;
+   public:
+     Interrupts()
+     {
+         for (int i = 0; i < num_interrupt_types; ++i) {
+             interrupts[i] = false;
          }
+         numPosted = 0;
+     }
  
-         void post(int int_type)
-         {
-             if (int_type < 0 || int_type >= num_interrupt_types)
-                 panic("posting unknown interrupt!\n");
-             if (interrupts[int_type] == false) {
-                 interrupts[int_type] = true;
-                 ++numPosted;
-             }
+     void post(int int_type)
+     {
+         if (int_type < 0 || int_type >= num_interrupt_types)
+             panic("posting unknown interrupt!\n");
 -        interrupts[int_type] = true;
 -        ++numPosted;
++        if (interrupts[int_type] == false) {
++            interrupts[int_type] = true;
++            ++numPosted;
 +        }
+     }
  
-         void post(int int_num, int index)
-         {
-         }
+     void post(int int_num, int index)
+     {
  
-         void clear(int int_num, int index)
-         {
+     }
  
-         }
+     void clear(int int_num, int index)
+     {
  
-         void clear_all()
-         {
+     }
  
-         }
+     void clear_all()
+     {
  
-         bool check_interrupts(ThreadContext * tc) const
-         {
-             if (numPosted)
-                 return true;
-             else
-                 return false;
-         }
+     }
  
-         Fault getInterrupt(ThreadContext * tc)
-         {
-             int hpstate = tc->readMiscReg(MISCREG_HPSTATE);
-             int pstate = tc->readMiscReg(MISCREG_PSTATE);
-             bool ie = pstate & PSTATE::ie;
-             // THESE ARE IN ORDER OF PRIORITY
-             // since there are early returns, and the highest
-             // priority interrupts should get serviced,
-             // it is v. important that new interrupts are inserted
-             // in the right order of processing
-             if (hpstate & HPSTATE::hpriv) {
-                 if (ie) {
-                     if (interrupts[hstick_match]) {
-                         if (tc->readMiscReg(MISCREG_HINTP) & 1) {
-                             interrupts[hstick_match] = false;
-                             --numPosted;
-                             return new HstickMatch;
-                         }
-                     }
-                     if (interrupts[interrupt_vector]) {
-                         interrupts[interrupt_vector] = false;
-                         --numPosted;
-                         //HAVEN'T IMPLed THIS YET
-                         return NoFault;
-                     }
-                 } else {
-                     if (interrupts[hstick_match]) {
-                         return NoFault;
-                     }
+     bool check_interrupts(ThreadContext * tc) const
+     {
+         if (numPosted)
+             return true;
+         else
+             return false;
+     }
  
-                 }
-             } else {
-                 if (interrupts[trap_level_zero]) {
-                     if ((pstate & HPSTATE::tlz) && (tc->readMiscReg(MISCREG_TL) == 0)) {
-                         interrupts[trap_level_zero] = false;
-                         --numPosted;
-                         return new TrapLevelZero;
-                     }
-                 }
+     Fault getInterrupt(ThreadContext * tc)
+     {
+         int hpstate = tc->readMiscReg(MISCREG_HPSTATE);
+         int pstate = tc->readMiscReg(MISCREG_PSTATE);
+         bool ie = pstate & PSTATE::ie;
+         // THESE ARE IN ORDER OF PRIORITY
+         // since there are early returns, and the highest
+         // priority interrupts should get serviced,
+         // it is v. important that new interrupts are inserted
+         // in the right order of processing
+         if (hpstate & HPSTATE::hpriv) {
+             if (ie) {
                  if (interrupts[hstick_match]) {
                      if (tc->readMiscReg(MISCREG_HINTP) & 1) {
                          interrupts[hstick_match] = false;