On 09/28/2010 09:00 AM, wilbur.chan wrote:
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.
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)
2) this is handle_int , which is the entry of interrupts
'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
I want the
3) this is do_IRQ
ack_irq(); /* ack with compare register ,which is used to
generate timer interrupt*/
4) there is a main loop like this:
local_irq_enable(); /* enable timer interrupt*/
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 !