24 |
#endif |
#endif |
25 |
|
|
26 |
|
|
27 |
/* Nothing yet. */ |
/* IO Fpages. */ |
28 |
|
|
29 |
|
typedef _L4_RAW |
30 |
|
(l4_word_t, _L4_STRUCT1 |
31 |
|
({ |
32 |
|
_L4_BITFIELD4 |
33 |
|
(l4_word_t, |
34 |
|
_L4_BITFIELD (rights, 4), |
35 |
|
_L4_BITFIELD (_two, 2), |
36 |
|
_L4_BITFIELD (log2_size, 6), |
37 |
|
_L4_BITFIELD_32_64 (base, 16, 48)); |
38 |
|
})) l4_io_fpage_t; |
39 |
|
|
40 |
|
|
41 |
|
static inline l4_fpage_t |
42 |
|
__attribute__((__always_inline__)) |
43 |
|
l4_io_fpage (l4_word_t base_address, int size) |
44 |
|
{ |
45 |
|
l4_fpage_t fpage; |
46 |
|
l4_io_fpage_t io_fpage; |
47 |
|
l4_word_t msb = __l4_msb (size); |
48 |
|
|
49 |
|
io_fpage.rights = 0; |
50 |
|
io_fpage._two = 2; |
51 |
|
io_fpage.log2_size = (1 << msb) == size ? msb : msb + 1; |
52 |
|
io_fpage.base = base_address; |
53 |
|
fpage.raw = io_fpage.raw; |
54 |
|
return fpage; |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
static inline l4_fpage_t |
59 |
|
__attribute__((__always_inline__)) |
60 |
|
l4_io_fpage_log2 (l4_word_t base_address, int log2_size) |
61 |
|
{ |
62 |
|
l4_fpage_t fpage; |
63 |
|
l4_io_fpage_t io_fpage; |
64 |
|
|
65 |
|
io_fpage.rights = 0; |
66 |
|
io_fpage._two = 2; |
67 |
|
io_fpage.log2_size = log2_size; |
68 |
|
io_fpage.base = base_address; |
69 |
|
fpage.raw = io_fpage.raw; |
70 |
|
return fpage; |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
/* l4_space_control control argument. */ |
75 |
|
|
76 |
|
#define L4_LARGE_SPACE 0 |
77 |
|
#define L4_SMALL_SPACE (1 << 31) |
78 |
|
|
79 |
|
|
80 |
|
/* LOC and SIZE are in MB. */ |
81 |
|
static inline l4_word_t |
82 |
|
__attribute__((__always_inline__)) |
83 |
|
l4_small_space (l4_word_t loc, l4_word_t size) |
84 |
|
{ |
85 |
|
l4_word_t small_space = loc >> 1; /* Divide by 2 (MB). */ |
86 |
|
l4_word_t two_pow_p = size >> 2; /* Divide by 4 (MB). */ |
87 |
|
|
88 |
|
/* Make P the LSB of small_space. */ |
89 |
|
small_space = (small_space & ~(two_pow_p - 1)) | two_pow_p; |
90 |
|
return small_space & 0xff; |
91 |
|
} |