Fixed definition of the RtlMemory functions. Use macros internally and
[wine.git] / include / selectors.h
blobfa2fb1d23114b7c1f228015d6e00ed773d34eeca
1 /*
2 * Selector definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_SELECTORS_H
8 #define __WINE_SELECTORS_H
10 #include "windef.h"
11 #include "ldt.h"
13 extern WORD SELECTOR_AllocBlock( const void *base, DWORD size,
14 enum seg_type type, BOOL is32bit,
15 BOOL readonly );
16 extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
17 extern void SELECTOR_MoveBlock( WORD sel, const void *new_base );
18 extern void SELECTOR_FreeBlock( WORD sel, WORD count );
20 #ifdef __i386__
21 # ifdef __GNUC__
22 # define __DEFINE_GET_SEG(seg) \
23 extern inline unsigned short __get_##seg(void) \
24 { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
25 # define __DEFINE_SET_SEG(seg) \
26 extern inline void __set_##seg(int val) { __asm__("movl %0,%%" #seg : : "r" (val)); }
27 # else /* __GNUC__ */
28 # define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void);
29 # define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int);
30 # endif /* __GNUC__ */
31 #else /* __i386__ */
32 # define __DEFINE_GET_SEG(seg) static inline unsigned short __get_##seg(void) { return 0; }
33 # define __DEFINE_SET_SEG(seg) /* nothing */
34 #endif /* __i386__ */
36 __DEFINE_GET_SEG(cs)
37 __DEFINE_GET_SEG(ds)
38 __DEFINE_GET_SEG(es)
39 __DEFINE_GET_SEG(fs)
40 __DEFINE_GET_SEG(gs)
41 __DEFINE_GET_SEG(ss)
42 __DEFINE_SET_SEG(fs)
43 __DEFINE_SET_SEG(gs)
45 #endif /* __WINE_SELECTORS_H */