VirtualBox

source: vbox/trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp@ 42261

Last change on this file since 42261 was 42165, checked in by vboxsync, 12 years ago

CPUMIsGuestIn64BitCode/CPUMIsGuestIn64BitCodeEx changes together with some early lazily loading of hidden selectors (raw-mode).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1/* $Id: tstDBGCStubs.cpp 42165 2012-07-16 13:36:01Z vboxsync $ */
2/** @file
3 * DBGC Testcase - Command Parser, VMM Stub Functions.
4 */
5
6/*
7 * Copyright (C) 2006-2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.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#include <VBox/err.h>
19#include <VBox/vmm/vm.h>
20#include <iprt/string.h>
21
22
23
24#include <VBox/vmm/dbgf.h>
25VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PVM pVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr)
26{
27 return NULL;
28}
29
30VMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off)
31{
32 /* bad:bad -> provke error during parsing. */
33 if (Sel == 0xbad && off == 0xbad)
34 return VERR_OUT_OF_SELECTOR_BOUNDS;
35
36 /* real mode conversion. */
37 pAddress->FlatPtr = (uint32_t)(Sel << 4) | off;
38 pAddress->fFlags |= DBGFADDRESS_FLAGS_FLAT;
39 pAddress->Sel = DBGF_SEL_FLAT;
40 pAddress->off = pAddress->FlatPtr;
41 return VINF_SUCCESS;
42}
43
44VMMR3DECL(int) DBGFR3AddrToPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTGCPHYS pGCPhys)
45{
46 return VERR_INTERNAL_ERROR;
47}
48
49VMMR3DECL(int) DBGFR3AddrToHostPhys(PVMCPU pVCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys)
50{
51 return VERR_INTERNAL_ERROR;
52}
53
54VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVMCPU pVCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
55{
56 return VERR_INTERNAL_ERROR;
57}
58
59VMMR3DECL(int) DBGFR3Attach(PVM pVM)
60{
61 return VERR_INTERNAL_ERROR;
62}
63
64VMMR3DECL(int) DBGFR3BpClear(PVM pVM, RTUINT iBp)
65{
66 return VERR_INTERNAL_ERROR;
67}
68VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, RTUINT iBp)
69{
70 return VERR_INTERNAL_ERROR;
71}
72VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, RTUINT iBp)
73{
74 return VERR_INTERNAL_ERROR;
75}
76VMMR3DECL(int) DBGFR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser)
77{
78 return VERR_INTERNAL_ERROR;
79}
80VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
81{
82 return VERR_INTERNAL_ERROR;
83}
84VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
85 uint8_t fType, uint8_t cb, PRTUINT piBp)
86{
87 return VERR_INTERNAL_ERROR;
88}
89VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
90{
91 return VERR_INTERNAL_ERROR;
92}
93VMMR3DECL(bool) DBGFR3CanWait(PVM pVM)
94{
95 return true;
96}
97VMMR3DECL(int) DBGFR3Detach(PVM pVM)
98{
99 return VERR_INTERNAL_ERROR;
100}
101VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, uint32_t fFlags,
102 char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr)
103{
104 return VERR_INTERNAL_ERROR;
105}
106VMMR3DECL(int) DBGFR3EventWait(PVM pVM, RTMSINTERVAL cMillies, PCDBGFEVENT *ppEvent)
107{
108 return VERR_INTERNAL_ERROR;
109}
110VMMR3DECL(int) DBGFR3Halt(PVM pVM)
111{
112 return VERR_INTERNAL_ERROR;
113}
114VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
115{
116 return VERR_INTERNAL_ERROR;
117}
118VMMR3DECL(int) DBGFR3InfoEx(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
119{
120 return VERR_INTERNAL_ERROR;
121}
122VMMR3DECL(bool) DBGFR3IsHalted(PVM pVM)
123{
124 return true;
125}
126VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine)
127{
128 return VERR_INTERNAL_ERROR;
129}
130VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
131{
132 return VERR_INTERNAL_ERROR;
133}
134VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
135{
136 return VERR_INTERNAL_ERROR;
137}
138VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
139{
140 return VERR_INTERNAL_ERROR;
141}
142VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage)
143{
144 return VERR_INTERNAL_ERROR;
145}
146VMMR3DECL(int) DBGFR3AsLoadImage(PVM pVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags)
147{
148 return VERR_INTERNAL_ERROR;
149}
150VMMR3DECL(int) DBGFR3AsLoadMap(PVM pVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags)
151{
152 return VERR_INTERNAL_ERROR;
153}
154VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PVM pVM, RTDBGAS hAlias)
155{
156 return NIL_RTDBGAS;
157}
158VMMR3DECL(int) DBGFR3Resume(PVM pVM)
159{
160 return VERR_INTERNAL_ERROR;
161}
162VMMR3DECL(int) DBGFR3StackWalkBegin(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame)
163{
164 return VERR_INTERNAL_ERROR;
165}
166VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent)
167{
168 return NULL;
169}
170VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame)
171{
172}
173VMMR3DECL(int) DBGFR3Step(PVM pVM, VMCPUID idCpu)
174{
175 return VERR_INTERNAL_ERROR;
176}
177VMMR3DECL(int) DBGFR3AsSymbolByAddr(PVM pVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisplacement, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
178{
179 return VERR_INTERNAL_ERROR;
180}
181VMMR3DECL(int) DBGFR3AsSymbolByName(PVM pVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
182{
183 return VERR_INTERNAL_ERROR;
184}
185VMMR3DECL(int) DBGFR3MemScan(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign, const void *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress)
186{
187 return VERR_INTERNAL_ERROR;
188}
189VMMR3DECL(int) DBGFR3MemRead(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead)
190{
191 return VERR_INTERNAL_ERROR;
192}
193VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cchBuf)
194{
195 return VERR_INTERNAL_ERROR;
196}
197VMMR3DECL(int) DBGFR3MemWrite(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, const void *pvBuf, size_t cbRead)
198{
199 return VERR_INTERNAL_ERROR;
200}
201VMMDECL(int) DBGFR3PagingDumpEx(PVM pVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
202 uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp)
203{
204 return VERR_INTERNAL_ERROR;
205}
206VMMR3DECL(int) DBGFR3RegNmValidate(PVM pVM, VMCPUID idDefCpu, const char *pszReg)
207{
208 if ( !strcmp(pszReg, "ah")
209 || !strcmp(pszReg, "ax")
210 || !strcmp(pszReg, "eax")
211 || !strcmp(pszReg, "rax"))
212 return VINF_SUCCESS;
213 return VERR_DBGF_REGISTER_NOT_FOUND;
214}
215VMMR3DECL(int) DBGFR3RegCpuQueryU8( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8)
216{
217 return VERR_INTERNAL_ERROR;
218}
219VMMR3DECL(int) DBGFR3RegCpuQueryU16( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16)
220{
221 return VERR_INTERNAL_ERROR;
222}
223VMMR3DECL(int) DBGFR3RegCpuQueryU32( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32)
224{
225 return VERR_INTERNAL_ERROR;
226}
227VMMR3DECL(int) DBGFR3RegCpuQueryU64( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64)
228{
229 return VERR_INTERNAL_ERROR;
230}
231VMMR3DECL(int) DBGFR3RegNmQuery(PVM pVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)
232{
233 if (idDefCpu == 0 || idDefCpu == DBGFREG_HYPER_VMCPUID)
234 {
235 if (!strcmp(pszReg, "ah"))
236 {
237 pValue->u16 = 0xf0;
238 *penmType = DBGFREGVALTYPE_U8;
239 return VINF_SUCCESS;
240 }
241 if (!strcmp(pszReg, "ax"))
242 {
243 pValue->u16 = 0xbabe;
244 *penmType = DBGFREGVALTYPE_U16;
245 return VINF_SUCCESS;
246 }
247 if (!strcmp(pszReg, "eax"))
248 {
249 pValue->u32 = 0xcafebabe;
250 *penmType = DBGFREGVALTYPE_U32;
251 return VINF_SUCCESS;
252 }
253 if (!strcmp(pszReg, "rax"))
254 {
255 pValue->u64 = UINT64_C(0x00beef00feedface);
256 *penmType = DBGFREGVALTYPE_U32;
257 return VINF_SUCCESS;
258 }
259 }
260 return VERR_DBGF_REGISTER_NOT_FOUND;
261}
262VMMR3DECL(int) DBGFR3RegPrintf(PVM pVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...)
263{
264 return VERR_INTERNAL_ERROR;
265}
266VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial)
267{
268 return VERR_INTERNAL_ERROR;
269}
270VMMR3DECL(int) DBGFR3RegNmSet(PVM pVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType)
271{
272 return VERR_INTERNAL_ERROR;
273}
274
275VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PVM pVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr)
276{
277 return NULL;
278}
279VMMR3DECL(int) DBGFR3AddrToHostPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys)
280{
281 return VERR_INTERNAL_ERROR;
282}
283VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
284{
285 return VERR_INTERNAL_ERROR;
286}
287
288VMMR3DECL(int) DBGFR3OSRegister(PVM pVM, PCDBGFOSREG pReg)
289{
290 return VERR_INTERNAL_ERROR;
291}
292VMMR3DECL(int) DBGFR3OSDetect(PVM pVM, char *pszName, size_t cchName)
293{
294 return VERR_INTERNAL_ERROR;
295}
296VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
297{
298 return VERR_INTERNAL_ERROR;
299}
300
301VMMR3DECL(int) DBGFR3SelQueryInfo(PVM pVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo)
302{
303 return VERR_INTERNAL_ERROR;
304}
305
306VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu)
307{
308 return CPUMMODE_INVALID;
309}
310
311VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *pszFilename, bool fReplaceFile)
312{
313 return VERR_INTERNAL_ERROR;
314}
315
316
317//////////////////////////////////////////////////////////////////////////
318// The rest should eventually be replaced by DBGF calls and eliminated. //
319/////////////////////////////////////////////////////////////////////////
320
321#include <VBox/vmm/cpum.h>
322
323VMMDECL(uint64_t) CPUMGetGuestCR3(PVMCPU pVCpu)
324{
325 return 0;
326}
327
328VMMDECL(uint64_t) CPUMGetGuestCR4(PVMCPU pVCpu)
329{
330 return 0;
331}
332
333VMMDECL(RTSEL) CPUMGetGuestCS(PVMCPU pVCpu)
334{
335 return 0;
336}
337
338VMMDECL(PCCPUMCTXCORE) CPUMGetGuestCtxCore(PVMCPU pVCpu)
339{
340 return NULL;
341}
342
343VMMDECL(uint32_t) CPUMGetGuestEIP(PVMCPU pVCpu)
344{
345 return 0;
346}
347
348VMMDECL(uint64_t) CPUMGetGuestRIP(PVMCPU pVCpu)
349{
350 return 0;
351}
352
353VMMDECL(RTGCPTR) CPUMGetGuestIDTR(PVMCPU pVCpu, uint16_t *pcbLimit)
354{
355 return 0;
356}
357
358VMMDECL(CPUMMODE) CPUMGetGuestMode(PVMCPU pVCpu)
359{
360 return CPUMMODE_INVALID;
361}
362
363VMMDECL(RTSEL) CPUMGetHyperCS(PVMCPU pVCpu)
364{
365 return 0xfff8;
366}
367
368VMMDECL(uint32_t) CPUMGetHyperEIP(PVMCPU pVCpu)
369{
370 return 0;
371}
372
373VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVMCPU pVCpu)
374{
375 return NULL;
376}
377
378VMMDECL(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu)
379{
380 return false;
381}
382
383
384#include <VBox/vmm/mm.h>
385
386VMMR3DECL(int) MMR3HCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys, void **ppv)
387{
388 return VERR_INTERNAL_ERROR;
389}
390
391
392
393
394#include <VBox/vmm/pgm.h>
395
396VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu)
397{
398 return 0;
399}
400
401VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu)
402{
403 return PGMMODE_INVALID;
404}
405
406VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PVM pVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys)
407{
408 return VERR_INTERNAL_ERROR;
409}
410
411VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PVM pVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys)
412{
413 return VERR_INTERNAL_ERROR;
414}
415VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PVM pVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys)
416{
417 return VERR_INTERNAL_ERROR;
418}
419
420
421#include <VBox/vmm/vmm.h>
422
423VMMDECL(PVMCPU) VMMGetCpuById(PVM pVM, RTCPUID idCpu)
424{
425 return NULL;
426}
427
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