1 | /* |
---|
2 | * vm86.h: vm86 emulator definitions. |
---|
3 | * |
---|
4 | * Leendert van Doorn, leendert@watson.ibm.com |
---|
5 | * Copyright (c) 2005, International Business Machines Corporation. |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or modify it |
---|
8 | * under the terms and conditions of the GNU General Public License, |
---|
9 | * version 2, as published by the Free Software Foundation. |
---|
10 | * |
---|
11 | * This program is distributed in the hope it will be useful, but WITHOUT |
---|
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
14 | * more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License along with |
---|
17 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
18 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
---|
19 | */ |
---|
20 | #ifndef __VM86_H__ |
---|
21 | #define __VM86_H__ |
---|
22 | |
---|
23 | #ifndef __ASSEMBLY__ |
---|
24 | #include <stdint.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #include <xen/hvm/vmx_assist.h> |
---|
28 | |
---|
29 | #define NR_EXCEPTION_HANDLER 32 |
---|
30 | #define NR_INTERRUPT_HANDLERS 16 |
---|
31 | #define NR_TRAPS (NR_EXCEPTION_HANDLER+NR_INTERRUPT_HANDLERS) |
---|
32 | |
---|
33 | #ifndef __ASSEMBLY__ |
---|
34 | |
---|
35 | struct regs { |
---|
36 | unsigned edi, esi, ebp, esp, ebx, edx, ecx, eax; |
---|
37 | unsigned trapno, errno; |
---|
38 | unsigned eip, cs, eflags, uesp, uss; |
---|
39 | unsigned ves, vds, vfs, vgs; |
---|
40 | }; |
---|
41 | |
---|
42 | enum vm86_mode { |
---|
43 | VM86_REAL = 0, |
---|
44 | VM86_REAL_TO_PROTECTED, |
---|
45 | VM86_PROTECTED_TO_REAL, |
---|
46 | VM86_PROTECTED |
---|
47 | }; |
---|
48 | |
---|
49 | #ifdef DEBUG |
---|
50 | #define TRACE(a) trace a |
---|
51 | #else |
---|
52 | #define TRACE(a) |
---|
53 | #endif |
---|
54 | |
---|
55 | extern enum vm86_mode prevmode, mode; |
---|
56 | extern struct vmx_assist_context oldctx; |
---|
57 | |
---|
58 | extern void emulate(struct regs *); |
---|
59 | extern void dump_regs(struct regs *); |
---|
60 | extern void trace(struct regs *, int, char *, ...); |
---|
61 | |
---|
62 | extern void set_mode(struct regs *, enum vm86_mode); |
---|
63 | extern void switch_to_real_mode(void); |
---|
64 | extern void switch_to_protected_mode(void); |
---|
65 | |
---|
66 | #endif /* __ASSEMBLY__ */ |
---|
67 | |
---|
68 | #endif /* __VM86_H__ */ |
---|