[bcl] Enable tests for the monodroid profile.
[mono.git] / mono / utils / mono-hwcap.h
1 #ifndef __MONO_UTILS_HWCAP_H__
2 #define __MONO_UTILS_HWCAP_H__
3
4 #include <stdio.h>
5 #include <glib.h>
6
7 #include "config.h"
8
9 #include "mono/utils/mono-compiler.h"
10
11 #define MONO_HWCAP_VAR(NAME) extern gboolean mono_hwcap_ ## NAME;
12 #include "mono/utils/mono-hwcap-vars.h"
13 #undef MONO_HWCAP_VAR
14
15 /* Call this function to perform hardware feature detection. Until
16  * this function has been called, all feature variables will be
17  * FALSE as a default.
18  *
19  * While this function can be called multiple times, doing so from
20  * several threads at the same time is not supported as it will
21  * result in an inconsistent state of the variables. Further,
22  * feature variables should not be read *while* this function is
23  * executing.
24  */
25 void mono_hwcap_init (void);
26
27 /* Implemented in mono-hwcap-$TARGET.c. Do not call. */
28 void mono_hwcap_arch_init (void);
29
30 /* Print detected features to stdout. */
31 void mono_hwcap_print (void);
32
33 /* Please note: If you're going to use the Linux auxiliary vector
34  * to detect CPU features, don't use any of the constant names in
35  * the hwcap.h header. This ties us to a particular version of the
36  * header, and since the values are guaranteed to be stable, hard-
37  * coding them is not that terrible.
38  *
39  * Also, please do not add assumptions to mono-hwcap. The code here
40  * is meant to *discover* facts about the hardware, not assume that
41  * some feature exists because of $arbitrary_preprocessor_define.
42  * If you have to make assumptions, do so elsewhere, e.g. in the
43  * Mini back end you're modifying.
44  *
45  * Finally, be conservative. If you can't determine precisely if a
46  * feature is present, assume that it isn't. In the rare cases where
47  * the hardware or operating system are lying, work around that in
48  * a different place, as with the rule above.
49  */
50
51 #endif /* __MONO_UTILS_HWCAP_H__ */