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