Watt-32 tcp/ip  2.2 dev-rel.10
powerpak.h
Go to the documentation of this file.
1 
3 #ifndef _w32_POWERPAK_H
4 #define _w32_POWERPAK_H
5 
6 #if (DOSX & POWERPAK) && defined(BORLAND386)
7 
8 #undef REALPTR
9 #define REALPTR DWORD /* segment in upper 16 bits */
10 #define RP_SET(rp,ofs,seg) (rp = ((DWORD)(seg) << 16) + (ofs))
11 #define RP_OFF(rp) (WORD)((DWORD)(rp) & 0xFFFF)
12 #define RP_SEG(rp) (WORD)((DWORD)(rp) >> 16)
13 #define PokeRealWord(rp,x) WriteRealMem (rp, &(x), sizeof(WORD))
14 
15 #include <sys/pack_on.h>
16 
17 typedef struct {
18  DWORD r_di;
19  DWORD r_si;
20  DWORD r_bp;
21  DWORD reserved;
22  DWORD r_bx;
23  DWORD r_dx;
24  DWORD r_cx;
25  DWORD r_ax;
26  WORD r_flags;
27  WORD r_es, r_ds, r_fs, r_gs;
28  WORD r_ip, r_cs, r_sp, r_ss;
29  } REAL_regs;
30 
31 #include <sys/pack_off.h>
32 
33 typedef struct {
34  void (*pm_func)(void);
35  BYTE *wrapper;
36  REALPTR rm_addr;
37  REAL_regs rm_regs;
38  } DPMI_callback;
39 
40 extern BOOL powerpak_init (void);
41 
42 extern WORD dpmi_create_dos_selector (void);
43 extern int dpmi_free_dos_selector (WORD sel);
44 extern int dpmi_delete_memory_alias (void);
45 extern DWORD dpmi_create_memory_alias (DWORD addr, DWORD len);
46 extern REALPTR dpmi_alloc_callback_retf (DPMI_callback *cb);
47 extern int dpmi_free_callback_retf (DPMI_callback *cb);
48 
49 extern int dpmi_getvect (int intr, WORD *sel, DWORD *ofs);
50 extern int dpmi_setvect (int intr, WORD sel, DWORD ofs);
51 
52 extern void ReadRealMem (void *buf, REALPTR rp, unsigned len);
53 extern void WriteRealMem (REALPTR rp, const void *src, int size);
54 
55 extern BYTE _farpeekb (WORD sel, DWORD ofs);
56 extern WORD _farpeekw (WORD sel, DWORD ofs);
57 extern DWORD _farpeekl (WORD sel, DWORD ofs);
58 extern void _farpokeb (WORD sel, DWORD ofs, BYTE val);
59 extern void _farpokew (WORD sel, DWORD ofs, WORD val);
60 extern void _farpokel (WORD sel, DWORD ofs, DWORD val);
61 
62 #endif
63 #endif