source: branches/gcc-kmk/include/os2sel.h@ 21713

Last change on this file since 21713 was 21713, checked in by dmik, 14 years ago

Add SetReturnFS() for GCC.

File size: 1.6 KB
Line 
1/* $Id: os2sel.h,v 1.13 2003-04-10 10:26:23 sandervl Exp $ */
2/*
3 *
4 * Project Odin Software License can be found in LICENSE.TXT
5 *
6 */
7#ifndef __OS2SEL_H__
8#define __OS2SEL_H__
9
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15
16#ifdef __WATCOMC__
17unsigned short GetFS(void);
18#pragma aux GetFS = \
19 "mov ax,fs" \
20 value [ax] \
21 parm nomemory;
22
23void SetFS(unsigned short sel);
24#pragma aux SetFS = \
25 "mov fs,ax" \
26 parm [ax];
27
28unsigned short RestoreOS2FS(void);
29#pragma aux RestoreOS2FS = \
30 "mov bx, fs" \
31 "mov ax, 150bh" \
32 "mov fs, ax" \
33 value [bx] \
34 modify nomemory exact [ax];
35#endif
36
37#ifndef __WATCOMC__
38#ifdef __EMX__
39static inline unsigned short GetFS(void)
40{
41 int __res;
42 __asm__ __volatile__("mov %%fs, %%eax" : "=a" (__res));
43 return(__res);
44}
45
46static inline void SetFS(unsigned short sel)
47{
48 __asm__ __volatile__("mov %%eax,%%fs" : : "a" (sel));
49}
50
51static inline short RestoreOS2FS(void)
52{
53 int __res, xx = 0x0150b;
54
55 __asm__ __volatile__(
56 "mov %%fs,%0 \n\t"
57 "mov %1,%%fs \n\t"
58 : "=&r" (__res) : "r" (xx));
59 return(__res);
60}
61
62static inline short SetReturnFS(unsigned short sel)
63{
64 int __res;
65
66 __asm__ __volatile__(
67 "mov %%fs,%0 \n\t"
68 "mov %%eax,%%fs \n\t"
69 : "=&r" (__res) : "a" (sel));
70 return(__res);
71}
72
73#else
74
75unsigned short _System GetFS (void);
76unsigned short _System RestoreOS2FS(void);
77void _System SetFS (unsigned short selector);
78unsigned short _System SetReturnFS (unsigned short selector);
79#endif
80#endif
81
82//SvL: Checks if thread FS & exception structure are valid
83int _System CheckCurFS(void);
84
85
86#ifdef __cplusplus
87}
88#endif
89
90
91#endif //__OS2SEL_H__
Note: See TracBrowser for help on using the repository browser.