source: trunk/src/emx/include/os2thunk.h@ 231

Last change on this file since 231 was 156, checked in by zap, 22 years ago

o Modified makefiles so that os2.a builds correctly (with Vio, Kbd and friends,

not just from the import files).

o Moved os2.smak to the os2_386 directory (tcp32dll.imp will go into socket.a).
o Added the rules into libc.smak to build libc##.dll (finally it links without

errors! Don't know if it works, though ;-)

o Fixed emxbind so that it doesn't add underscores to exported symbols (taken

from the EXPORTS section of a .def file).

o Fixed emxexp so that it doesn't remove underscores from symbol names.
o Fixed all references to OS/2 functions to not contain an initial underscore

(since they are _System now).

o Added one builder makefile: mkimplib.smak, and two auxiliary submakefiles:

mkomflib.smak (included from both mklib and mkimplib), and a version.smak
that contains the version number, description and copyright for libc.

o Made a lot of small changes in order to remove duplicate symbols in libc.dll.
o Added sys/settime.c which was missing in EMX's -Zomf -Zsys variant.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1/* os2thunk.h (emx+gcc) */
2
3#ifndef _OS2THUNK_H
4#define _OS2THUNK_H
5
6typedef unsigned long _far16ptr;
7
8_far16ptr _emx_32to16 (void *ptr);
9void *_emx_16to32 (_far16ptr ptr);
10
11unsigned long _emx_thunk1 (void *args, void *fun);
12
13#define _THUNK_PASCAL_PROLOG(SIZE) \
14 ({ char _tb[(SIZE)+4]; void *_tp = _tb + sizeof (_tb); \
15 *(unsigned long *)_tb = (SIZE);
16#define _THUNK_PASCAL_CHAR(ARG) _THUNK_PASCAL_SHORT (ARG)
17#define _THUNK_PASCAL_SHORT(ARG) (*--((unsigned short *)_tp) = (ARG))
18#define _THUNK_PASCAL_LONG(ARG) (*--((unsigned long *)_tp) = (ARG))
19#define _THUNK_PASCAL_FLAT(ARG) _THUNK_PASCAL_LONG (_emx_32to16 (ARG))
20#define _THUNK_PASCAL_FAR16(ARG) _THUNK_PASCAL_LONG (ARG)
21#define _THUNK_PASCAL_FUNCTION(FUN) APIENTRY _16_##FUN
22#define _THUNK_PASCAL_CALL(FUN) _emx_thunk1 (_tb, (void *)(_16_##FUN)); })
23#define _THUNK_PASCAL_CALLI(FUN) _emx_thunk1 (_tb, (void *)(FUN)); })
24
25#define _THUNK_C_PROLOG(SIZE) \
26 ({ char _tb[(SIZE)+4]; void *_tp = _tb + sizeof (unsigned long); \
27 *(unsigned long *)_tb = (SIZE);
28#define _THUNK_C_CHAR(ARG) _THUNK_C_SHORT (ARG)
29#define _THUNK_C_SHORT(ARG) (*((unsigned short *)_tp)++ = (ARG))
30#define _THUNK_C_LONG(ARG) (*((unsigned long *)_tp)++ = (ARG))
31#define _THUNK_C_FLAT(ARG) _THUNK_C_LONG (_emx_32to16 (ARG))
32#define _THUNK_C_FAR16(ARG) _THUNK_C_LONG (ARG)
33#define _THUNK_C_FUNCTION(FUN) _16__##FUN
34#define _THUNK_C_CALL(FUN) _emx_thunk1 (_tb, (void *)(_16__##FUN)); })
35#define _THUNK_C_CALLI(FUN) _emx_thunk1 (_tb, (void *)(FUN)); })
36
37#define _THUNK_PROLOG(SIZE) _THUNK_PASCAL_PROLOG (SIZE)
38#define _THUNK_CHAR(ARG) _THUNK_PASCAL_CHAR (ARG)
39#define _THUNK_SHORT(ARG) _THUNK_PASCAL_SHORT (ARG)
40#define _THUNK_LONG(ARG) _THUNK_PASCAL_LONG (ARG)
41#define _THUNK_FLAT(ARG) _THUNK_PASCAL_FLAT (ARG)
42#define _THUNK_FAR16(ARG) _THUNK_PASCAL_FAR16 (ARG)
43#define _THUNK_FUNCTION(FUN) _THUNK_PASCAL_FUNCTION (FUN)
44#define _THUNK_CALL(FUN) _THUNK_PASCAL_CALL (FUN)
45#define _THUNK_CALLI(FUN) _THUNK_PASCAL_CALLI (FUN)
46
47#define MAKE16P(sel,off) ((_far16ptr)((sel) << 16 | (off)))
48#define MAKEP(sel,off) _emx_16to32 (MAKE16P (sel, off))
49#define SELECTOROF(farptr) ((SEL)((farptr) >> 16))
50#define OFFSETOF(farptr) ((USHORT)(farptr))
51
52/* Return true iff the block of SIZE bytes at PTR does not cross a
53 64Kbyte boundary. */
54
55#define _THUNK_PTR_SIZE_OK(ptr,size) \
56 (((ULONG)(ptr) & ~0xffff) == (((ULONG)(ptr) + (size) - 1) & ~0xffff))
57
58/* Return true iff the structure pointed to by PTR does not cross a
59 64KByte boundary. */
60
61#define _THUNK_PTR_STRUCT_OK(ptr) _THUNK_PTR_SIZE_OK ((ptr), sizeof (*(ptr)))
62
63#endif /* not _OS2THUNK_H */
Note: See TracBrowser for help on using the repository browser.