OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [go32/] [sys/] [dpmi.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/* This is file dpmi.h */
2
/*
3
** Copyright (C) 1993 DJ Delorie
4
**
5
** This file is distributed under the terms listed in the document
6
** "copying.dj".
7
** A copy of "copying.dj" should accompany this file; if not, a copy
8
** should be available from where this file was obtained.  This file
9
** may not be distributed without a verbatim copy of "copying.dj".
10
**
11
** This file is distributed WITHOUT ANY WARRANTY; without even the implied
12
** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
 
15
#ifndef _DPMI_H_
16
#define _DPMI_H_
17
 
18
 
19
#include <sys/types.h>
20
 
21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24
 
25
typedef union {
26
  struct {
27
    u_long edi;
28
    u_long esi;
29
    u_long ebp;
30
    u_long res;
31
    u_long ebx;
32
    u_long edx;
33
    u_long ecx;
34
    u_long eax;
35
  } d;
36
  struct {
37
    u_short di, di_hi;
38
    u_short si, si_hi;
39
    u_short bp, bp_hi;
40
    u_short res, res_hi;
41
    u_short bx, bx_hi;
42
    u_short dx, dx_hi;
43
    u_short cx, cx_hi;
44
    u_short ax, ax_hi;
45
    u_short flags;
46
    u_short es;
47
    u_short ds;
48
    u_short fs;
49
    u_short gs;
50
    u_short ip;
51
    u_short cs;
52
    u_short sp;
53
    u_short ss;
54
  } x;
55
  struct {
56
    u_char edi[4];
57
    u_char esi[4];
58
    u_char ebp[4];
59
    u_char res[4];
60
    u_char bl, bh, ebx_b2, ebx_b3;
61
    u_char dl, dh, edx_b2, edx_b3;
62
    u_char cl, ch, ecx_b2, ecx_b3;
63
    u_char al, ah, eax_b2, eax_b3;
64
  } h;
65
} _go32_dpmi_registers;
66
 
67
typedef struct {
68
  u_long  size;
69
  u_long  pm_offset;
70
  u_short pm_selector;
71
  u_short rm_offset;
72
  u_short rm_segment;
73
} _go32_dpmi_seginfo;
74
 
75
typedef struct {
76
  u_long available_memory;
77
  u_long available_pages;
78
  u_long available_lockable_pages;
79
  u_long linear_space;
80
  u_long unlocked_pages;
81
  u_long available_physical_pages;
82
  u_long total_physical_pages;
83
  u_long free_linear_space;
84
  u_long max_pages_in_paging_file;
85
  u_long reserved[3];
86
} _go32_dpmi_meminfo;
87
 
88
/* returns zero if success, else dpmi error and info->size is max size */
89
int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
90
        /* set size to bytes/16, call, use rm_segment.  Do not
91
           change anthing but size until the memory is freed.
92
           If error, max size is returned in size as bytes/16. */
93
int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
94
        /* set new size to bytes/16, call.  If error, max size
95
           is returned in size as bytes/16 */
96
int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
97
        /* uses pm_selector to free memory */
98
 
99
/* These both use the rm_segment:rm_offset fields only */
100
int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
101
int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
102
 
103
/* These do NOT wrap the function in pm_offset in an iret handler.
104
   You must provide an assembler interface yourself, or alloc one below.
105
   You may NOT longjmp out of an interrupt handler. */
106
int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
107
        /* puts vector in pm_selector:pm_offset. */
108
int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
109
        /* sets vector from pm_offset and pm_selector */
110
int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
111
        /* sets up wrapper that calls function in pm_offset, chaining to old
112
           handler when it returns */
113
 
114
/* These can be used to generate assember IRET-style wrappers for functions */
115
int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
116
        /* Put function ptr in pm_offset, call, returns wrapper entry in pm_offset. */
117
int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
118
        /* assumes pm_offset points to wrapper, frees it */
119
 
120
/* simulate real mode calls.  CS:IP from regs for non-interrupt */
121
int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
122
int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
123
int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
124
 
125
/* These automatically handle the tasks of restructuring the
126
   real-mode stack for the proper return type.  The callback
127
   (info->pm_offset) is called as (*pmcb)(_go32_dpmi_registers *regs); */
128
int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
129
        /* points callback at pm_offset, returns seg:ofs of callback addr
130
           in rm_segment:rm_offset.  Do not change any fields until freed.
131
           Interface is added to simulate far return */
132
int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
133
        /* same, but simulates iret */
134
int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
135
        /* frees callback */
136
 
137
/* Only available_memory is guaranteed to be valid.  Try
138
   available_physical_pages for phys mem left */
139
int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
140
 
141
/* Convenience functions.  These use the above memory info call.
142
   The return value is *bytes* */
143
u_long _go32_dpmi_remaining_physical_memory(void);
144
u_long _go32_dpmi_remaining_virtual_memory(void);
145
 
146
 
147
#ifdef __cplusplus
148
}
149
#endif
150
 
151
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.