00001
00006 #ifndef __L4_SYS__L4API_l4v2__SYSCALLS_IMPL_H__
00007 #define __L4_SYS__L4API_l4v2__SYSCALLS_IMPL_H__
00008
00009
00010 L4_INLINE l4_umword_t
00011 l4_thread_ex_regs_reg0(l4_umword_t threadnr,
00012 l4_umword_t tasknr,
00013 l4_umword_t flags);
00014
00015 L4_INLINE l4_umword_t
00016 l4_thread_ex_regs_reg0(l4_umword_t threadnr,
00017 l4_umword_t tasknr,
00018 l4_umword_t flags)
00019 {
00020 return threadnr | (tasknr << L4_THREAD_EX_REGS_TASK_ID_SHIFT) | flags;
00021 }
00022
00023
00024
00025
00026 L4_INLINE void
00027 l4_thread_ex_regs(l4_threadid_t destination,
00028 l4_umword_t eip,
00029 l4_umword_t esp,
00030 l4_threadid_t *preempter,
00031 l4_threadid_t *pager,
00032 l4_umword_t *old_eflags,
00033 l4_umword_t *old_eip,
00034 l4_umword_t *old_esp)
00035 {
00036 l4_thread_ex_regs_sc(destination.id.lthread,
00037 eip, esp, preempter, pager,
00038 old_eflags, old_eip, old_esp);
00039 }
00040
00041
00042
00043
00044 L4_INLINE void
00045 l4_thread_ex_regs_flags(l4_threadid_t destination,
00046 l4_umword_t eip,
00047 l4_umword_t esp,
00048 l4_threadid_t *preempter,
00049 l4_threadid_t *pager,
00050 l4_umword_t *old_eflags,
00051 l4_umword_t *old_eip,
00052 l4_umword_t *old_esp,
00053 unsigned long flags)
00054 {
00055 l4_thread_ex_regs_sc(l4_thread_ex_regs_reg0(destination.id.lthread, 0, flags),
00056 eip, esp, preempter, pager,
00057 old_eflags, old_eip, old_esp);
00058 }
00059
00060
00061
00062
00063 L4_INLINE void
00064 l4_inter_task_ex_regs(l4_threadid_t destination,
00065 l4_umword_t eip,
00066 l4_umword_t esp,
00067 l4_threadid_t *preempter,
00068 l4_threadid_t *pager,
00069 l4_threadid_t *cap_handler,
00070 l4_umword_t *old_eflags,
00071 l4_umword_t *old_eip,
00072 l4_umword_t *old_esp,
00073 unsigned long flags,
00074 l4_utcb_t *utcb)
00075 {
00076 utcb->ex_regs.caphandler = *cap_handler;
00077 l4_thread_ex_regs_sc(l4_thread_ex_regs_reg0(destination.id.lthread,
00078 destination.id.task,
00079 flags | L4_THREAD_EX_REGS_UTCB_ARGS),
00080 eip, esp, preempter, pager,
00081 old_eflags, old_eip, old_esp);
00082 *cap_handler = utcb->ex_regs.caphandler;
00083 }
00084
00085
00086
00087
00088 L4_INLINE l4_threadid_t
00089 l4_thread_ex_regs_pager(l4_threadid_t destination)
00090 {
00091 l4_umword_t dummy;
00092 l4_threadid_t preempter = L4_INVALID_ID;
00093 l4_threadid_t pager = L4_INVALID_ID;
00094
00095 l4_thread_ex_regs_flags(destination, ~0UL, ~0UL,
00096 &preempter, &pager, &dummy, &dummy, &dummy,
00097 L4_THREAD_EX_REGS_NO_CANCEL);
00098 return pager;
00099 }
00100
00101
00102
00103
00104 L4_INLINE l4_taskid_t
00105 l4_task_new(l4_taskid_t destination,
00106 l4_umword_t mcp_or_new_chief_and_flags,
00107 l4_umword_t esp,
00108 l4_umword_t eip,
00109 l4_threadid_t pager)
00110 {
00111 return l4_task_new_sc(destination, mcp_or_new_chief_and_flags,
00112 esp, eip, pager);
00113 }
00114
00115
00116
00117
00118 L4_INLINE l4_taskid_t
00119 l4_task_new_long(l4_taskid_t destination,
00120 l4_umword_t mcp_or_new_chief_and_flags,
00121 l4_umword_t esp,
00122 l4_umword_t eip,
00123 l4_threadid_t pager,
00124 l4_threadid_t cap_handler,
00125 l4_quota_desc_t kquota,
00126 l4_utcb_t *utcb)
00127 {
00128 utcb->task_new.caphandler = cap_handler;
00129 utcb->task_new.quota = kquota;
00130 return l4_task_new_sc(destination,
00131 mcp_or_new_chief_and_flags | L4_TASK_NEW_UTCB_ARGS,
00132 esp, eip, pager);
00133 }
00134
00135
00136 L4_INLINE l4_umword_t
00137 l4_fpage_unmap_taskid(unsigned taskid)
00138 {
00139 return (taskid & ~((1 << 11) - 1)) << 8;
00140 }
00141
00142 L4_INLINE void
00143 l4_yield(void)
00144 {
00145 l4_thread_switch(L4_NIL_ID);
00146 }
00147
00148 L4_INLINE l4_threadid_t
00149 l4_myself_noprof(void)
00150 {
00151 return l4_myself();
00152 }
00153
00154
00155 #endif