mirror of
https://github.com/drasko/codezero.git
synced 2026-01-18 13:53:16 +01:00
Some capability checking progress
This commit is contained in:
@@ -5,10 +5,8 @@
|
||||
#include <l4/generic/capability.h>
|
||||
#include <l4/generic/cap-types.h>
|
||||
|
||||
void print_capability(struct capability *cap);
|
||||
|
||||
int read_pager_capabilities();
|
||||
|
||||
void capability_print(struct capability *cap);
|
||||
|
||||
int caps_read_all();
|
||||
|
||||
#endif /* __CAPABILITY_H__ */
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Main function for all tests
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#include <l4/api/errno.h>
|
||||
#include <container.h>
|
||||
@@ -9,7 +11,6 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
printf("%s: Container %s started\n",
|
||||
__CONTAINER__, __CONTAINER_NAME__);
|
||||
|
||||
|
||||
@@ -1,11 +1,80 @@
|
||||
/*
|
||||
* Capability-related userspace helpers
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#include <capability.h>
|
||||
#include <stdio.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
|
||||
static struct capability cap_array[30];
|
||||
static int total_caps;
|
||||
|
||||
void print_capability(struct capability *cap)
|
||||
struct cap_group {
|
||||
struct cap_list virtmem;
|
||||
struct cap_list physmem;
|
||||
struct cap_list threadpool;
|
||||
struct cap_list tctrl;
|
||||
struct cap_list exregs;
|
||||
struct cap_list ipc;
|
||||
struct cap_list mutex;
|
||||
struct cap_list sched;
|
||||
struct cap_list mutexpool;
|
||||
struct cap_list spacepool;
|
||||
struct cap_list cappool;
|
||||
};
|
||||
|
||||
static inline struct capability *cap_get_thread()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_space()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_ipc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_virtmem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_physmem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_physmem(unsigned long phys)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_virtmem(unsigned long virt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline struct capability *cap_get_byid(l4id_t id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cap_share_single(struct capability *orig, struct capability *share, l4id_t target, unsigned int flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void cap_grant_single(struct capability *orig, struct capability *share, l4id_t target, unsigned int flags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void cap_print(struct capability *cap)
|
||||
{
|
||||
printf("Capability id:\t\t\t%d\n", cap->capid);
|
||||
printf("Capability resource id:\t\t%d\n", cap->resid);
|
||||
@@ -82,7 +151,7 @@ void print_capability(struct capability *cap)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int read_pager_capabilities()
|
||||
int cap_read_all(void)
|
||||
{
|
||||
int ncaps;
|
||||
int err;
|
||||
@@ -95,7 +164,6 @@ int read_pager_capabilities()
|
||||
"complete CAP_CONTROL_NCAPS request.\n");
|
||||
BUG();
|
||||
}
|
||||
total_caps = ncaps;
|
||||
|
||||
/* Read all capabilities */
|
||||
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
||||
@@ -106,8 +174,8 @@ int read_pager_capabilities()
|
||||
BUG();
|
||||
}
|
||||
|
||||
for (int i = 0; i < total_caps; i++)
|
||||
print_capability(&cap_array[i]);
|
||||
for (int i = 0; i < ncaps; i++)
|
||||
cap_print(&cap_array[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ int capability_test(void)
|
||||
int TEST_MUST_SUCCEED = 1;
|
||||
|
||||
/* Read pager capabilities */
|
||||
read_pager_capabilities();
|
||||
caps_read_all();
|
||||
|
||||
/*
|
||||
* Create new thread that will attempt
|
||||
|
||||
Reference in New Issue
Block a user