home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / include / md / _os2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  18.1 KB  |  489 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef nspr_os2_defs_h___
  20. #define nspr_os2_defs_h___
  21.  
  22. #define INCL_DOS
  23. #define INCL_DOSERRORS
  24. #define INCL_WIN
  25. #define INCL_WPS
  26. #include <os2.h>
  27. #include <sys/select.h>
  28.  
  29. #include "prio.h"
  30.  
  31. #include <errno.h>
  32.  
  33. /*
  34.  * Internal configuration macros
  35.  */
  36.  
  37. #define PR_LINKER_ARCH      "os2"
  38. #define _PR_SI_SYSNAME        "OS2"
  39. #define _PR_SI_ARCHITECTURE   "x86"    /* XXXMB hardcode for now */
  40.  
  41. #define HAVE_DLL
  42. #undef  HAVE_THREAD_AFFINITY
  43. #define HAVE_SOCKET_REUSEADDR
  44. #define HAVE_SOCKET_KEEPALIVE
  45. #define _PR_HAVE_ATOMIC_OPS
  46.  
  47. #define HANDLE unsigned long
  48. #define HINSTANCE HMODULE
  49.  
  50. /* --- Common User-Thread/Native-Thread Definitions --------------------- */
  51.  
  52. /* --- Globals --- */
  53. extern struct PRLock                      *_pr_schedLock;
  54.  
  55. /* --- Typedefs --- */
  56. typedef void (*FiberFunc)(void *);
  57.  
  58. #define PR_NUM_GCREGS           8
  59. typedef PRInt32                    PR_CONTEXT_TYPE[PR_NUM_GCREGS];
  60. #define GC_VMBASE               0x40000000
  61. #define GC_VMLIMIT              0x00FFFFFF
  62.  
  63. #define _MD_MAGIC_THREAD    0x22222222
  64. #define _MD_MAGIC_THREADSTACK    0x33333333
  65. #define _MD_MAGIC_SEGMENT    0x44444444
  66. #define _MD_MAGIC_DIR        0x55555555
  67. #define _MD_MAGIC_CV        0x66666666
  68.  
  69. typedef struct _MDSemaphore
  70. {
  71.    HEV sem;
  72. } MDSEM;
  73.  
  74. struct _MDCPU {
  75.     int              unused;
  76. }; 
  77.  
  78. struct _MDThread {
  79.     MDSEM            blocked_sema;       /* Threads block on this when waiting
  80.                                          * for IO or CondVar.
  81.                                          */
  82.     PRBool           inCVWaitQueue;     /* PR_TRUE if the thread is in the
  83.                                          * wait queue of some cond var.
  84.                                          * PR_FALSE otherwise.  */
  85.     TID              handle;            /* OS/2 thread handle */
  86.     void            *sp;                /* only valid when suspended */
  87.     PRUint32         magic;             /* for debugging */
  88.     PR_CONTEXT_TYPE  gcContext;         /* Thread context for GC */
  89.     struct PRThread *prev, *next;       /* used by the cvar wait queue to
  90.                                          * chain the PRThread structures
  91.                                          * together */
  92. };
  93.  
  94. struct _MDThreadStack {
  95.     PRUint32           magic;          /* for debugging */
  96. };
  97.  
  98. struct _MDSegment {
  99.     PRUint32           magic;          /* for debugging */
  100. };
  101.  
  102. #undef PROFILE_LOCKS
  103.  
  104. struct _MDDir {
  105.     HDIR           d_hdl;
  106.     FILEFINDBUF3  d_entry;
  107.     PRBool           firstEntry;     /* Is this the entry returned
  108.                                       * by FindFirstFile()? */
  109.     PRUint32         magic;          /* for debugging */
  110. };
  111.  
  112. struct _MDCVar {
  113.     PRUint32 magic;
  114.     struct PRThread *waitHead, *waitTail;  /* the wait queue: a doubly-
  115.                                             * linked list of threads
  116.                                             * waiting on this condition
  117.                                             * variable */
  118.     PRIntn nwait;                          /* number of threads in the
  119.                                             * wait queue */
  120. };
  121.  
  122. #define _MD_CV_NOTIFIED_LENGTH 6
  123. typedef struct _MDNotified _MDNotified;
  124. struct _MDNotified {
  125.     PRIntn length;                     /* # of used entries in this
  126.                                         * structure */
  127.     struct {
  128.         struct _MDCVar *cv;            /* the condition variable notified */
  129.         PRIntn times;                  /* and the number of times notified */
  130.         struct PRThread *notifyHead;   /* list of threads to wake up */
  131.     } cv[_MD_CV_NOTIFIED_LENGTH];
  132.     _MDNotified *link;                 /* link to another of these, or NULL */
  133. };
  134.  
  135. struct _MDLock {
  136.     CRITICAL_SECTION mutex;          /* this is recursive on NT */
  137.  
  138.     /*
  139.      * When notifying cvars, there is no point in actually
  140.      * waking up the threads waiting on the cvars until we've
  141.      * released the lock.  So, we temporarily record the cvars.
  142.      * When doing an unlock, we'll then wake up the waiting threads.
  143.      */
  144.     struct _MDNotified notified;     /* array of conditions notified */
  145. #ifdef PROFILE_LOCKS
  146.     PRInt32 hitcount;
  147.     PRInt32 misscount;
  148. #endif
  149. };
  150.  
  151. struct _MDFileDesc {
  152.     PRInt32 osfd;    /* The osfd can come from one of three spaces:
  153.                       * - For stdin, stdout, and stderr, we are using
  154.                       *   the libc file handle (0, 1, 2), which is an int.
  155.                       * - For files and pipes, we are using OS/2 handles,
  156.                       *   which is a void*.
  157.                       * - For sockets, we are using int
  158.                       */
  159. };
  160.  
  161. struct _MDProcess {
  162.    PID pid;
  163. };
  164.  
  165. /* --- Misc stuff --- */
  166. #define _MD_GET_SP(thread)            (thread)->md.gcContext[6]
  167.  
  168. /* --- IO stuff --- */
  169.  
  170. #define _MD_OPEN                      _PR_MD_OPEN
  171. #define _MD_READ                      _PR_MD_READ
  172. #define _MD_WRITE                     _PR_MD_WRITE
  173. #define _MD_WRITEV                    _PR_MD_WRITEV
  174. #define _MD_LSEEK                     _PR_MD_LSEEK
  175. #define _MD_LSEEK64                   _PR_MD_LSEEK64
  176. extern PRInt32 _MD_CloseFile(PRInt32 osfd);
  177. #define _MD_CLOSE_FILE                _MD_CloseFile
  178. #define _MD_GETFILEINFO               _PR_MD_GETFILEINFO
  179. #define _MD_GETOPENFILEINFO           _PR_MD_GETOPENFILEINFO
  180. #define _MD_GETOPENFILEINFO64(a, b)   _PR_MD_GETOPENFILEINFO64(a, b)
  181. #define _MD_STAT                      _PR_MD_STAT
  182. #define _MD_RENAME                    _PR_MD_RENAME     
  183. #define _MD_ACCESS                    _PR_MD_ACCESS     
  184. #define _MD_DELETE                    _PR_MD_DELETE     
  185. #define _MD_MKDIR                     _PR_MD_MKDIR      
  186. #define _MD_RMDIR                     _PR_MD_RMDIR      
  187. #define _MD_LOCKFILE                  _PR_MD_LOCKFILE
  188. #define _MD_TLOCKFILE                 _PR_MD_TLOCKFILE
  189. #define _MD_UNLOCKFILE                _PR_MD_UNLOCKFILE
  190.  
  191. /* --- Socket IO stuff --- */
  192. #define _MD_EACCES                EACCES
  193. #define _MD_EADDRINUSE            EADDRINUSE
  194. #define _MD_EADDRNOTAVAIL         EADDRNOTAVAIL
  195. #define _MD_EAFNOSUPPORT          EAFNOSUPPORT
  196. #define _MD_EAGAIN                EWOULDBLOCK
  197. #define _MD_EALREADY              EALREADY
  198. #define _MD_EBADF                 EBADF
  199. #define _MD_ECONNREFUSED          ECONNREFUSED
  200. #define _MD_ECONNRESET            ECONNRESET
  201. #define _MD_EFAULT                SOCEFAULT
  202. #define _MD_EINPROGRESS           EINPROGRESS
  203. #define _MD_EINTR                 EINTR
  204. #define _MD_EINVAL                EINVAL
  205. #define _MD_EISCONN               EISCONN
  206. #define _MD_ENETUNREACH           ENETUNREACH
  207. #define _MD_ENOENT                ENOENT
  208. #define _MD_ENOTCONN              ENOTCONN
  209. #define _MD_ENOTSOCK              ENOTSOCK
  210. #define _MD_EOPNOTSUPP            EOPNOTSUPP
  211. #define _MD_EWOULDBLOCK           EWOULDBLOCK
  212. #define _MD_GET_SOCKET_ERROR()    sock_errno()
  213. #ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
  214. /*  #define INADDR_LOOPBACK         INADDR_ANY */
  215. #endif  
  216.  
  217. extern void _MD_MakeNonblock(PRFileDesc *f);
  218. #define _MD_MAKE_NONBLOCK             _MD_MakeNonblock
  219. #define _MD_SHUTDOWN                  _PR_MD_SHUTDOWN
  220. #define _MD_LISTEN(s, backlog)        listen(s->secret->md.osfd,backlog)
  221. extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
  222. #define _MD_CLOSE_SOCKET              _MD_CloseSocket
  223. #define _MD_SENDTO                    _PR_MD_SENDTO
  224. #define _MD_RECVFROM                  _PR_MD_RECVFROM
  225. #define _MD_SOCKETPAIR(s, type, proto, sv) -1
  226. #define _MD_GETSOCKNAME               _PR_MD_GETSOCKNAME
  227. #define _MD_GETPEERNAME               _PR_MD_GETPEERNAME
  228. #define _MD_GETSOCKOPT                _PR_MD_GETSOCKOPT
  229. #define _MD_SETSOCKOPT                _PR_MD_SETSOCKOPT
  230. #define _MD_SELECT                    select
  231. #define _MD_FSYNC                     _PR_MD_FSYNC
  232.  
  233. long _System InterlockedIncrement(PLONG);
  234. long _System InterlockedDecrement(PLONG);
  235. long _System InterlockedExchange(PLONG, LONG);
  236.  
  237. #define _MD_INIT_ATOMIC()
  238. #define _MD_ATOMIC_INCREMENT(x)       InterlockedIncrement((PLONG)x)
  239. #define _MD_ATOMIC_DECREMENT(x)       InterlockedDecrement((PLONG)x)
  240. #define _MD_ATOMIC_SET(x,y)           InterlockedExchange((PLONG)x, (LONG)y)
  241.  
  242. #define _MD_INIT_IO                   _PR_MD_INIT_IO
  243. #define _MD_TRANSMITFILE              _PR_MD_TRANSMITFILE
  244.  
  245.  
  246. /* win95 doesn't have async IO */
  247. #define _MD_SOCKET                    _PR_MD_SOCKET
  248. extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
  249. #define _MD_SOCKETAVAILABLE           _MD_SocketAvailable
  250. #define _MD_CONNECT                   _PR_MD_CONNECT
  251. extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
  252.         PRIntervalTime timeout);
  253. #define _MD_ACCEPT                    _MD_Accept
  254. #define _MD_BIND                      _PR_MD_BIND
  255. #define _MD_RECV                      _PR_MD_RECV
  256. #define _MD_SEND                      _PR_MD_SEND
  257.  
  258. /* --- Scheduler stuff --- */
  259. /* #define _MD_PAUSE_CPU                 _PR_MD_PAUSE_CPU */
  260. #define _MD_PAUSE_CPU
  261.  
  262. /* --- DIR stuff --- */
  263. #define PR_DIRECTORY_SEPARATOR        '\\'
  264. #define PR_DIRECTORY_SEPARATOR_STR    "\\"
  265. #define PR_PATH_SEPARATOR        ';'
  266. #define PR_PATH_SEPARATOR_STR        ";"
  267. #define _MD_ERRNO()                   errno
  268. #define _MD_OPEN_DIR                  _PR_MD_OPEN_DIR
  269. #define _MD_CLOSE_DIR                 _PR_MD_CLOSE_DIR
  270. #define _MD_READ_DIR                  _PR_MD_READ_DIR
  271.  
  272. /* --- Segment stuff --- */
  273. #define _MD_INIT_SEGS()
  274. #define _MD_ALLOC_SEGMENT(seg, size, vaddr)   0
  275. #define _MD_FREE_SEGMENT(seg)
  276.  
  277. /* --- Environment Stuff --- */
  278. #define _MD_GET_ENV                 _PR_MD_GET_ENV
  279. #define _MD_PUT_ENV                 _PR_MD_PUT_ENV
  280.  
  281. /* --- Threading Stuff --- */
  282. #define _MD_DEFAULT_STACK_SIZE      32767L
  283. #define _MD_INIT_THREAD             _PR_MD_INIT_THREAD
  284. #define _MD_INIT_ATTACHED_THREAD    _PR_MD_INIT_THREAD
  285. #define _MD_INIT_PRIMORDIAL_THREAD  _PR_MD_INIT_PRIMORDIAL_THREAD
  286. #define _MD_CREATE_THREAD           _PR_MD_CREATE_THREAD
  287. #define _MD_YIELD                   _PR_MD_YIELD
  288. #define _MD_SET_PRIORITY            _PR_MD_SET_PRIORITY
  289. #define _MD_CLEAN_THREAD            _PR_MD_CLEAN_THREAD
  290. #define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
  291. #define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
  292. #define _MD_EXIT_THREAD             _PR_MD_EXIT_THREAD
  293. #define _MD_SUSPEND_THREAD          _PR_MD_SUSPEND_THREAD
  294. #define _MD_RESUME_THREAD           _PR_MD_RESUME_THREAD
  295. #define _MD_SUSPEND_CPU             _PR_MD_SUSPEND_CPU
  296. #define _MD_RESUME_CPU              _PR_MD_RESUME_CPU
  297. #define _MD_WAKEUP_CPUS             _PR_MD_WAKEUP_CPUS
  298. #define _MD_BEGIN_SUSPEND_ALL()
  299. #define _MD_BEGIN_RESUME_ALL()
  300. #define _MD_END_SUSPEND_ALL()
  301. #define _MD_END_RESUME_ALL()
  302.  
  303. /* --- Lock stuff --- */
  304. #define _PR_LOCK                      _MD_LOCK
  305. #define _PR_UNLOCK                      _MD_UNLOCK
  306.  
  307. #define _MD_NEW_LOCK(lock)            (InitializeCriticalSection(&((lock)->mutex)),(lock)->notified.length=0,(lock)->notified.link=NULL,PR_SUCCESS)
  308. #define _MD_FREE_LOCK(lock)           DeleteCriticalSection(&((lock)->mutex))
  309. #define _MD_LOCK(lock)                EnterCriticalSection(&((lock)->mutex))
  310. #define _MD_TEST_AND_LOCK(lock)       (EnterCriticalSection(&((lock)->mutex)),PR_SUCCESS)
  311. #define _MD_UNLOCK                    _PR_MD_UNLOCK
  312.  
  313. /* --- lock and cv waiting --- */
  314. #define _MD_WAIT                      _PR_MD_WAIT
  315. #define _MD_WAKEUP_WAITER             _PR_MD_WAKEUP_WAITER
  316.  
  317. /* --- CVar ------------------- */
  318. #define _MD_WAIT_CV                      _PR_MD_WAIT_CV
  319. #define _MD_NEW_CV                      _PR_MD_NEW_CV
  320. #define _MD_FREE_CV                      _PR_MD_FREE_CV
  321. #define _MD_NOTIFY_CV                  _PR_MD_NOTIFY_CV    
  322. #define _MD_NOTIFYALL_CV              _PR_MD_NOTIFYALL_CV
  323.  
  324.    /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
  325. /* extern  struct _MDLock              _pr_ioq_lock; */
  326. #define _MD_IOQ_LOCK()                
  327. #define _MD_IOQ_UNLOCK()              
  328.  
  329.  
  330. /* --- Initialization stuff --- */
  331. #define _MD_START_INTERRUPTS()
  332. #define _MD_STOP_INTERRUPTS()
  333. #define _MD_DISABLE_CLOCK_INTERRUPTS()
  334. #define _MD_BLOCK_CLOCK_INTERRUPTS()
  335. #define _MD_UNBLOCK_CLOCK_INTERRUPTS()
  336. #define _MD_EARLY_INIT                _PR_MD_EARLY_INIT
  337. #define _MD_FINAL_INIT()
  338. #define _MD_INIT_CPUS()
  339. #define _MD_INIT_RUNNING_CPU(cpu)
  340.  
  341. struct PRProcess;
  342. struct PRProcessAttr;
  343.  
  344. #define _MD_CREATE_PROCESS _PR_CreateOS2Process
  345. extern struct PRProcess * _PR_CreateOS2Process(
  346.     const char *path,
  347.     char *const *argv,
  348.     char *const *envp,
  349.     const struct PRProcessAttr *attr
  350. );
  351.  
  352. #define _MD_DETACH_PROCESS _PR_DetachOS2Process
  353. extern PRStatus _PR_DetachOS2Process(struct PRProcess *process);
  354.  
  355. /* --- Wait for a child process to terminate --- */
  356. #define _MD_WAIT_PROCESS _PR_WaitOS2Process
  357. extern PRStatus _PR_WaitOS2Process(struct PRProcess *process, 
  358.     PRInt32 *exitCode);
  359.  
  360. #define _MD_KILL_PROCESS _PR_KillOS2Process
  361. extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
  362.  
  363. #define _MD_CLEANUP_BEFORE_EXIT()
  364. #define _MD_INIT_CONTEXT
  365. #define _MD_SWITCH_CONTEXT
  366. #define _MD_RESTORE_CONTEXT
  367.  
  368. /* --- Intervals --- */
  369. #define _MD_INTERVAL_INIT                 _PR_MD_INTERVAL_INIT
  370. #define _MD_GET_INTERVAL                  _PR_MD_GET_INTERVAL
  371. #define _MD_INTERVAL_PER_SEC              _PR_MD_INTERVAL_PER_SEC
  372. #define _MD_INTERVAL_PER_MILLISEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000)
  373. #define _MD_INTERVAL_PER_MICROSEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000000)
  374.  
  375. /* --- Native-Thread Specific Definitions ------------------------------- */
  376.  
  377. typedef struct __NSPR_TLS
  378. {
  379.     PRThread  *_pr_thread_last_run;
  380.     PRThread  *_pr_currentThread;
  381.     struct _PRCPU    *_pr_currentCPU;
  382. } _NSPR_TLS;
  383.  
  384. extern _NSPR_TLS*  pThreadLocalStorage;
  385. PR_IMPLEMENT(void) _PR_MD_ENSURE_TLS();
  386.  
  387. #define _MD_CURRENT_THREAD() pThreadLocalStorage->_pr_currentThread
  388. #define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
  389.  
  390. #define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run
  391. #define _MD_SET_LAST_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_thread_last_run = (_thread)
  392.  
  393. #define _MD_CURRENT_CPU() pThreadLocalStorage->_pr_currentCPU
  394. #define _MD_SET_CURRENT_CPU(_cpu) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentCPU = (_cpu)
  395.  
  396. /* lth. #define _MD_SET_INTSOFF(_val) (_pr_ints_off = (_val)) */
  397. /* lth. #define _MD_GET_INTSOFF() _pr_ints_off */
  398. /* lth. #define _MD_INCREMENT_INTSOFF() (_pr_ints_off++) */
  399. /* lth. #define _MD_DECREMENT_INTSOFF() (_pr_ints_off--) */
  400.  
  401. /* --- Scheduler stuff --- */
  402. #define LOCK_SCHEDULER()                 0
  403. #define UNLOCK_SCHEDULER()               0
  404. #define _PR_LockSched()                     0
  405. #define _PR_UnlockSched()                0
  406.  
  407. /* --- Initialization stuff --- */
  408. #define _MD_INIT_LOCKS()
  409.  
  410. /* --- Stack stuff --- */
  411. #define _MD_INIT_STACK(stack, redzone)
  412. #define _MD_CLEAR_STACK(stack)
  413.  
  414. /* --- Memory-mapped files stuff --- not implemented on OS/2 */
  415.  
  416. struct _MDFileMap {
  417.     PRInt8 unused;
  418. };
  419.  
  420. extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
  421. #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
  422.  
  423. extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
  424.         PRUint32 len);
  425. #define _MD_MEM_MAP _MD_MemMap
  426.  
  427. extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
  428. #define _MD_MEM_UNMAP _MD_MemUnmap
  429.  
  430. extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
  431. #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
  432.  
  433. /* Some stuff for setting up thread contexts */
  434. typedef ULONG DWORD, *PDWORD;
  435.  
  436. /* The following definitions and two structures are new in OS/2 Warp 4.0.
  437.  */
  438. #ifndef CONTEXT_CONTROL
  439. #define CONTEXT_CONTROL        0x00000001
  440. #define CONTEXT_INTEGER        0x00000002
  441. #define CONTEXT_SEGMENTS       0x00000004
  442. #define CONTEXT_FLOATING_POINT 0x00000008
  443. #define CONTEXT_FULL           0x0000000F
  444.  
  445. #pragma pack(2)
  446. typedef struct _FPREG {
  447.     ULONG      losig;    /*  Low 32-bits of the significand. */
  448.     ULONG      hisig;    /*  High 32-bits of the significand. */
  449.     USHORT     signexp;  /*  Sign and exponent. */
  450. } FPREG;
  451. typedef struct _CONTEXTRECORD {
  452.     ULONG     ContextFlags;
  453.     ULONG     ctx_env[7];
  454.     FPREG     ctx_stack[8];
  455.     ULONG     ctx_SegGs;     /*  GS register. */
  456.     ULONG     ctx_SegFs;     /*  FS register. */
  457.     ULONG     ctx_SegEs;     /*  ES register. */
  458.     ULONG     ctx_SegDs;     /*  DS register. */
  459.     ULONG     ctx_RegEdi;    /*  EDI register. */
  460.     ULONG     ctx_RegEsi;    /*  ESI register. */
  461.     ULONG     ctx_RegEax;    /*  EAX register. */
  462.     ULONG     ctx_RegEbx;    /*  EBX register. */
  463.     ULONG     ctx_RegEcx;    /*  ECX register. */
  464.     ULONG     ctx_RegEdx;    /*  EDX register. */
  465.     ULONG     ctx_RegEbp;    /*  EBP register. */
  466.     ULONG     ctx_RegEip;    /*  EIP register. */
  467.     ULONG     ctx_SegCs;     /*  CS register. */
  468.     ULONG     ctx_EFlags;    /*  EFLAGS register. */
  469.     ULONG     ctx_RegEsp;    /*  ESP register. */
  470.     ULONG     ctx_SegSs;     /*  SS register. */
  471. } CONTEXTRECORD, *PCONTEXTRECORD;
  472. #pragma pack()
  473. #endif
  474.  
  475. extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
  476.  
  477. /*
  478. #define _pr_tid            (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib2_ultid)
  479. #define _pr_current_Thread (_system_tls[_pr_tid-1].__pr_current_thread)
  480. */
  481.  
  482. /* Some simple mappings of Windows API's to OS/2 API's to make our lives a
  483.  * little bit easier.  Only add one here if it is a DIRECT mapping.  We are
  484.  * not emulating anything.  Just mapping.
  485.  */
  486. #define FreeLibrary(x) DosFreeModule(x)
  487.                                
  488. #endif /* nspr_os2_defs_h___ */
  489.