On Mon May 02, 2011 at 20:40:57 +0000, Jason Phillips wrote:
ok so far i have code like this:
void IRH(void) { printf("the interrupt occur\n"); }
int main () { L4_ThreadId_t handler_thread, IRQ_thread, mylocal, me; L4_Word_t root_utcb, new_utcb, sp, ip, root_threadNo; void* kip; char stack[1024]; L4_Msg_t msg;
kip = L4_kernelInterface(); me = L4_MyGlobalId(); mylocal = L4_MyLocalId(); root_threadNo = L4_ThreadNo(me); root_utcb = *(L4_Word_t*)&mylocal; root_utcb &= ~(L4_UtcbAreaSize(kip)-1); new_utcb = root_utcb + (L4_UtcbSize(kip) * ((root_threadNo+1) - L4_ThreadIdUserBase(kip)));
handler_thread = L4_GlobalId(root_threadNo+1, 1); IRQ_thread = L4_GlobalId(1,1);
ip = (L4_Word_t)IRH; sp = (L4_Word_t)&stack[1025];
L4_ThreadControl(handler_thread, me, me, me, (void*) new_utcb);
L4_Clear(&msg); L4_Append(&msg, ip); L4_Append(&msg, sp); L4_Load(&msg); L4_Send(handler_thread);
L4_AssociateInterrupt(IRQ_thread, handler_thread);
the intent is when i press a key on keyboard the interrupt is suppose to occur but text "the interrupt occur" do not display. I run tests so I know the threads working (interrupt and handler). but this does not work. Why is this so?
Just an idea, I'm not seeing an IPC operation on the IRQ_thread. Is that missing?
Adam