On Friday 16 October 2009 17:05:27 Adam Lackorzynski wrote:
Hi Cheng,
On Thu Oct 15, 2009 at 13:57:32 +0800, Guanghui, Cheng wrote:
BUT. I have a problem about my code when i fixing the stack of main thread. The correct code which could work well is like this: utcb = l4_utcb_get(); eip = utcb->exc.eip; esp = utcb->exc.esp; utcb->values[12] = (l4_umword_t)(do_irq); esp_loc = 1024 - (esp - (l4_umword_t)stack)/4; stack[esp_loc - 1] = eip; l4_msgtag ... l4_ipc_send_tag In the code above i only reset the next stack with return address (old eip). But it seems i can't reset the new stack pointer like utcb->values[15] = esp - 4 In my opinion it should do but if i did it can't work. It seems some tricky here. Can you tell me why it is like this? Additinally, i tried this way about handling interrupt with interrupt number like this: void do_irq(int irq) it can't work either.
Please refer to the attached modified version of your program. It's a bit more tricky than that, regs also need to be saved etc...
Your code is so smart. I tried to use the assembler code to finish the process. But ret instruction could only be back to the last step. iret is a really good idea to go back the origin place like goto. Thanks a lot. Cheng Guanghui