OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [test_suite0/] [src/] [capability.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Capability-related userspace helpers
3
 *
4
 * Copyright (C) 2009 B Labs Ltd.
5
 */
6
#include <stdio.h>
7
#include <l4lib/lib/cap.h>
8
#include <l4lib/macros.h>
9
#include L4LIB_INC_ARCH(syscalls.h)
10
 
11
#if 0
12
static struct capability cap_array[30];
13
 
14
struct cap_group {
15
        struct cap_list virtmem;
16
        struct cap_list physmem;
17
        struct cap_list threadpool;
18
        struct cap_list tctrl;
19
        struct cap_list exregs;
20
        struct cap_list ipc;
21
        struct cap_list mutex;
22
        struct cap_list sched;
23
        struct cap_list mutexpool;
24
        struct cap_list spacepool;
25
        struct cap_list cappool;
26
};
27
 
28
static inline struct capability *cap_get_thread()
29
{
30
 
31
}
32
 
33
static inline struct capability *cap_get_space()
34
{
35
 
36
}
37
 
38
static inline struct capability *cap_get_ipc()
39
{
40
 
41
}
42
 
43
static inline struct capability *cap_get_virtmem()
44
{
45
 
46
}
47
 
48
static inline struct capability *cap_get_physmem()
49
{
50
 
51
}
52
 
53
static inline struct capability *cap_get_physmem(unsigned long phys)
54
{
55
 
56
}
57
 
58
static inline struct capability *cap_get_virtmem(unsigned long virt)
59
{
60
 
61
}
62
 
63
static inline struct capability *cap_get_byid(l4id_t id)
64
{
65
 
66
}
67
 
68
 
69
void cap_share_single(struct capability *orig, struct capability *share, l4id_t target, unsigned int flags)
70
{
71
 
72
}
73
 
74
void cap_grant_single(struct capability *orig, struct capability *share, l4id_t target, unsigned int flags)
75
{
76
}
77
 
78
 
79
int caps_read_all(void)
80
{
81
        int ncaps;
82
        int err;
83
 
84
        /* Read number of capabilities */
85
        if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
86
                                         0, &ncaps)) < 0) {
87
                printf("l4_capability_control() reading # of"
88
                       " capabilities failed.\n Could not "
89
                       "complete CAP_CONTROL_NCAPS request.\n");
90
                BUG();
91
        }
92
 
93
        /* Read all capabilities */
94
        if ((err = l4_capability_control(CAP_CONTROL_READ,
95
                                         0, cap_array)) < 0) {
96
                printf("l4_capability resource_control() reading of "
97
                       "capabilities failed.\n Could not "
98
                       "complete CAP_CONTROL_READ_CAPS request.\n");
99
                BUG();
100
        }
101
        //cap_array_print(ncaps, caparray);
102
 
103
        return 0;
104
}
105
 
106
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.