os.h - vx32 - Local 9vx git repository for patches.
(HTM) git clone git://r-36.net/vx32
(DIR) Log
(DIR) Files
(DIR) Refs
---
os.h (743B)
---
1 // Figure out whether to use %fs or %gs as the vx32 control segment.
2 // The host operating system is likely to use one of them as the
3 // thread-local storage segment. Use the other one.
4
5 #if defined(__APPLE__)
6 # define EXT(s) _ ## s
7 # define VSEG_FS
8 #elif defined(__FreeBSD__)
9 # define VSEG_FS
10 #elif defined(__linux__)
11 # if defined(__i386__)
12 # define VSEG_FS
13 # else /* x86-64 */
14 # define VSEG_GS
15 # endif
16 #else
17 #error Unsupported operating system.
18 #endif
19
20 #ifdef VSEG_FS
21 # define VSEG %fs
22 # define VSEGSTR "%fs"
23 # define VSEGPREFIX 0x64
24 # define mc_vs mc_fs
25 # define ss_vs ss.fs
26 #else
27 # define VSEG %gs
28 # define VSEGSTR "%gs"
29 # define VSEGPREFIX 0x65
30 # define mc_vs mc_gs
31 # define ss_vs ss.gs
32 #endif
33
34 #ifndef EXT
35 # define EXT(s) s
36 #endif