2 * Copyright (c) 1997 Jonathan Lemon
5 * Derived from register.h, which is
6 * Copyright (c) 1996 Michael Smith. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #ifndef _MACHINE_VM86_H_
33 #define _MACHINE_VM86_H_ 1
35 /* standard register representation */
49 /* layout must match definition of struct trapframe_vm86 in <machine/frame.h> */
74 #define vmf_ah eax.r_b.r_h
75 #define vmf_al eax.r_b.r_l
76 #define vmf_ax eax.r_w.r_x
77 #define vmf_eax eax.r_ex
78 #define vmf_bh ebx.r_b.r_h
79 #define vmf_bl ebx.r_b.r_l
80 #define vmf_bx ebx.r_w.r_x
81 #define vmf_ebx ebx.r_ex
82 #define vmf_ch ecx.r_b.r_h
83 #define vmf_cl ecx.r_b.r_l
84 #define vmf_cx ecx.r_w.r_x
85 #define vmf_ecx ecx.r_ex
86 #define vmf_dh edx.r_b.r_h
87 #define vmf_dl edx.r_b.r_l
88 #define vmf_dx edx.r_w.r_x
89 #define vmf_edx edx.r_ex
90 #define vmf_si esi.r_w.r_x
91 #define vmf_di edi.r_w.r_x
92 #define vmf_cs cs.r_w.r_x
93 #define vmf_ds ds.r_w.r_x
94 #define vmf_es es.r_w.r_x
95 #define vmf_ss ss.r_w.r_x
96 #define vmf_bp ebp.r_w.r_x
97 #define vmf_sp esp.r_w.r_x
98 #define vmf_ip eip.r_w.r_x
99 #define vmf_flags eflags.r_w.r_x
100 #define vmf_eflags eflags.r_ex
103 #define VM86_PMAPSIZE 24
104 #define VMAP_MALLOC 1 /* page was malloced by us */
113 } pmap[VM86_PMAPSIZE];
116 #define VM_USERCHANGE (PSL_USERCHANGE)
117 #define VME_USERCHANGE (VM_USERCHANGE | PSL_VIP | PSL_VIF)
120 caddr_t vm86_intmap; /* interrupt map */
121 u_int vm86_eflags; /* emulated flags */
122 int vm86_has_vme; /* VME support */
123 int vm86_inited; /* we were initialized */
125 caddr_t vm86_sproc; /* address of sproc */
129 #define VM86_SET_VME 2
130 #define VM86_GET_VME 3
131 #define VM86_INTCALL 4
133 struct vm86_init_args {
134 int debug; /* debug flag */
135 int cpu_type; /* cpu type to emulate */
136 u_char int_map[32]; /* interrupt map */
139 struct vm86_vme_args {
140 int state; /* status */
143 struct vm86_intcall_args {
145 struct vm86frame vmf;
149 extern int vm86paddr;
152 extern int vm86_emulate(struct vm86frame *);
153 extern int vm86_sysarch(struct thread *, char *);
154 extern void vm86_trap(struct vm86frame *);
155 extern int vm86_intcall(int, struct vm86frame *);
156 extern int vm86_datacall(int, struct vm86frame *, struct vm86context *);
157 extern void vm86_initialize(void);
158 extern vm_offset_t vm86_getpage(struct vm86context *, int);
159 extern vm_offset_t vm86_addpage(struct vm86context *, int, vm_offset_t);
160 extern int vm86_getptr(struct vm86context *, vm_offset_t, u_short *, u_short *);
162 extern vm_offset_t vm86_getaddr(struct vm86context *, u_short, u_short);
165 #endif /* _MACHINE_VM86_H_ */