/[hurd]/hurd-l4/wortel/wortel.h
ViewVC logotype

Diff of /hurd-l4/wortel/wortel.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by marcus, Mon Apr 26 21:15:21 2004 UTC revision 1.13 by marcus, Wed Oct 27 20:29:52 2004 UTC
# Line 55  extern wortel_cap_id_t wortel_cap_id; Line 55  extern wortel_cap_id_t wortel_cap_id;
55  #define WORTEL_MSG_GET_CAP_REPLY        66  #define WORTEL_MSG_GET_CAP_REPLY        66
56  #define WORTEL_MSG_GET_THREADS          67  #define WORTEL_MSG_GET_THREADS          67
57  #define WORTEL_MSG_GET_TASK_CAP         68  #define WORTEL_MSG_GET_TASK_CAP         68
58    #define WORTEL_MSG_GET_FIRST_FREE_THREAD_NO 69
59    #define WORTEL_MSG_GET_TASK_CAP_REQUEST 70
60    #define WORTEL_MSG_GET_TASK_CAP_REPLY   71
61    
62  #define _WORTEL_LABEL(id)                                       \  #define _WORTEL_LABEL(id)                                       \
63    (((id) << WORTEL_MSG_CAP_ID_BITS)                             \    (((id) << WORTEL_MSG_CAP_ID_BITS)                             \
# Line 341  wortel_get_task_cap (void) Line 344  wortel_get_task_cap (void)
344    return task;    return task;
345  }  }
346    
347    
348    /* Get the first free thread number for task.  */
349    static inline l4_word_t
350    __attribute__((always_inline))
351    wortel_get_first_free_thread_no (void)
352    {
353      l4_msg_tag_t tag;
354      l4_word_t first_free_thread_no;
355      
356      l4_accept (L4_UNTYPED_WORDS_ACCEPTOR);
357    
358      tag = l4_niltag;
359      l4_msg_tag_set_label (&tag,
360                            _WORTEL_LABEL (WORTEL_MSG_GET_FIRST_FREE_THREAD_NO));
361      l4_set_msg_tag (tag);
362      tag = l4_call (wortel_thread_id);
363    
364      l4_store_mr (1, &first_free_thread_no);
365      return first_free_thread_no;
366    }
367    
368    
369    /* Get the next task capability request.  */
370    static inline hurd_task_id_t
371    __attribute__((always_inline))
372    wortel_get_task_cap_request (unsigned int *nr_threads, l4_thread_id_t *threads)
373    {
374      l4_msg_tag_t tag;
375      hurd_task_id_t task_id;
376      unsigned int nr_items;
377      unsigned int mr;
378    
379      l4_accept (L4_UNTYPED_WORDS_ACCEPTOR);
380    
381      tag = l4_niltag;
382      l4_msg_tag_set_label (&tag, _WORTEL_LABEL (WORTEL_MSG_GET_TASK_CAP_REQUEST));
383      l4_set_msg_tag (tag);
384      tag = l4_call (wortel_thread_id);
385    
386      *nr_threads = 0;
387      mr = 1;
388      l4_store_mr (mr++, &task_id);
389      nr_items = l4_untyped_words (tag) - 1;
390      while (nr_items--)
391        l4_store_mr (mr++, &threads[(*nr_threads)++]);
392    
393      return task_id;
394    }
395    
396    
397    /* Reply to a task capability request.  */
398    static inline void
399    __attribute__((always_inline))
400    wortel_get_task_cap_reply (hurd_cap_handle_t handle)
401    {
402      l4_msg_tag_t tag;
403      l4_word_t nr_threads;
404      
405      l4_accept (L4_UNTYPED_WORDS_ACCEPTOR);
406    
407      tag = l4_niltag;
408      l4_msg_tag_set_label (&tag, _WORTEL_LABEL (WORTEL_MSG_GET_TASK_CAP_REPLY));
409      l4_msg_tag_set_untyped_words (&tag, 1);
410      l4_set_msg_tag (tag);
411      l4_load_mr (1, handle);
412      tag = l4_call (wortel_thread_id);
413    }
414    
415    
416  #endif  /* _WORTEL_USER_H */  #endif  /* _WORTEL_USER_H */

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26