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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [baremetal/] [test_suite/] [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/capability/cap_print.h>
8
#include <l4lib/macros.h>
9
#include L4LIB_INC_ARCH(syscalls.h)
10
 
11
static struct capability cap_array[30];
12
 
13
#if 0
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
#endif
79
 
80
int caps_read_all(void)
81
{
82
        int ncaps;
83
        int err;
84
 
85
        /* Read number of capabilities */
86
        if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
87
                                         0, &ncaps)) < 0) {
88
                printf("l4_capability_control() reading # of"
89
                       " capabilities failed.\n Could not "
90
                       "complete CAP_CONTROL_NCAPS request.\n");
91
                BUG();
92
        }
93
 
94
        /* Read all capabilities */
95
        if ((err = l4_capability_control(CAP_CONTROL_READ,
96
                                         0, cap_array)) < 0) {
97
                printf("l4_capability resource_control() reading of "
98
                       "capabilities failed.\n Could not "
99
                       "complete CAP_CONTROL_READ_CAPS request.\n");
100
                BUG();
101
        }
102
        //cap_array_print(ncaps, caparray);
103
 
104
        return 0;
105
}
106
 

powered by: WebSVN 2.1.0

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