Deleted Added
full compact
vm86.h (34840) vm86.h (36767)
1/*-
2 * Copyright (c) 1997 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Derived from register.h, which is
6 * Copyright (c) 1996 Michael Smith. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
16 *
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
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 1997 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Derived from register.h, which is
6 * Copyright (c) 1996 Michael Smith. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
16 *
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
27 * SUCH DAMAGE.
28 *
29 * $Id: vm86.h,v 1.4 1997/11/20 18:43:55 bde Exp $
29 * $Id: vm86.h,v 1.5 1998/03/23 19:52:57 jlemon Exp $
30 */
31
32#ifndef _MACHINE_VM86_H_
33#define _MACHINE_VM86_H_ 1
34
35/* standard register representation */
36typedef union {
37 u_long r_ex;
38 struct {
39 u_short r_x;
30 */
31
32#ifndef _MACHINE_VM86_H_
33#define _MACHINE_VM86_H_ 1
34
35/* standard register representation */
36typedef union {
37 u_long r_ex;
38 struct {
39 u_short r_x;
40 u_short :16;
40 u_int :16;
41 } r_w;
42 struct {
43 u_char r_l;
44 u_char r_h;
41 } r_w;
42 struct {
43 u_char r_l;
44 u_char r_h;
45 u_short :16;
45 u_int :16;
46 } r_b;
47} reg86_t;
48
49/* layout must match definition of struct trapframe_vm86 in <machine/frame.h> */
50
51struct vm86frame {
52 int kernel_es;
53 int kernel_ds;
54 reg86_t edi;
55 reg86_t esi;
56 reg86_t ebp;
57 reg86_t isp;
58 reg86_t ebx;
59 reg86_t edx;
60 reg86_t ecx;
61 reg86_t eax;
62 int vmf_trapno;
63 int vmf_err;
64 reg86_t eip;
65 reg86_t cs;
66 reg86_t eflags;
67 reg86_t esp;
68 reg86_t ss;
69 reg86_t es;
70 reg86_t ds;
71 reg86_t fs;
72 reg86_t gs;
73#define vmf_ah eax.r_b.r_h
74#define vmf_al eax.r_b.r_l
75#define vmf_ax eax.r_w.r_x
76#define vmf_eax eax.r_ex
77#define vmf_bx ebx.r_w.r_x
78#define vmf_ebx ebx.r_ex
79#define vmf_cx ecx.r_w.r_x
80#define vmf_ecx ecx.r_ex
81#define vmf_dx edx.r_w.r_x
82#define vmf_edx edx.r_ex
83#define vmf_si esi.r_w.r_x
84#define vmf_di edi.r_w.r_x
85#define vmf_cs cs.r_w.r_x
86#define vmf_ds ds.r_w.r_x
87#define vmf_es es.r_w.r_x
88#define vmf_ss ss.r_w.r_x
89#define vmf_sp esp.r_w.r_x
90#define vmf_ip eip.r_w.r_x
91#define vmf_flags eflags.r_w.r_x
92#define vmf_eflags eflags.r_ex
93};
94
95#define VM_USERCHANGE (PSL_USERCHANGE | PSL_RF)
96#define VME_USERCHANGE (VM_USERCHANGE | PSL_VIP | PSL_VIF)
97
98struct vm86_kernel {
99 caddr_t vm86_intmap; /* interrupt map */
100 u_long vm86_eflags; /* emulated flags */
101 int vm86_has_vme; /* VME support */
102 int vm86_inited; /* we were initialized */
103 int vm86_debug;
104 caddr_t vm86_sproc; /* address of sproc */
105};
106
107struct i386_vm86_args {
108 int sub_op; /* sub-operation to perform */
109 char *sub_args; /* args */
110};
111
112#define VM86_INIT 1
113#define VM86_SET_VME 2
114#define VM86_GET_VME 3
115#define VM86_INTCALL 4
116
117struct vm86_init_args {
118 int debug; /* debug flag */
119 int cpu_type; /* cpu type to emulate */
120 u_char int_map[32]; /* interrupt map */
121};
122
123struct vm86_vme_args {
124 int state; /* status */
125};
126
127struct vm86_intcall_args {
128 int intnum;
129 struct vm86frame vmf;
130};
131
132extern int in_vm86call;
133
134struct proc;
135extern int vm86_emulate __P((struct vm86frame *));
136extern int vm86_sysarch __P((struct proc *, char *));
137extern void vm86_trap __P((struct vm86frame *));
138extern int vm86_intcall __P((int, struct vm86frame *));
139extern int vm86_datacall __P((int, struct vm86frame *, char *, int,
140 u_short *, u_short *));
141extern void initial_bioscalls __P((u_int *, u_int *));
142
143#endif /* _MACHINE_VM86_H_ */
46 } r_b;
47} reg86_t;
48
49/* layout must match definition of struct trapframe_vm86 in <machine/frame.h> */
50
51struct vm86frame {
52 int kernel_es;
53 int kernel_ds;
54 reg86_t edi;
55 reg86_t esi;
56 reg86_t ebp;
57 reg86_t isp;
58 reg86_t ebx;
59 reg86_t edx;
60 reg86_t ecx;
61 reg86_t eax;
62 int vmf_trapno;
63 int vmf_err;
64 reg86_t eip;
65 reg86_t cs;
66 reg86_t eflags;
67 reg86_t esp;
68 reg86_t ss;
69 reg86_t es;
70 reg86_t ds;
71 reg86_t fs;
72 reg86_t gs;
73#define vmf_ah eax.r_b.r_h
74#define vmf_al eax.r_b.r_l
75#define vmf_ax eax.r_w.r_x
76#define vmf_eax eax.r_ex
77#define vmf_bx ebx.r_w.r_x
78#define vmf_ebx ebx.r_ex
79#define vmf_cx ecx.r_w.r_x
80#define vmf_ecx ecx.r_ex
81#define vmf_dx edx.r_w.r_x
82#define vmf_edx edx.r_ex
83#define vmf_si esi.r_w.r_x
84#define vmf_di edi.r_w.r_x
85#define vmf_cs cs.r_w.r_x
86#define vmf_ds ds.r_w.r_x
87#define vmf_es es.r_w.r_x
88#define vmf_ss ss.r_w.r_x
89#define vmf_sp esp.r_w.r_x
90#define vmf_ip eip.r_w.r_x
91#define vmf_flags eflags.r_w.r_x
92#define vmf_eflags eflags.r_ex
93};
94
95#define VM_USERCHANGE (PSL_USERCHANGE | PSL_RF)
96#define VME_USERCHANGE (VM_USERCHANGE | PSL_VIP | PSL_VIF)
97
98struct vm86_kernel {
99 caddr_t vm86_intmap; /* interrupt map */
100 u_long vm86_eflags; /* emulated flags */
101 int vm86_has_vme; /* VME support */
102 int vm86_inited; /* we were initialized */
103 int vm86_debug;
104 caddr_t vm86_sproc; /* address of sproc */
105};
106
107struct i386_vm86_args {
108 int sub_op; /* sub-operation to perform */
109 char *sub_args; /* args */
110};
111
112#define VM86_INIT 1
113#define VM86_SET_VME 2
114#define VM86_GET_VME 3
115#define VM86_INTCALL 4
116
117struct vm86_init_args {
118 int debug; /* debug flag */
119 int cpu_type; /* cpu type to emulate */
120 u_char int_map[32]; /* interrupt map */
121};
122
123struct vm86_vme_args {
124 int state; /* status */
125};
126
127struct vm86_intcall_args {
128 int intnum;
129 struct vm86frame vmf;
130};
131
132extern int in_vm86call;
133
134struct proc;
135extern int vm86_emulate __P((struct vm86frame *));
136extern int vm86_sysarch __P((struct proc *, char *));
137extern void vm86_trap __P((struct vm86frame *));
138extern int vm86_intcall __P((int, struct vm86frame *));
139extern int vm86_datacall __P((int, struct vm86frame *, char *, int,
140 u_short *, u_short *));
141extern void initial_bioscalls __P((u_int *, u_int *));
142
143#endif /* _MACHINE_VM86_H_ */