VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Instructions/env-common.mac@ 46791

最後變更 在這個檔案從46791是 46731,由 vboxsync 提交於 12 年 前

calling it a day...

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.5 KB
 
1; $Id: env-common.mac 46731 2013-06-22 00:34:46Z vboxsync $
2;; @file
3; Instruction Test Environment - Common Bits.
4;
5
6;
7; Copyright (C) 2006-2013 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.alldomusa.eu.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17
18%ifndef ___env_common_mac
19%define ___env_common_mac
20
21
22;*******************************************************************************
23;* Defined Constants And Macros *
24;*******************************************************************************
25%ifdef RT_ARCH_AMD64
26 %define MY_PUSH_FLAGS pushfq
27 %define MY_POP_FLAGS popfq
28 %define MY_PUSH_FLAGS_SIZE 8
29
30 %macro MY_PUSH_ALL 0
31 push rbp
32 mov rbp, rsp
33 push rax
34 push rbx
35 push rcx
36 push rdx
37 push rsi
38 push rdi
39 push r8
40 push r9
41 push r10
42 push r11
43 push r12
44 push r13
45 push r14
46 push r15
47 pushfq
48 %endm
49 %macro MY_POP_ALL 0
50 popfq
51 pop r15
52 pop r14
53 pop r13
54 pop r12
55 pop r11
56 pop r10
57 pop r9
58 pop r8
59 pop rdi
60 pop rsi
61 pop rdx
62 pop rcx
63 pop rbx
64 pop rax
65 pop rbp
66 %endm
67
68%else
69 %define MY_PUSH_FLAGS pushfd
70 %define MY_POP_FLAGS popfd
71 %define MY_PUSH_FLAGS_SIZE 4
72
73 %macro MY_PUSH_ALL 0
74 push eBP
75 mov xBP, xSP
76 push eax
77 push ebx
78 push ecx
79 push edx
80 push esi
81 push edi
82 pushfd
83 %endm
84 %macro MY_POP_ALL 0
85 popfd
86 pop edi
87 pop esi
88 pop edx
89 pop ecx
90 pop ebx
91 pop eax
92 pop ebp
93 %endm
94%endif
95
96
97
98;*******************************************************************************
99;* Internal Functions *
100;*******************************************************************************
101
102
103;;
104; Report bad register value.
105;
106; Primary purpose is save all registers and convert from our stack-based to
107; the correct calling convention for the environment.
108;
109; @param uExpected
110; @param uActual
111; @param uRegisterNo
112;
113VBINSTST_BEGINPROC Common_BadValue
114 MY_PUSH_ALL
115
116%ifdef ASM_CALL64_GCC
117 mov r8d, [VBINSTST_NAME(g_uVBInsTstSubTestIndicator) wrt rip]
118 mov rcx, [rbp + 10h] ; expected
119 mov rdx, [rbp + 18h] ; actual
120 mov rsi, [rbp + 20h] ; reg#
121 lea rdi, [.szFmt wrt rip]
122 VBINSTST_CALL_FN_FAILURE_4
123
124%elifdef ASM_CALL64_MSC
125 sub rsp, 28h
126 mov r10d, [VBINSTST_NAME(g_uVBInsTstSubTestIndicator) wrt rip]
127 mov [rsp + 20h], r10
128 mov r9, [rbp + 10h] ; expected
129 mov r8, [rbp + 18h] ; actual
130 mov rdx, [rbp + 20h] ; reg#
131 lea rcx, [.szFmt wrt rip]
132 VBINSTST_CALL_FN_FAILURE_4
133 add rsp, 28h
134
135%else
136 mov sBX, [VBINSTST_NAME(g_uVBInsTstSubTestIndicator)]
137 mov sCX, [xBP + 4 + xCB] ; expected
138 mov sAX, [xBP + 4 + xCB + 4] ; actual
139 mov sDX, [xBP + 4 + xCB + 8] ; reg#
140 push sBX
141 push sCX
142 push sAX
143 push sDX
144 push .szFmt
145 VBINSTST_CALL_FN_FAILURE_4
146 add esp, 4*sCB + xCB
147%endif
148 MY_POP_ALL
149 ret
150%if ARCH_BITS == 64
151.szFmt: db 'Bad register %#llx value %#018llx, expected %#018llx (line %llu)', 0
152%else
153.szFmt: db 'Bad register %lx value %#010lx, expected %#010lx (line %lu)', 0
154%endif
155VBINSTST_ENDPROC Common_BadValue
156
157
158
159;
160; Global data variables used by Common_SetupMemReadUxx.
161;
162BEGINDATA
163VBINSTST_GLOBALNAME_EX g_u64Data, data hidden
164 dq 0
165VBINSTST_GLOBALNAME_EX g_u32Data, data hidden
166 dd 0
167VBINSTST_GLOBALNAME_EX g_u16Data, data hidden
168 dw 0
169VBINSTST_GLOBALNAME_EX g_u8Data, data hidden
170 db 0
171 db 90h
172
173BEGINCODE
174
175;;
176; Sets up g_u8Data.
177; @param uValue
178VBINSTST_BEGINPROC Common_SetupMemReadU8
179 push sAX
180 mov ax, [xSP + sCB + xCB]
181 mov [VBINSTST_NAME(g_u8Data) xWrtRIP], ax
182 pop sAX
183 ret sCB
184VBINSTST_ENDPROC Common_SetupMemReadU8
185
186;;
187; Sets up g_u16Data.
188; @param uValue
189VBINSTST_BEGINPROC Common_SetupMemReadU16
190 push sAX
191 mov ax, [xSP + sCB + xCB]
192 mov [VBINSTST_NAME(g_u16Data) xWrtRIP], ax
193 pop sAX
194 ret sCB
195VBINSTST_ENDPROC Common_SetupMemReadU16
196
197;;
198; Sets up g_u32Data.
199; @param uValue
200VBINSTST_BEGINPROC Common_SetupMemReadU32
201 push sAX
202 mov eax, [xSP + sCB + xCB]
203 mov [VBINSTST_NAME(g_u32Data) xWrtRIP], eax
204 pop sAX
205 ret sCB
206VBINSTST_ENDPROC Common_SetupMemReadU32
207
208;;
209; Sets up g_u64Data.
210; @param uValue
211VBINSTST_BEGINPROC Common_SetupMemReadU64
212 push sAX
213%ifdef RT_ARCH_AMD64
214 mov rax, [xSP + sCB + xCB]
215 mov [VBINSTST_NAME(g_u64Data) xWrtRIP], rax
216%else
217 mov eax, [xSP + sCB + xCB]
218 mov [VBINSTST_NAME(g_u64Data) xWrtRIP], eax
219 mov eax, [xSP + sCB + xCB + 4]
220 mov [VBINSTST_NAME(g_u64Data) + 4 xWrtRIP], eax
221%endif
222 pop sAX
223 ret sCB
224VBINSTST_ENDPROC Common_SetupMemReadU64
225
226
227%endif
228
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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