2010/9/29 David Daney <ddaney@xxxxxxxxxxxxxxxxxx>: > On 09/28/2010 09:00 AM, wilbur.chan wrote: > > 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. OK, I 've added SAVL_ALL and RESTORE_ALL in handle_int,it works. LEAF(handle_int) print 'A' /* add for debug purpose*/ SAVE_ALL nop CLI la t9,do_IRQ nop jalr t9 nop RESTORE_ALL nop END(handle_int) However, a new problem arised : if I modify the main_loop like this: void main_loop() { local_irq_enable(); /* enable timer interrupt*/ while(1) { loop_test1(); } } void loop_test1() { loop_test2(); } void loop_test2() { } That is to say, if main_loop invoke a function that do noting but to invoke another nop function, the timer interrupt seems not to work properly, at fisrt few seconds, 'do_irq_enter' print every 4 seconds, but after a while ,system print 'A' from time to time , but not print 'do_irq_enter' any more. it seemed that , system has not acked the timer interrupt. If I remove the loop_test1 in main_loop, everything works well. I don't know why this happened. Any suggestion? Thank you