|
Last change
on this file since 10003 was 9969, checked in by sandervl, 23 years ago |
|
PF: Added modified emx runtime headers + header updates
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /* $Id: os2sel.h,v 1.12 2003-04-02 11:02:34 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
|
|---|
| 12 | extern "C" {
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | #ifdef __WATCOMC__
|
|---|
| 17 | unsigned short GetFS(void);
|
|---|
| 18 | #pragma aux GetFS = \
|
|---|
| 19 | "mov ax,fs" \
|
|---|
| 20 | value [ax] \
|
|---|
| 21 | parm nomemory;
|
|---|
| 22 |
|
|---|
| 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];
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | #ifdef __EMX__
|
|---|
| 38 | static inline unsigned short GetFS(void)
|
|---|
| 39 | {
|
|---|
| 40 | asm volatile (
|
|---|
| 41 | "mov %fs, %ax \n\t"
|
|---|
| 42 | );
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | static inline void SetFS(unsigned short sel)
|
|---|
| 46 | {
|
|---|
| 47 | __asm__ __volatile__("movw %%ax,%%fs" : : "a" (sel));
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | static inline unsigned short RestoreOS2FS(void)
|
|---|
| 51 | {
|
|---|
| 52 | asm volatile (
|
|---|
| 53 | "push $0x0150b \n\t"
|
|---|
| 54 | "movw %fs,%ax \n\t"
|
|---|
| 55 | "pop %fs"
|
|---|
| 56 | );
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | #else
|
|---|
| 61 |
|
|---|
| 62 | unsigned short _System GetFS (void);
|
|---|
| 63 | unsigned short _System RestoreOS2FS(void);
|
|---|
| 64 | void _System SetFS (unsigned short selector);
|
|---|
| 65 | unsigned short _System SetReturnFS (unsigned short selector);
|
|---|
| 66 | //SvL: Checks if thread FS & exception structure are valid
|
|---|
| 67 | int _System CheckCurFS(void);
|
|---|
| 68 | #endif
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | #ifdef __cplusplus
|
|---|
| 73 | }
|
|---|
| 74 | #endif
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | #endif //__OS2SEL_H__
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.