L4Re - L4 Runtime Environment
memdesc.h
Go to the documentation of this file.
1 
6 /*
7  * (c) 2007-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>
9  * economic rights: Technische Universit├Ąt Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction. Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License. This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24 #ifndef __L4SYS__MEMDESC_H__
25 #define __L4SYS__MEMDESC_H__
26 
27 #include <l4/sys/kip.h>
28 
45 {
51 
55 };
56 
62 {
64 };
65 
66 
75 {
77  l4_umword_t l;
79  l4_umword_t h;
81 
82 
87 L4_INLINE
90 
97 L4_INLINE
98 unsigned
100 
112 L4_INLINE
113 void
115  l4_addr_t start,
116  l4_addr_t end,
117  unsigned type,
118  unsigned virt,
119  unsigned sub_type) L4_NOTHROW;
120 
127 L4_INLINE
130 
137 L4_INLINE
140 
147 L4_INLINE
150 
160 L4_INLINE
163 
170 L4_INLINE
173 
174 /*************************************************************************
175  * Implementations
176  *************************************************************************/
177 
178 L4_INLINE
181 {
182  return (l4_kernel_info_mem_desc_t *)(((l4_addr_t)kip)
183  + (kip->mem_info >> (sizeof(l4_umword_t) * 4)));
184 }
185 
186 L4_INLINE
187 unsigned
189 {
190  return kip->mem_info & ((1UL << (sizeof(l4_umword_t)*4)) -1);
191 }
192 
193 L4_INLINE
194 void
196  l4_addr_t start,
197  l4_addr_t end,
198  unsigned type,
199  unsigned virt,
200  unsigned sub_type) L4_NOTHROW
201 {
202  md->l = (start & ~0x3ffUL) | (type & 0x0f) | ((sub_type << 4) & 0x0f0)
203  | (virt ? 0x200 : 0x0);
204  md->h = end;
205 }
206 
207 
208 L4_INLINE
211 {
212  return md->l & ~0x3ffUL;
213 }
214 
215 L4_INLINE
218 {
219  return md->h | 0x3ffUL;
220 }
221 
222 L4_INLINE
225 {
226  return md->l & 0xf;
227 }
228 
229 L4_INLINE
232 {
233  return (md->l & 0xf0) >> 4;
234 }
235 
236 L4_INLINE
239 {
240  return md->l & 0x200;
241 }
242 
243 #endif /* ! __L4SYS__MEMDESC_H__ */
struct l4_kernel_info_mem_desc_t l4_kernel_info_mem_desc_t
Memory descriptor data structure.
l4_kernel_info_mem_desc_t * l4_kernel_info_get_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
Get pointer to memory descriptors from KIP.
Definition: memdesc.h:180
unsigned l4_kernel_info_get_num_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
Get number of memory descriptors in KIP.
Definition: memdesc.h:188
Conventional memory.
Definition: memdesc.h:47
void l4_kernel_info_set_mem_desc(l4_kernel_info_mem_desc_t *md, l4_addr_t start, l4_addr_t end, unsigned type, unsigned virt, unsigned sub_type) L4_NOTHROW
Populate a memory descriptor.
Definition: memdesc.h:195
l4_umword_t mem_info
memory information
Definition: __kip-32bit.h:81
l4_umword_t l4_kernel_info_get_mem_desc_is_virtual(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get virtual flag of the memory descriptor.
Definition: memdesc.h:238
l4_umword_t l4_kernel_info_get_mem_desc_start(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get start address of the region described by the memory descriptor.
Definition: memdesc.h:210
L4 Kernel Interface Page.
Definition: __kip-32bit.h:38
l4_mem_type_t
Type of a memory descriptor.
Definition: memdesc.h:44
Memory descriptor data structure.
Definition: memdesc.h:74
l4_umword_t l4_kernel_info_get_mem_desc_subtype(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get sub-type of memory region.
Definition: memdesc.h:231
l4_umword_t l4_kernel_info_get_mem_desc_end(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get end address of the region described by the memory descriptor.
Definition: memdesc.h:217
Architecture specific memory (e.g., ACPI memory)
Definition: memdesc.h:54
Undefined, unused descriptor.
Definition: memdesc.h:46
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
Kernel Info Page access functions.
l4_umword_t l4_kernel_info_get_mem_desc_type(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get type of the memory region.
Definition: memdesc.h:224
Shared memory (not implemented)
Definition: memdesc.h:50
l4_mem_info_sub_type_t
Memory sub types for l4_mem_type_info descriptors.
Definition: memdesc.h:61
Physical address of the ACPI root pointer.
Definition: memdesc.h:63
Info from the boot loader.
Definition: memdesc.h:52
Memory owned by the boot loader.
Definition: memdesc.h:53
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
Dedicated memory (some device memory)
Definition: memdesc.h:49
Reserved memory for kernel etc.
Definition: memdesc.h:48
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185