Exemplo n.º 1
0
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] );
	}
    }
}
Exemplo n.º 2
0
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]);
        }
    }
}
Exemplo n.º 3
0
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;
        }
    }
}