2 * Copyright (c) 2009, 2010, 2012, 2015, 2016, ETH Zurich.
3 * Copyright (c) 2015, 2016 Hewlett Packard Enterprise Development LP.
6 * This file is distributed under the terms in the attached LICENSE file.
7 * If you do not find this file, copies can be found by writing to:
8 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
14 This file defines the Barrelfish capability type system.
16 (Meta-)Comments about the syntax are enclosed between /** ... **/
17 Comments of the Hamlet language are enclosed between /* ... */
20 /** We can define some constants using the "define" construct **/
22 /* XXX: these must match the corresponding OBJBITS definitions in
23 * barrelfish_kpi/capabilities.h */
25 /* Size of L2 CNode: L2 resolves 8 bits of Cap address space */
26 define objsize_l2cnode 16384;
28 define objsize_dispatcher 1024;
29 /* Size of (x86_64) VNode: */
30 define objsize_vnode 4096; /* BASE_PAGE_SIZE */
31 /* Size of ARMv7 VNodes */
32 define objsize_vnode_arm_l1 16384;
33 define objsize_vnode_arm_l2 1024;
34 /* size of a kernel control block */
35 define objsize_kcb 65536; /* OBJSIZE_KCB */
38 The capabilities of the whole system are listed thereafter.
39 The minimal definition consists of a name and an empty body.
42 cap Null is_never_copy {
43 /* Null/invalid object type */
48 For a populated cap, we need to give the type and name of each
49 of its fields, such as:
50 "genpaddr base;" for instance
52 In order to implement various comparisons, we need to specify a address
53 and size for each type that is backed by memory. The size may be
54 specified directly with "size" or as "size_bits".
56 Additional equality fields can be specified with an "eq" prefix, as in
60 address genpaddr base; /* Physical base address of Memory object */
61 pasid pasid; /* Physical Address Space ID */
62 size gensize bytes; /* Size of region in bytes */
67 /* Physical address range (root of cap tree) */
68 cap PhysAddr from_self inherit Memory;
70 cap Mapping abstract {
71 "struct capability" cap;
76 address { get_address(cap) };
80 address genpaddr base; /* Base address of VNode */
81 size { objsize_vnode };
84 /** The following caps are similar to the previous one **/
86 /* RAM memory object */
87 cap RAM from PhysAddr from_self inherit Memory;
89 /* Abstract CNode, need to define size */
91 address lpaddr cnode; /* Base address of CNode */
92 caprights rightsmask; /* Cap access rights */
95 /* Level 1 CNode table, resizable */
96 cap L1CNode from RAM inherit CNode {
97 size gensize allocated_bytes; /* Allocated size of L1 CNode in bytes */
100 /* Level 2 CNode table, resolves 8 bits of cap address */
101 cap L2CNode from RAM inherit CNode {
102 size { objsize_l2cnode }; /* Size of L2 CNode in bytes (16kB) */
106 /* Foreign CNode capability */
108 eq genpaddr cnode; /* Base address of CNode */
109 eq uint8 bits; /* Number of bits this CNode resolves */
110 caprights rightsmask;
111 eq coreid core_id; /* The core the cap is local on */
112 uint8 guard_size; /* Number of bits in guard */
113 caddr guard; /* Bitmask already resolved when reaching this CNode */
116 /** Dispatcher is interesting is several ways. **/
119 XXX: The whole multi_retype stuff is hack in hamlet that should be removed as
120 soon as parts of an object can be retyped individually. -MN
123 cap Dispatcher from RAM {
127 The Dispatcher is a special case that can be retyped several
128 times to an end-point
130 /** Note: This must be the first statement */
134 We allow the use of unknow structures. However, equality will
135 be defined by address, not by structure.
137 "struct dcb" dcb; /* Pointer to kernel DCB */
139 address { mem_to_phys(dcb) };
140 size { objsize_dispatcher };
143 cap EndPoint from Dispatcher {
146 "struct dcb" listener; /* Dispatcher listening on this endpoint */
147 lvaddr epoffset; /* Offset of endpoint buffer in disp frame */
148 uint32 epbuflen; /* Length of endpoint buffer in words */
150 address { mem_to_phys(listener) };
153 Preferable definitions for address and size would be as below. These
154 should be used as soon as the whole multi retype hack stuff is fixed:
156 address { mem_to_phys(listener + epoffset) };
163 /** Then, we go back to routine **/
165 cap Frame from RAM from_self inherit Memory;
167 cap Frame_Mapping from Frame inherit Mapping;
169 cap DevFrame from PhysAddr from_self inherit Memory;
171 cap DevFrame_Mapping from DevFrame inherit Mapping;
173 cap Kernel is_always_copy {
174 /* Capability to a kernel */
178 /* x86_64-specific capabilities: */
181 cap VNode_x86_64_pml4 from RAM inherit VNode;
183 cap VNode_x86_64_pml4_Mapping from VNode_x86_64_pml4 inherit Mapping;
186 cap VNode_x86_64_pdpt from RAM inherit VNode;
188 cap VNode_x86_64_pdpt_Mapping from VNode_x86_64_pdpt inherit Mapping;
191 cap VNode_x86_64_pdir from RAM inherit VNode;
193 cap VNode_x86_64_pdir_Mapping from VNode_x86_64_pdir inherit Mapping;
196 cap VNode_x86_64_ptable from RAM inherit VNode;
198 cap VNode_x86_64_ptable_Mapping from VNode_x86_64_ptable inherit Mapping;
201 /* x86_32-specific capabilities: */
204 cap VNode_x86_32_pdpt from RAM inherit VNode;
206 cap VNode_x86_32_pdpt_Mapping from VNode_x86_32_pdpt inherit Mapping;
209 cap VNode_x86_32_pdir from RAM inherit VNode;
211 cap VNode_x86_32_pdir_Mapping from VNode_x86_32_pdir inherit Mapping;
214 cap VNode_x86_32_ptable from RAM inherit VNode;
216 cap VNode_x86_32_ptable_Mapping from VNode_x86_32_ptable inherit Mapping;
218 /* ARM specific capabilities: */
221 cap VNode_ARM_l1 from RAM inherit VNode {
222 size { objsize_vnode_arm_l1 };
225 cap VNode_ARM_l1_Mapping from VNode_ARM_l1 inherit Mapping;
228 cap VNode_ARM_l2 from RAM inherit VNode {
229 size { objsize_vnode_arm_l2 };
232 cap VNode_ARM_l2_Mapping from VNode_ARM_l2 inherit Mapping;
234 /* ARM AArch64-specific capabilities: */
237 cap VNode_AARCH64_l0 from RAM inherit VNode;
239 cap VNode_AARCH64_l0_Mapping from VNode_AARCH64_l0 inherit Mapping;
242 cap VNode_AARCH64_l1 from RAM inherit VNode;
244 cap VNode_AARCH64_l1_Mapping from VNode_AARCH64_l1 inherit Mapping;
247 cap VNode_AARCH64_l2 from RAM inherit VNode;
249 cap VNode_AARCH64_l2_Mapping from VNode_AARCH64_l2 inherit Mapping;
252 cap VNode_AARCH64_l3 from RAM inherit VNode;
254 cap VNode_AARCH64_l3_Mapping from VNode_AARCH64_l3 inherit Mapping;
256 /** IRQTable and IO are slightly different **/
258 cap IRQTable is_always_copy {
259 /* IRQ Routing table */
261 When testing two IRQTable caps for is_copy, we always return True: all
262 IRQ entries originate from a single, primitive Cap. Grand'pa Cap, sort
268 /* IRQ Destination capability.
269 Represents a slot in a CPUs int vector table.
270 Can be connected to a LMP endpoint to recv this interrupt. */
275 cap IRQSrc from_self {
276 /* IRQ Source capability.
277 Represents an interrupt source. It contains a range of interrupt
284 /* Legacy IO capability */
286 eq uint16 end; /* Granted IO range */
289 /* IPI notify caps */
295 /* ID capability, system-wide unique */
297 eq coreid coreid; /* core cap was created */
298 eq uint32 core_local_id; /* per core unique id */
301 cap PerfMon is_always_copy {
304 /** KernelControlBlock represents a struct kcb which contains all the pointers
305 * to core-local global state of the kernel.
307 cap KernelControlBlock from RAM {
310 address { mem_to_phys(kcb) };
311 /* base page size for now so we can map the kcb in boot driver */
312 size { objsize_kcb };
315 cap IPI is_always_copy {};