1 |
/* t-vregs.c - A test for the interfaces to the L4 message registers. |
/* t-message.c - A test for the interfaces to the L4 message registers. |
2 |
Copyright (C) 2005 Free Software Foundation, Inc. |
Copyright (C) 2005 Free Software Foundation, Inc. |
3 |
Written by Matthieu Lemerre <racin@free.fr> and |
Written by Matthieu Lemerre <racin@free.fr> and |
4 |
Marcus Brinkmann <marcus@gnu.org>. |
Marcus Brinkmann <marcus@gnu.org>. |
35 |
#include <l4/message.h> |
#include <l4/message.h> |
36 |
|
|
37 |
|
|
38 |
|
#define L4_NUM_MRS_OK 64 |
39 |
|
#define L4_NUM_BRS_OK 33 |
40 |
|
|
41 |
|
|
42 |
/* Test the message register MR with value VAL_OK. */ |
/* Test the message register MR with value VAL_OK. */ |
43 |
void |
void |
44 |
test_one_mr (int mr, _L4_word_t val_ok) |
test_one_mr (int mr, word_t val_ok) |
45 |
{ |
{ |
46 |
|
#ifdef _L4_INTERFACE_INTERN |
47 |
{ |
{ |
48 |
_L4_word_t val; |
_L4_word_t val; |
49 |
char *msg; |
char *msg; |
58 |
_L4_store_mr (mr, &val); |
_L4_store_mr (mr, &val); |
59 |
check_nr ("[intern]", msg, val, val_ok); |
check_nr ("[intern]", msg, val, val_ok); |
60 |
} |
} |
61 |
|
#endif |
62 |
|
|
63 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
64 |
{ |
{ |
101 |
void |
void |
102 |
test_many_mrs (int start_mr, int nr, _L4_word_t *values_ok) |
test_many_mrs (int start_mr, int nr, _L4_word_t *values_ok) |
103 |
{ |
{ |
104 |
|
#ifdef _L4_INTERFACE_INTERN |
105 |
{ |
{ |
106 |
_L4_word_t values[nr]; |
_L4_word_t values[nr]; |
107 |
int i; |
int i; |
124 |
check_nr ("[intern]", msg, values[i], values_ok[i]); |
check_nr ("[intern]", msg, values[i], values_ok[i]); |
125 |
} |
} |
126 |
} |
} |
127 |
|
#endif |
128 |
|
|
129 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
130 |
{ |
{ |
185 |
{ |
{ |
186 |
int start_mr; |
int start_mr; |
187 |
int nr; |
int nr; |
188 |
_L4_word_t values[L4_NUM_MRS]; |
word_t values[L4_NUM_MRS_OK]; |
189 |
} tests[] = |
} tests[] = |
190 |
{ |
{ |
191 |
{ 0, 1, { 22 } }, |
{ 0, 1, { 22 } }, |
203 |
int nr = sizeof (tests) / sizeof (tests[0]); |
int nr = sizeof (tests) / sizeof (tests[0]); |
204 |
int i; |
int i; |
205 |
|
|
206 |
check_nr ("[intern]", "_L4_NUM_MRS", _L4_NUM_MRS, 64); |
#ifdef _L4_INTERFACE_INTERN |
207 |
|
check_nr ("[intern]", "_L4_NUM_MRS", _L4_NUM_MRS, L4_NUM_MRS_OK); |
208 |
|
#endif |
209 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
210 |
check_nr ("[GNU]", "L4_NUM_MRS", L4_NUM_MRS, 64); |
check_nr ("[GNU]", "L4_NUM_MRS", L4_NUM_MRS, L4_NUM_MRS_OK); |
211 |
#endif |
#endif |
212 |
/* FIXME: There is no L4 interface for this. */ |
/* FIXME: There is no L4 interface for this. */ |
213 |
|
|
223 |
void |
void |
224 |
test_one_br (int br, _L4_word_t val_ok) |
test_one_br (int br, _L4_word_t val_ok) |
225 |
{ |
{ |
226 |
|
#ifdef _L4_INTERFACE_INTERN |
227 |
{ |
{ |
228 |
_L4_word_t val; |
_L4_word_t val; |
229 |
char *msg; |
char *msg; |
238 |
_L4_store_br (br, &val); |
_L4_store_br (br, &val); |
239 |
check_nr ("[intern]", msg, val, val_ok); |
check_nr ("[intern]", msg, val, val_ok); |
240 |
} |
} |
241 |
|
#endif |
242 |
|
|
243 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
244 |
{ |
{ |
281 |
void |
void |
282 |
test_many_brs (int start_br, int nr, _L4_word_t *values_ok) |
test_many_brs (int start_br, int nr, _L4_word_t *values_ok) |
283 |
{ |
{ |
284 |
|
#ifdef _L4_INTERFACE_INTERN |
285 |
{ |
{ |
286 |
_L4_word_t values[nr]; |
_L4_word_t values[nr]; |
287 |
int i; |
int i; |
304 |
check_nr ("[intern]", msg, values[i], values_ok[i]); |
check_nr ("[intern]", msg, values[i], values_ok[i]); |
305 |
} |
} |
306 |
} |
} |
307 |
|
#endif |
308 |
|
|
309 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
310 |
{ |
{ |
365 |
{ |
{ |
366 |
int start_br; |
int start_br; |
367 |
int nr; |
int nr; |
368 |
_L4_word_t values[L4_NUM_BRS]; |
word_t values[L4_NUM_BRS_OK]; |
369 |
} tests[] = |
} tests[] = |
370 |
{ |
{ |
371 |
{ 0, 1, { 24 } }, |
{ 0, 1, { 24 } }, |
380 |
int nr = sizeof (tests) / sizeof (tests[0]); |
int nr = sizeof (tests) / sizeof (tests[0]); |
381 |
int i; |
int i; |
382 |
|
|
383 |
check_nr ("[intern]", "_L4_NUM_BRS", _L4_NUM_BRS, 33); |
#ifdef _L4_INTERFACE_INTERN |
384 |
|
check_nr ("[intern]", "_L4_NUM_BRS", _L4_NUM_BRS, L4_NUM_BRS_OK); |
385 |
|
#endif |
386 |
#ifdef _L4_INTERFACE_GNU |
#ifdef _L4_INTERFACE_GNU |
387 |
check_nr ("[GNU]", "L4_NUM_BRS", L4_NUM_BRS, 33); |
check_nr ("[GNU]", "L4_NUM_BRS", L4_NUM_BRS, L4_NUM_BRS_OK); |
388 |
#endif |
#endif |
389 |
/* FIXME: There is no L4 interface for this. */ |
/* FIXME: There is no L4 interface for this. */ |
390 |
|
|