source: trunk/include/os2sel.h@ 10367

Last change on this file since 10367 was 10004, checked in by sandervl, 22 years ago

PF: Header updates

File size: 1.4 KB
RevLine 
[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
12extern "C" {
13#endif
14
15
[4075]16#ifdef __WATCOMC__
17unsigned short GetFS(void);
18#pragma aux GetFS = \
19 "mov ax,fs" \
20 value [ax] \
21 parm nomemory;
[48]22
[4075]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];
[9631]35#endif
[4075]36
[9631]37#ifdef __EMX__
[9969]38static inline unsigned short GetFS(void)
[9631]39{
[10004]40 int __res;
41 __asm__ __volatile__("mov %%fs, %%eax" : "=a" (__res));
42 return(__res);
[9631]43}
44
[9969]45static inline void SetFS(unsigned short sel)
[9631]46{
[10004]47 __asm__ __volatile__("mov %%eax,%%fs" : : "a" (sel));
[9631]48}
49
[10004]50static inline int RestoreOS2FS(void)
[9631]51{
[10004]52 int __res, xx = 0x0150b;
53
54 __asm__ __volatile__(
55 "mov %%fs,%0 \n\t"
56 "mov %1,%%fs \n\t"
57 : "=&r" (__res) : "r" (xx));
58 return(__res);
[9631]59}
60
61
[4075]62#else
[6997]63
64unsigned short _System GetFS (void);
65unsigned short _System RestoreOS2FS(void);
[4077]66void _System SetFS (unsigned short selector);
67unsigned short _System SetReturnFS (unsigned short selector);
[9631]68//SvL: Checks if thread FS & exception structure are valid
69int _System CheckCurFS(void);
[4075]70#endif
71
[6997]72
73
74#ifdef __cplusplus
75}
76#endif
[2544]77
[6997]78
[537]79#endif //__OS2SEL_H__
Note: See TracBrowser for help on using the repository browser.