VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMGC/VMMGCA.asm@ 988

Last change on this file since 988 was 988, checked in by vboxsync, 18 years ago

Fixed the real cause of the tripple fault.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1; $Id: VMMGCA.asm 988 2007-02-19 18:19:14Z vboxsync $
2;; @file
3; VMMGC - Guest Context Virtual Machine Monitor assembly routines.
4;
5
6; Copyright (C) 2006 InnoTek Systemberatung GmbH
7;
8; This file is part of VirtualBox Open Source Edition (OSE), as
9; available from http://www.virtualbox.org. This file is free software;
10; you can redistribute it and/or modify it under the terms of the GNU
11; General Public License as published by the Free Software Foundation,
12; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13; distribution. VirtualBox OSE is distributed in the hope that it will
14; be useful, but WITHOUT ANY WARRANTY of any kind.
15;
16; If you received this file as part of a commercial VirtualBox
17; distribution, then only the terms of your commercial VirtualBox
18; license agreement apply instead of the previous paragraph.
19
20;*******************************************************************************
21;* Header Files *
22;*******************************************************************************
23%include "VBox/asmdefs.mac"
24%include "VBox/x86.mac"
25
26
27;*******************************************************************************
28;* Defined Constants And Macros *
29;*******************************************************************************
30;; save all registers before loading special values for the faulting.
31%macro SaveAndLoadAll 0
32 pushad
33 push ds
34 push es
35 push fs
36 push gs
37 call NAME(vmmGCTestLoadRegs)
38%endmacro
39
40;; restore all registers after faulting.
41%macro RestoreAll 0
42 pop gs
43 pop fs
44 pop es
45 pop ds
46 popad
47%endmacro
48
49
50;*******************************************************************************
51;* External Symbols *
52;*******************************************************************************
53extern IMPNAME(g_Logger)
54extern IMPNAME(g_RelLogger)
55extern NAME(RTLogLogger)
56
57
58BEGINCODE
59
60;/**
61; * Internal GC logger worker: Logger wrapper.
62; */
63;VMMGCDECL(void) vmmGCLoggerWrapper(const char *pszFormat, ...);
64EXPORTEDNAME vmmGCLoggerWrapper
65%ifdef __YASM__
66%ifdef ASM_FORMAT_ELF
67 push dword IMP(g_Logger) ; YASM BUG #67! YASMCHECK!
68%else
69 push IMP(g_Logger)
70%endif
71%else
72 push IMP(g_Logger)
73%endif
74 call NAME(RTLogLogger)
75 add esp, byte 4
76 ret
77ENDPROC vmmGCLoggerWrapper
78
79
80;/**
81; * Internal GC logger worker: Logger (release) wrapper.
82; */
83;VMMGCDECL(void) vmmGCRelLoggerWrapper(const char *pszFormat, ...);
84EXPORTEDNAME vmmGCRelLoggerWrapper
85%ifdef __YASM__
86%ifdef ASM_FORMAT_ELF
87 push dword IMP(g_RelLogger) ; YASM BUG #67! YASMCHECK!
88%else
89 push IMP(g_RelLogger)
90%endif
91%else
92 push IMP(g_RelLogger)
93%endif
94 call NAME(RTLogLogger)
95 add esp, byte 4
96 ret
97ENDPROC vmmGCRelLoggerWrapper
98
99
100;;
101; Enables write protection.
102BEGINPROC vmmGCEnableWP
103 push eax
104 mov eax, cr0
105 or eax, X86_CR0_WRITE_PROTECT
106 mov cr0, eax
107 pop eax
108 ret
109ENDPROC vmmGCEnableWP
110
111
112;;
113; Disables write protection.
114BEGINPROC vmmGCDisableWP
115 push eax
116 mov eax, cr0
117 and eax, ~X86_CR0_WRITE_PROTECT
118 mov cr0, eax
119 pop eax
120 ret
121ENDPROC vmmGCDisableWP
122
123
124;;
125; Load special register set expected upon faults.
126; All registers are changed.
127BEGINPROC vmmGCTestLoadRegs
128 mov eax, ss
129 mov ds, eax
130 mov es, eax
131 mov fs, eax
132 mov gs, eax
133 mov edi, 001234567h
134 mov esi, 042000042h
135 mov ebp, 0ffeeddcch
136 mov ebx, 089abcdefh
137 mov ecx, 0ffffaaaah
138 mov edx, 077778888h
139 mov eax, 0f0f0f0f0h
140 ret
141ENDPROC vmmGCTestLoadRegs
142
143
144;;
145; A Trap 3 testcase.
146GLOBALNAME vmmGCTestTrap3
147 SaveAndLoadAll
148
149 int 3
150EXPORTEDNAME vmmGCTestTrap3_FaultEIP
151
152 RestoreAll
153 mov eax, 0ffffffffh
154 ret
155ENDPROC vmmGCTestTrap3
156
157
158;;
159; A Trap 8 testcase.
160GLOBALNAME vmmGCTestTrap8
161 SaveAndLoadAll
162
163 sub esp, byte 8
164 sidt [esp]
165 mov word [esp], 111 ; make any #PF double fault.
166 lidt [esp]
167 add esp, byte 8
168
169 COM_S_CHAR '!'
170
171 xor eax, eax
172EXPORTEDNAME vmmGCTestTrap8_FaultEIP
173 mov eax, [eax]
174
175
176 COM_S_CHAR '2'
177
178 RestoreAll
179 mov eax, 0ffffffffh
180 ret
181ENDPROC vmmGCTestTrap8
182
183
184;;
185; A simple Trap 0d testcase.
186GLOBALNAME vmmGCTestTrap0d
187 SaveAndLoadAll
188
189 push ds
190EXPORTEDNAME vmmGCTestTrap0d_FaultEIP
191 ltr [esp]
192 pop eax
193
194 RestoreAll
195 mov eax, 0ffffffffh
196 ret
197ENDPROC vmmGCTestTrap0d
198
199
200;;
201; A simple Trap 0e testcase.
202GLOBALNAME vmmGCTestTrap0e
203 SaveAndLoadAll
204
205 xor eax, eax
206EXPORTEDNAME vmmGCTestTrap0e_FaultEIP
207 mov eax, [eax]
208
209 RestoreAll
210 mov eax, 0ffffffffh
211 ret
212
213EXPORTEDNAME vmmGCTestTrap0e_ResumeEIP
214 RestoreAll
215 xor eax, eax
216 ret
217ENDPROC vmmGCTestTrap0e
218
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette