mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
more
This commit is contained in:
@@ -24,86 +24,96 @@ extern "C" {
|
||||
#define CAP_RECEIVER_SET_OWNER 1
|
||||
#define CAP_RECEIVER_CREATE_CAPABILITY 2
|
||||
#define CAP_RECEIVER_CREATE_CALL_CAPABILITY 3
|
||||
#define CAP_RECEIVER_GET_REPLY_PROTECTED_DATA 4
|
||||
#define CAP_RECEIVER_SET_REPLY_PROTECTED_DATA 5
|
||||
#define CAP_RECEIVER_ALL_RIGHTS 0x7f
|
||||
/* Not an operation; a capability with this bit set is a call capability. */
|
||||
#define CAP_RECEIVER_CALL 7
|
||||
/* Same thing for reply capability. */
|
||||
#define CAP_RECEIVER_REPLY 8
|
||||
/* If set on a call capability, waiting for only this reply is disabled. */
|
||||
#define CAP_RECEIVER_CALL_ASYNC 1
|
||||
|
||||
#define CAP_MEMORY_CREATE 1
|
||||
#define CAP_MEMORY_DESTROY 2
|
||||
#define CAP_MEMORY_LIST 3
|
||||
#define CAP_MEMORY_MAPPING 4
|
||||
#define CAP_MEMORY_SET_LIMIT 5
|
||||
#define CAP_MEMORY_GET_LIMIT 6
|
||||
#define CAP_MEMORY_DROP 7
|
||||
#define CAP_MEMORY_MAP 4
|
||||
#define CAP_MEMORY_MAPPING 5
|
||||
#define CAP_MEMORY_SET_LIMIT 6
|
||||
#define CAP_MEMORY_GET_LIMIT 7
|
||||
#define CAP_MEMORY_DROP 8
|
||||
#define CAP_MEMORY_ALL_RIGHTS 0x1ff
|
||||
|
||||
#define CAP_THREAD_GET_INFO 1 /* Details of this are arch-specific. */
|
||||
#define CAP_THREAD_SET_INFO 2 /* Details of this are arch-specific. */
|
||||
#define CAP_THREAD_SCHEDULE 3
|
||||
#define CAP_THREAD_INFO 1 /* Details of this are arch-specific. */
|
||||
#define CAP_THREAD_SCHEDULE 2
|
||||
#define CAP_THREAD_MAKE_PRIV 6
|
||||
#define CAP_THREAD_GET_TOP_MEMORY 7
|
||||
#define CAP_THREAD_REGISTER_INTERRUPT 8
|
||||
#define CAP_THREAD_ALL_RIGHTS 0xff
|
||||
#define CAP_THREAD_ALL_PRIV_RIGHTS (CAP_THREAD_ALL_RIGHTS | (1 << CAP_THREAD_REGISTER_INTERRUPT) | (1 << CAP_THREAD_GET_TOP_MEMORY))
|
||||
#define CAP_THREAD_ALL_RIGHTS 0x3f
|
||||
#define CAP_THREAD_ALL_PRIV_RIGHTS (CAP_THREAD_ALL_RIGHTS | (1 << CAP_THREAD_REGISTER_INTERRUPT) | (1 << CAP_THREAD_GET_TOP_MEMORY) | (1 << CAP_THREAD_MAKE_PRIV))
|
||||
|
||||
/* These get/set_info are not arch-specific. */
|
||||
#define CAP_THREAD_INFO_PC ~0
|
||||
#define CAP_THREAD_INFO_SP ~1
|
||||
#define CAP_THREAD_INFO_FLAGS ~2
|
||||
/* Flag values for processor state */
|
||||
#define THREAD_FLAG_WAITING 0x80000000
|
||||
#define THREAD_FLAG_RUNNING 0x40000000
|
||||
#define THREAD_FLAG_PRIV 0x20000000
|
||||
#define THREAD_FLAG_PRIV 0x80000000
|
||||
#define THREAD_FLAG_WAITING 0x40000000
|
||||
#define THREAD_FLAG_RUNNING 0x20000000
|
||||
#define THREAD_FLAG_USER 0x1fffffff
|
||||
|
||||
#define CAP_PAGE_MAP 1
|
||||
#define CAP_PAGE_COPY 2
|
||||
#define CAP_PAGE_MOVE 3
|
||||
#define CAP_PAGE_GET_FLAGS 4
|
||||
#define CAP_PAGE_SET_FLAGS 5
|
||||
#define CAP_PAGE_SHARE 1
|
||||
#define CAP_PAGE_FLAGS 2
|
||||
/* Not an operation; a capability without this bit cannot write to the page. */
|
||||
#define CAP_PAGE_WRITE 6
|
||||
#define CAP_PAGE_WRITE 3
|
||||
#define CAP_PAGE_ALL_RIGHTS 0x1ff
|
||||
|
||||
/* Operation details for PAGE_SHARE */
|
||||
/* Forget the source page during the operation. This makes it a move. */
|
||||
#define PAGE_SHARE_FORGET 0x10000
|
||||
/* Make the target unwritable. */
|
||||
#define PAGE_SHARE_READONLY 0x20000
|
||||
/* Make the target independent of the source (make a copy if needed). */
|
||||
#define PAGE_SHARE_COPY 0x40000
|
||||
|
||||
/* Flag values for Page and Cappage objects. */
|
||||
/* A writable page can be written to. This flag can not be set while the frame is shared. */
|
||||
#define PAGE_FLAG_WRITABLE 1
|
||||
/* When paying, the memory's use is incremented if the page holds a frame. It cannot be lost. Frames are lost when the last payer forgets them. */
|
||||
#define PAGE_FLAG_PAYING 2
|
||||
/* Frames can be moved to this Page if they are not shared; copying will always fail. Sharing a page while this flag is set will fail; moving it will move the flag with it. A page is guaranteed to be unshared when this flag is set. Trying to set this flag on a shared page has no effect. */
|
||||
#define PAGE_FLAG_NOSHARE 4
|
||||
/* Set if this page has a frame associated with it. This flag is automatically reset if the frame is lost because of payment problems. */
|
||||
#define PAGE_FLAG_FRAME 4
|
||||
/* This is a read-only flag, which is set if the Page is shared. */
|
||||
#define PAGE_FLAG_SHARED 8
|
||||
|
||||
#define CAP_CAPABILITY_GET 1
|
||||
#define CAP_CAPABILITY_SET_DEATH_NOTIFY 2
|
||||
#define CAP_CAPABILITY_ALL_RIGHTS 0x1ff
|
||||
|
||||
#define CAPPAGE_SIZE 102
|
||||
/* Cappage has page's operations as well. */
|
||||
#define CAP_CAPPAGE_SET 7
|
||||
/* Cappage has Page's operations as well. */
|
||||
#define CAP_CAPPAGE_SET 4
|
||||
#define CAP_CAPPAGE_ALL_RIGHTS 0x1ff
|
||||
|
||||
#ifndef __KERNEL
|
||||
typedef unsigned __Capability;
|
||||
typedef unsigned Capability;
|
||||
|
||||
extern __Capability __my_receiver;
|
||||
extern __Capability __my_thread;
|
||||
extern __Capability __my_memory;
|
||||
extern __Capability __my_call;
|
||||
extern Capability my_receiver;
|
||||
extern Capability my_thread;
|
||||
extern Capability my_memory;
|
||||
extern Capability my_call;
|
||||
|
||||
__Capability __cap_copy (__Capability src)
|
||||
Capability cap_copy (Capability src)
|
||||
{
|
||||
return src | 2;
|
||||
}
|
||||
|
||||
typedef struct __Message
|
||||
typedef struct Message
|
||||
{
|
||||
unsigned data[4];
|
||||
__Capability cap[4];
|
||||
} __Message;
|
||||
Capability cap[4];
|
||||
} Message;
|
||||
|
||||
static int __invoke (__Capability target, __Message *msg)
|
||||
static int invoke (Capability target, Message *msg)
|
||||
{
|
||||
register int ret __asm__ ("v0");
|
||||
register unsigned v0 __asm__ ("v0") = target;
|
||||
@@ -119,7 +129,7 @@ static int __invoke (__Capability target, __Message *msg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __call (__Capability target, __Message *msg)
|
||||
static int call (Capability target, Message *msg)
|
||||
{
|
||||
register int ret __asm__ ("v0");
|
||||
register unsigned v0 __asm__ ("v0") = target;
|
||||
@@ -143,242 +153,302 @@ static int __call (__Capability target, __Message *msg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __invoke_01 (__Capability t, unsigned d)
|
||||
static int invoke_01 (Capability t, unsigned d)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.data[0] = d;
|
||||
return __invoke (t, &msg);
|
||||
return invoke (t, &msg);
|
||||
}
|
||||
|
||||
static int __invoke_02 (__Capability t, unsigned d0, unsigned d1)
|
||||
static int invoke_02 (Capability t, unsigned d0, unsigned d1)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
return __invoke (t, &msg);
|
||||
return invoke (t, &msg);
|
||||
}
|
||||
|
||||
static int __invoke_04 (__Capability t, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
|
||||
static int invoke_04 (Capability t, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
msg.data[2] = d2;
|
||||
msg.data[3] = d3;
|
||||
return __invoke (t, &msg);
|
||||
return invoke (t, &msg);
|
||||
}
|
||||
|
||||
static int __invoke_11 (__Capability t, __Capability c, unsigned d)
|
||||
static int invoke_11 (Capability t, Capability c, unsigned d)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d;
|
||||
return __invoke (t, &msg);
|
||||
return invoke (t, &msg);
|
||||
}
|
||||
|
||||
static int __invoke_12 (__Capability t, __Capability c, unsigned d0, unsigned d1)
|
||||
static int invoke_12 (Capability t, Capability c, unsigned d0, unsigned d1)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
return __invoke (t, &msg);
|
||||
return invoke (t, &msg);
|
||||
}
|
||||
|
||||
static __Capability __call_c01 (__Capability c, unsigned d)
|
||||
static Capability call_c01 (Capability c, unsigned d)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d;
|
||||
ret = __call (__my_call, &msg);
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.cap[0] : 0;
|
||||
}
|
||||
|
||||
static __Capability __call_c02 (__Capability c, unsigned d0, unsigned d1)
|
||||
static Capability call_c02 (Capability c, unsigned d0, unsigned d1)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
ret = __call (__my_call, &msg);
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.cap[0] : 0;
|
||||
}
|
||||
|
||||
static unsigned __call_n02 (__Capability c, unsigned d0, unsigned d1)
|
||||
static Capability call_c12 (Capability c, Capability c1, unsigned d0, unsigned d1)
|
||||
{
|
||||
__Message msg;
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.cap[1] = c1;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
ret = __call (__my_call, &msg);
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.cap[0] : 0;
|
||||
}
|
||||
|
||||
static unsigned call_n01 (Capability c, unsigned d)
|
||||
{
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d;
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.data[0] : 0;
|
||||
}
|
||||
|
||||
static __Capability __degrade (__Capability src, unsigned mask)
|
||||
static unsigned call_n02 (Capability c, unsigned d0, unsigned d1)
|
||||
{
|
||||
return __call_c02 (src, CAP_DEGRADE, mask);
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.data[0] : 0;
|
||||
}
|
||||
|
||||
static void __schedule ()
|
||||
static unsigned call_n03 (Capability c, unsigned d0, unsigned d1, unsigned d2)
|
||||
{
|
||||
__invoke_01 (__my_thread, CAP_THREAD_SCHEDULE);
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
msg.data[2] = d2;
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.data[0] : 0;
|
||||
}
|
||||
|
||||
static void __register_interrupt (unsigned num)
|
||||
static unsigned call_n04 (Capability c, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
|
||||
{
|
||||
__invoke_12 (__my_thread, __my_receiver, CAP_THREAD_REGISTER_INTERRUPT, num);
|
||||
Message msg;
|
||||
int ret;
|
||||
msg.cap[0] = c;
|
||||
msg.data[0] = d0;
|
||||
msg.data[1] = d1;
|
||||
msg.data[2] = d2;
|
||||
msg.data[3] = d3;
|
||||
ret = call (my_call, &msg);
|
||||
return ret ? msg.data[0] : 0;
|
||||
}
|
||||
|
||||
static __Capability __get_top_memory ()
|
||||
static Capability degrade (Capability src, unsigned mask)
|
||||
{
|
||||
return __call_c01 (__my_thread, CAP_THREAD_GET_TOP_MEMORY);
|
||||
return call_c02 (src, CAP_DEGRADE, mask);
|
||||
}
|
||||
|
||||
static void __unregister_interrupt (unsigned num)
|
||||
static void schedule ()
|
||||
{
|
||||
__invoke_02 (__my_thread, CAP_THREAD_REGISTER_INTERRUPT, num);
|
||||
invoke_01 (my_thread, CAP_THREAD_SCHEDULE);
|
||||
}
|
||||
|
||||
static int __receiver_set_owner (__Capability receiver, __Capability owner)
|
||||
static void register_interrupt (unsigned num)
|
||||
{
|
||||
return __invoke_11 (receiver, owner, CAP_RECEIVER_SET_OWNER);
|
||||
invoke_12 (my_thread, my_receiver, CAP_THREAD_REGISTER_INTERRUPT, num);
|
||||
}
|
||||
|
||||
static __Capability __receiver_create_capability (__Capability receiver, unsigned protected_data)
|
||||
static Capability get_top_memory ()
|
||||
{
|
||||
return __call_c02 (receiver, CAP_RECEIVER_CREATE_CAPABILITY, protected_data);
|
||||
return call_c01 (my_thread, CAP_THREAD_GET_TOP_MEMORY);
|
||||
}
|
||||
|
||||
static __Capability __receiver_create_call_capability (__Capability receiver, unsigned protected_data)
|
||||
static void unregister_interrupt (unsigned num)
|
||||
{
|
||||
return __call_c02 (receiver, CAP_RECEIVER_CREATE_CALL_CAPABILITY, protected_data);
|
||||
invoke_02 (my_thread, CAP_THREAD_REGISTER_INTERRUPT, num);
|
||||
}
|
||||
|
||||
static __Capability __memory_create (__Capability memory, unsigned type)
|
||||
static int receiver_set_owner (Capability receiver, Capability owner)
|
||||
{
|
||||
return __call_c02 (memory, CAP_MEMORY_CREATE, type);
|
||||
return invoke_11 (receiver, owner, CAP_RECEIVER_SET_OWNER);
|
||||
}
|
||||
|
||||
static __Capability __memory_create_page (__Capability memory)
|
||||
static Capability receiver_create_capability (Capability receiver, unsigned protected_data)
|
||||
{
|
||||
return __memory_create (memory, CAPTYPE_PAGE);
|
||||
return call_c02 (receiver, CAP_RECEIVER_CREATE_CAPABILITY, protected_data);
|
||||
}
|
||||
|
||||
static __Capability __memory_create_thread (__Capability memory)
|
||||
static int receiver_get_reply_protected_data (Capability receiver, unsigned data)
|
||||
{
|
||||
return __memory_create (memory, CAPTYPE_THREAD);
|
||||
return call_n01 (receiver, CAP_RECEIVER_GET_REPLY_PROTECTED_DATA);
|
||||
}
|
||||
|
||||
static __Capability __memory_create_receiver (__Capability memory)
|
||||
static int receiver_set_reply_protected_data (Capability receiver, unsigned data)
|
||||
{
|
||||
return __memory_create (memory, CAPTYPE_RECEIVER);
|
||||
return invoke_02 (receiver, CAP_RECEIVER_SET_REPLY_PROTECTED_DATA, data);
|
||||
}
|
||||
|
||||
static __Capability __memory_create_memory (__Capability memory)
|
||||
static Capability receiver_create_call_capability (Capability receiver)
|
||||
{
|
||||
return __memory_create (memory, CAPTYPE_MEMORY);
|
||||
return call_c02 (receiver, CAP_RECEIVER_CREATE_CALL_CAPABILITY, 0);
|
||||
}
|
||||
|
||||
static __Capability __memory_create_cappage (__Capability memory)
|
||||
static Capability receiver_create_async_call_capability (Capability receiver)
|
||||
{
|
||||
return __memory_create (memory, CAPTYPE_CAPPAGE);
|
||||
return call_c02 (receiver, CAP_RECEIVER_CREATE_CALL_CAPABILITY, 1);
|
||||
}
|
||||
|
||||
static int __memory_destroy (__Capability memory, __Capability target)
|
||||
static Capability memory_create (Capability memory, unsigned type)
|
||||
{
|
||||
return __invoke_11 (memory, target, CAP_MEMORY_DESTROY);
|
||||
return call_c02 (memory, CAP_MEMORY_CREATE, type);
|
||||
}
|
||||
|
||||
static Capability memory_create_page (Capability memory)
|
||||
{
|
||||
return memory_create (memory, CAPTYPE_PAGE);
|
||||
}
|
||||
|
||||
static Capability memory_create_thread (Capability memory)
|
||||
{
|
||||
return memory_create (memory, CAPTYPE_THREAD);
|
||||
}
|
||||
|
||||
static Capability memory_create_receiver (Capability memory)
|
||||
{
|
||||
return memory_create (memory, CAPTYPE_RECEIVER);
|
||||
}
|
||||
|
||||
static Capability memory_create_memory (Capability memory)
|
||||
{
|
||||
return memory_create (memory, CAPTYPE_MEMORY);
|
||||
}
|
||||
|
||||
static Capability memory_create_cappage (Capability memory)
|
||||
{
|
||||
return memory_create (memory, CAPTYPE_CAPPAGE);
|
||||
}
|
||||
|
||||
static int memory_destroy (Capability memory, Capability target)
|
||||
{
|
||||
return invoke_11 (memory, target, CAP_MEMORY_DESTROY);
|
||||
}
|
||||
|
||||
/* TODO: #define CAP_MEMORY_LIST 3 */
|
||||
|
||||
static __Capability __memory_mapping (__Capability memory, unsigned address)
|
||||
static int memory_map (Capability memory, Capability page, unsigned address)
|
||||
{
|
||||
return __call_c02 (memory, CAP_MEMORY_MAPPING, address);
|
||||
return invoke_12 (memory, page, CAP_MEMORY_MAP, address);
|
||||
}
|
||||
|
||||
static void __drop (__Capability cap)
|
||||
static Capability memory_mapping (Capability memory, unsigned address)
|
||||
{
|
||||
__invoke_11 (__my_memory, cap, CAP_MEMORY_DROP);
|
||||
return call_c02 (memory, CAP_MEMORY_MAPPING, address);
|
||||
}
|
||||
|
||||
static int __thread_set_info (__Capability thread, unsigned info, unsigned value, unsigned mask)
|
||||
static void drop (Capability cap)
|
||||
{
|
||||
return __invoke_04 (thread, CAP_THREAD_SET_INFO, info, value, mask);
|
||||
invoke_11 (my_memory, cap, CAP_MEMORY_DROP);
|
||||
}
|
||||
|
||||
static int __thread_set_pc (__Capability thread, unsigned pc)
|
||||
static Capability thread_make_priv (Capability thread)
|
||||
{
|
||||
return __thread_set_info (thread, CAP_THREAD_INFO_PC, pc, ~0);
|
||||
return call_c12 (my_thread, thread, CAP_THREAD_MAKE_PRIV, ~0);
|
||||
}
|
||||
|
||||
static int __thread_set_sp (__Capability thread, unsigned sp)
|
||||
static unsigned thread_info (Capability thread, unsigned info, unsigned value, unsigned mask)
|
||||
{
|
||||
return __thread_set_info (thread, CAP_THREAD_INFO_SP, sp, ~0);
|
||||
return call_n04 (thread, CAP_THREAD_INFO, info, value, mask);
|
||||
}
|
||||
|
||||
static int __thread_set_flags (__Capability thread, unsigned value, unsigned mask)
|
||||
static unsigned thread_set_pc (Capability thread, unsigned pc)
|
||||
{
|
||||
return __thread_set_info (thread, CAP_THREAD_INFO_FLAGS, value, mask);
|
||||
return thread_info (thread, CAP_THREAD_INFO_PC, pc, ~0);
|
||||
}
|
||||
|
||||
static int __thread_run (__Capability thread, int run)
|
||||
static unsigned thread_set_sp (Capability thread, unsigned sp)
|
||||
{
|
||||
return __thread_set_flags (thread, run ? THREAD_FLAG_RUNNING : 0, THREAD_FLAG_RUNNING);
|
||||
return thread_info (thread, CAP_THREAD_INFO_SP, sp, ~0);
|
||||
}
|
||||
|
||||
static int __thread_wait (__Capability thread, int wait)
|
||||
static unsigned thread_flags (Capability thread, unsigned value, unsigned mask)
|
||||
{
|
||||
return __thread_set_flags (thread, wait ? THREAD_FLAG_WAITING : 0, THREAD_FLAG_WAITING);
|
||||
return thread_info (thread, CAP_THREAD_INFO_FLAGS, value, mask);
|
||||
}
|
||||
|
||||
static unsigned __thread_get_info (__Capability thread, unsigned info)
|
||||
static unsigned thread_run (Capability thread, int run)
|
||||
{
|
||||
return __call_n02 (thread, CAP_THREAD_GET_INFO, info);
|
||||
return thread_flags (thread, run ? THREAD_FLAG_RUNNING : 0, THREAD_FLAG_RUNNING);
|
||||
}
|
||||
|
||||
static unsigned __thread_get_pc (__Capability thread)
|
||||
static unsigned thread_wait (Capability thread, int wait)
|
||||
{
|
||||
return __thread_get_info (thread, CAP_THREAD_INFO_PC);
|
||||
return thread_flags (thread, wait ? THREAD_FLAG_WAITING : 0, THREAD_FLAG_WAITING);
|
||||
}
|
||||
|
||||
static unsigned __thread_get_sp (__Capability thread)
|
||||
static unsigned thread_get_pc (Capability thread)
|
||||
{
|
||||
return __thread_get_info (thread, CAP_THREAD_INFO_SP);
|
||||
return thread_info (thread, CAP_THREAD_INFO_PC, 0, 0);
|
||||
}
|
||||
|
||||
static unsigned __thread_get_flags (__Capability thread)
|
||||
static unsigned thread_get_sp (Capability thread)
|
||||
{
|
||||
return __thread_get_info (thread, CAP_THREAD_INFO_FLAGS);
|
||||
return thread_info (thread, CAP_THREAD_INFO_SP, 0, 0);
|
||||
}
|
||||
|
||||
/* TODO. All except map should also work for cappages.
|
||||
#define CAP_PAGE_MAP 1
|
||||
#define CAP_PAGE_SHARE 2
|
||||
#define CAP_PAGE_SHARE_COW 3
|
||||
#define CAP_PAGE_FORGET 4
|
||||
*/
|
||||
|
||||
static __Capability __capability_get (__Capability cap)
|
||||
static int page_share (Capability page, Capability target, unsigned flags)
|
||||
{
|
||||
return __call_c01 (cap, CAP_CAPABILITY_GET);
|
||||
return invoke_12 (page, target, CAP_PAGE_SHARE, flags);
|
||||
}
|
||||
|
||||
static int __capability_set_death_notify (__Capability source, __Capability target)
|
||||
static unsigned page_flags (Capability page, unsigned new_flags, unsigned mask)
|
||||
{
|
||||
return __invoke_11 (source, target, CAP_CAPABILITY_SET_DEATH_NOTIFY);
|
||||
return call_n03 (page, CAP_PAGE_FLAGS, new_flags, mask);
|
||||
}
|
||||
|
||||
static int __capability_cappage_set (__Capability page, __Capability cap, unsigned index)
|
||||
static Capability capability_get (Capability cap)
|
||||
{
|
||||
return __invoke_12 (page, cap, CAP_CAPPAGE_SET, index);
|
||||
return call_c01 (cap, CAP_CAPABILITY_GET);
|
||||
}
|
||||
|
||||
static int cappage_set (Capability page, Capability cap, unsigned index)
|
||||
{
|
||||
return invoke_12 (page, cap, CAP_CAPPAGE_SET, index);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user