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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [generic/] [container.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Definitions for Codezero Containers
3
 *
4
 * Copyright (C) 2009 Bahadir Balban
5
 */
6
#ifndef __CONTAINER_H__
7
#define __CONTAINER_H__
8
 
9
#include <l4/generic/scheduler.h>
10
#include <l4/generic/space.h>
11
#include <l4/generic/capability.h>
12
#include <l4/generic/resource.h>
13
#include <l4/generic/tcb.h>
14
#include <l4/lib/idpool.h>
15
#include <l4/api/mutex.h>
16
#include <l4/lib/list.h>
17
#include <l4/lib/idpool.h>
18
 
19
#define curcont                 (current->container)
20
 
21
#define CONFIG_CONTAINER_NAMESIZE               64
22
#define CONFIG_MAX_CAPS_USED                    16
23
#define CONFIG_MAX_PAGERS_USED                  1
24
 
25
/* Container macro. No locks needed! */
26
 
27
struct pager {
28
        struct ktcb *tcb;
29
        unsigned long start_lma;
30
        unsigned long start_vma;
31
        unsigned long start_address;
32
        unsigned long stack_address;
33
        unsigned long memsize;
34
        struct cap_list cap_list;
35
 
36
        /*
37
         * Section markings,
38
         * We dont care for other types of sections,
39
         * RO will be included inside RX.
40
         */
41
        unsigned long rw_sections_start;
42
        unsigned long rw_sections_end;
43
        unsigned long rx_sections_start;
44
        unsigned long rx_sections_end;
45
};
46
 
47
 
48
struct container {
49
        l4id_t cid;                             /* Unique container id */
50
        int npagers;                            /* # of pagers */
51
        struct link list;                       /* List ref for containers */
52
        struct address_space_list space_list;   /* List of address spaces */
53
        char name[CONFIG_CONTAINER_NAMESIZE];   /* Name of container */
54
        struct ktcb_list ktcb_list;             /* List of threads */
55
        struct link pager_list;                 /* List of pagers */
56
 
57
        struct id_pool *thread_id_pool;         /* Id pools for thread/spaces */
58
        struct id_pool *space_id_pool;
59
 
60
        struct mutex_queue_head mutex_queue_head; /* Userspace mutex list */
61
        struct cap_list cap_list;               /* Capabilities shared by whole container */
62
        struct pager *pager;                    /* Boot-time array of pagers */
63
};
64
 
65
/* Compact, raw capability structure */
66
struct cap_info {
67
        l4id_t target;
68
        unsigned int type;
69
        u32 access;
70
        unsigned long start;
71
        unsigned long end;
72
        unsigned long size;
73
        unsigned int attr;      /* Attributes (like device types) */
74
        l4id_t irq;
75
};
76
 
77
 
78
struct pager_info {
79
        unsigned long pager_lma;
80
        unsigned long pager_vma;
81
        unsigned long pager_size;
82
        unsigned long start_address;
83
        unsigned long stack_address;
84
 
85
        /*
86
         * Section markings,
87
         * We dont care for other types of sections,
88
         * RO will be included inside RX.
89
         */
90
        unsigned long rw_sections_start;
91
        unsigned long rw_sections_end;
92
        unsigned long rx_sections_start;
93
        unsigned long rx_sections_end;
94
 
95
        /* Number of capabilities defined */
96
        int ncaps;
97
 
98
        /*
99
         * Zero or more ipc caps,
100
         * One or more thread pool caps,
101
         * One or more space pool caps,
102
         * One or more exregs caps,
103
         * One or more tcontrol caps,
104
         * One or more cputime caps,
105
         * One or more physmem caps,
106
         * One or more virtmem caps,
107
         * Zero or more umutex caps,
108
         */
109
        struct cap_info caps[CONFIG_MAX_CAPS_USED];
110
};
111
 
112
/*
113
 * This auto-generated structure is
114
 * used to create run-time containers
115
 */
116
struct container_info {
117
        char name[CONFIG_CONTAINER_NAMESIZE];
118
        int npagers;
119
        struct pager_info pager[CONFIG_MAX_PAGERS_USED];
120
};
121
 
122
extern struct container_info cinfo[];
123
 
124
void kres_insert_container(struct container *c,
125
                            struct kernel_resources *kres);
126
 
127
struct container *container_create(void);
128
 
129
int container_init_pagers(struct kernel_resources *kres);
130
 
131
int init_containers(struct kernel_resources *kres);
132
struct container *container_find(struct kernel_resources *kres, l4id_t cid);
133
 
134
#endif /* __CONTAINER_H__ */
135
 

powered by: WebSVN 2.1.0

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