void lanaddress_server_thread(void *p) { L4_ThreadId_t partner; L4_MsgTag_t msgtag; idl4_msgbuf_t msgbuf; long cnt; static void *ILanAddress_vtable[ILANADDRESS_DEFAULT_VTABLE_SIZE] = ILANADDRESS_DEFAULT_VTABLE; idl4_msgbuf_init( &msgbuf ); while( 1 ) { partner = L4_nilthread; msgtag.raw = 0; cnt = 0; while( 1 ) { idl4_msgbuf_sync( &msgbuf ); idl4_reply_and_wait( &partner, &msgtag, &msgbuf, &cnt ); if( idl4_is_error( &msgtag ) ) break; idl4_process_request( &partner, &msgtag, &msgbuf, &cnt, ILanAddress_vtable[ idl4_get_function_id(&msgtag) & ILANADDRESS_FID_MASK] ); } } }
void File_server(void) { L4_ThreadId_t partner; L4_MsgTag_t msgtag; idl4_msgbuf_t msgbuf; long cnt; idl4_msgbuf_init(&msgbuf); for (cnt = 0;cnt < FILE_STRBUF_SIZE;cnt++) idl4_msgbuf_add_buffer(&msgbuf, malloc(8000), 8000); while (1) { partner = L4_nilthread; msgtag.raw = 0; cnt = 0; while (1) { idl4_msgbuf_sync(&msgbuf); idl4_reply_and_wait(&partner, &msgtag, &msgbuf, &cnt); if (idl4_is_error(&msgtag)) break; idl4_process_request(&partner, &msgtag, &msgbuf, &cnt, File_vtable[idl4_get_function_id(&msgtag) & FILE_FID_MASK]); } } }
void booter_server() { unsigned int msgdope, dummy, fnr, reply, w0, w1, w2; l4_threadid_t partner; struct { unsigned int stack[768]; l4_fpage_t rcv_window; unsigned int size_dope; unsigned int send_dope; unsigned int message[BOOTER_MSGBUF_SIZE]; idl4_strdope_t str[BOOTER_STRBUF_SIZE]; } buffer; for (w0 = 0; w0 < BOOTER_STRBUF_SIZE; w0++) { buffer.str[w0].rcv_addr = malloc(8000); buffer.str[w0].rcv_size = 8000; } while (1) { buffer.size_dope = BOOTER_RCV_DOPE; buffer.rcv_window = idl4_nilpage; partner = idl4_nilthread; reply = idl4_nil; w0 = w1 = w2 = 0; while (1) { idl4_reply_and_wait(reply, buffer, partner, msgdope, fnr, w0, w1, w2, dummy); if (msgdope & 0xF0) break; idl4_process_request(booter_itable[(fnr >> IDL4_FID_BITS) & BOOTER_IID_MASK], fnr & BOOTER_FID_MASK, reply, buffer, partner, w0, w1, w2, dummy); } enter_kdebug("message error"); } }
void device_server(void) { L4_ThreadId_t partner; L4_MsgTag_t msgtag; idl4_msgbuf_t msgbuf; long cnt; uintptr_t *size; partner = L4_nilthread; msgtag.raw = 0; cnt = 0; while (1) { /* * Now check async queues -- we check this everytime, which is a bit * silly, would be nice if we could detect a failed ipc to us */ size = cb_get(iguana_cb_handle, sizeof(uintptr_t)); if (size) { // uintptr_t *data = cb_get(iguana_cb_handle, *size); // DEBUG_PRINT("Got stuff: %" PRIdPTR "\n", *size); // DEBUG_PRINT("Got stuff: %" PRIxPTR " %" PRIxPTR "\n", data[0], // data[1]); } /* Wait for message */ idl4_msgbuf_sync(&msgbuf); idl4_reply_and_wait(&partner, &msgtag, &msgbuf, &cnt); if (idl4_is_error(&msgtag)) { DEBUG_PRINT("timer:device_server(%d) Error %" PRIxPTR " -- replying_to: %" PRIxPTR "\n", __LINE__, L4_ErrorCode(), partner.raw); partner = L4_nilthread; msgtag.raw = 0; cnt = 0; continue; } if (msgtag.X.label == IRQ_LABEL) { driver_interrupt(global_device, partner.global.X.thread_no); continue; } switch (magpie_get_interface_bigid(&msgbuf)) { case 37: idl4_process_request(&partner, &msgtag, &msgbuf, &cnt, device_vtable[idl4_get_function_id(&msgtag) & DEVICE_FID_MASK]); break; case 40: idl4_process_request(&partner, &msgtag, &msgbuf, &cnt, timer_server_vtable[idl4_get_function_id (&msgtag) & TIMER_SERVER_FID_MASK]); break; case 41: idl4_process_request(&partner, &msgtag, &msgbuf, &cnt, timer__vtable[idl4_get_function_id(&msgtag) & TIMER__FID_MASK]); break; default: DEBUG_PRINT("timer: device_server: Bad label! (0x%lx)\n", magpie_get_interface_bigid(&msgbuf)); partner = L4_nilthread; } } }