Re: Why mips eret failed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/28/2010 09:00 AM, wilbur.chan wrote:
HI all!

I'm learning to write a timer interrupt handler by my own on
mips32(xls416 with 32bits cross compiled) , but to find that, eret
failed to quit.

detail:

I took the following steps:

1)  copy exception vector to the physical address 0x180, then set ebase with it.

      that is , memcpy these three  instructions to 0x80000180,with
size 0x80 bytes:

         lui    k1, HIGH(handle_int)
        addiu  k1, k1, LOW(handle_int)
        jr     k1


  2)     this is handle_int , which is  the entry of interrupts

     LEAF(handle_int)
          nop
          la     t9,do_IRQ
          nop
          jalr   t9
          nop
         eret
         nop
    END(handle_int)

  ps:

  'nop' is used to avoid delay slot,  and I did not add 'SAVE_ALL'  or
'RESTORE_ALL'  in handle_int,


Probably not a good choice.


because it is just a demo,

If you want your demo to work, you cannot clobber all the registers in an exception handler. Most ABIs allow you to clobber only k0 and k1.

In general any exception handler must save and restore all registers it modifies except for k0 and k1. That is the function of SAVE_ALL and RESTORE_ALL.

I want the
interrupt return

immediately.

3) this is do_IRQ

  void do_IRQ(void)
{
     ack_irq();    /* ack with compare register ,which is used to
generate timer interrupt*/
     print("do_irq enter\n");
}



4) there is a main loop like  this:


     void main_loop()
   {
      local_irq_enable(); /* enable timer interrupt*/
     while(1)
     {
          print("loop...\n");

     }
  }

I found that , the message in do_IRQ  prints  every 4s (I' ve set
timer of 4 seconds),  however, the message in main_loop did not appear


q1:  does that mean, the timer interrupt has never quit to main_loop ,
but a nested interrupt?



q2:  that is to say, eret in handle_int failed to quit to main_loop?

q3: why this happend?


Thank you !






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux