VirtualBox

source: vbox/trunk/include/VBox/dis.h@ 8352

Last change on this file since 8352 was 8352, checked in by vboxsync, 17 years ago

More 64 bits disasm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.1 KB
Line 
1/** @file
2 * DIS - The VirtualBox Disassembler.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.215389.xyz. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_disasm_h
31#define ___VBox_disasm_h
32
33#include <VBox/cdefs.h>
34#include <VBox/types.h>
35#include <VBox/disopcode.h>
36
37#if defined(__L4ENV__)
38#include <setjmp.h>
39#endif
40
41__BEGIN_DECLS
42
43
44/** CPU mode flags (DISCPUSTATE::mode).
45 * @{
46 */
47typedef enum
48{
49 CPUMODE_16BIT = 1,
50 CPUMODE_32BIT = 2,
51 CPUMODE_64BIT = 3,
52 /** hack forcing the size of the enum to 32-bits. */
53 CPUMODE_MAKE_32BIT_HACK = 0x7fffffff
54} DISCPUMODE;
55/** @} */
56
57/** Prefix byte flags
58 * @{
59 */
60#define PREFIX_NONE 0
61/** non-default address size. */
62#define PREFIX_ADDRSIZE RT_BIT(0)
63/** non-default operand size. */
64#define PREFIX_OPSIZE RT_BIT(1)
65/** lock prefix. */
66#define PREFIX_LOCK RT_BIT(2)
67/** segment prefix. */
68#define PREFIX_SEG RT_BIT(3)
69/** rep(e) prefix (not a prefix, but we'll treat is as one). */
70#define PREFIX_REP RT_BIT(4)
71/** rep(e) prefix (not a prefix, but we'll treat is as one). */
72#define PREFIX_REPNE RT_BIT(5)
73/** REX prefix (64 bits) */
74#define PREFIX_REX RT_BIT(6)
75/** @} */
76
77/** 64 bits prefix byte flags
78 * @{
79 */
80#define PREFIX_REX_OP_2_FLAGS(a) (a - OP_PARM_REX_START)
81#define PREFIX_REX_FLAGS PREFIX_REX_OP_2_FLAGS(OP_PARM_REX)
82#define PREFIX_REX_FLAGS_B PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_B)
83#define PREFIX_REX_FLAGS_X PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_X)
84#define PREFIX_REX_FLAGS_XB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_XB)
85#define PREFIX_REX_FLAGS_R PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_R)
86#define PREFIX_REX_FLAGS_RB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_RB)
87#define PREFIX_REX_FLAGS_RX PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_RX)
88#define PREFIX_REX_FLAGS_RXB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_RXB)
89#define PREFIX_REX_FLAGS_W PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_W)
90#define PREFIX_REX_FLAGS_WB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WB)
91#define PREFIX_REX_FLAGS_WX PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WX)
92#define PREFIX_REX_FLAGS_WXB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WXB)
93#define PREFIX_REX_FLAGS_WR PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WR)
94#define PREFIX_REX_FLAGS_WRB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WRB)
95#define PREFIX_REX_FLAGS_WRX PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WRX)
96#define PREFIX_REX_FLAGS_WRXB PREFIX_REX_OP_2_FLAGS(OP_PARM_REX_WRXB)
97/** @} */
98
99/**
100 * Operand type.
101 */
102#define OPTYPE_INVALID RT_BIT(0)
103#define OPTYPE_HARMLESS RT_BIT(1)
104#define OPTYPE_CONTROLFLOW RT_BIT(2)
105#define OPTYPE_POTENTIALLY_DANGEROUS RT_BIT(3)
106#define OPTYPE_DANGEROUS RT_BIT(4)
107#define OPTYPE_PORTIO RT_BIT(5)
108#define OPTYPE_PRIVILEGED RT_BIT(6)
109#define OPTYPE_PRIVILEGED_NOTRAP RT_BIT(7)
110#define OPTYPE_UNCOND_CONTROLFLOW RT_BIT(8)
111#define OPTYPE_RELATIVE_CONTROLFLOW RT_BIT(9)
112#define OPTYPE_COND_CONTROLFLOW RT_BIT(10)
113#define OPTYPE_INTERRUPT RT_BIT(11)
114#define OPTYPE_ILLEGAL RT_BIT(12)
115#define OPTYPE_RRM_DANGEROUS RT_BIT(14) /**< Some additional dangerouse ones when recompiling raw r0. */
116#define OPTYPE_RRM_DANGEROUS_16 RT_BIT(15) /**< Some additional dangerouse ones when recompiling 16-bit raw r0. */
117#define OPTYPE_RRM_MASK (OPTYPE_RRM_DANGEROUS | OPTYPE_RRM_DANGEROUS_16)
118#define OPTYPE_INHIBIT_IRQS RT_BIT(16) /**< Will or can inhibit irqs (sti, pop ss, mov ss) */
119#define OPTYPE_PORTIO_READ RT_BIT(17)
120#define OPTYPE_PORTIO_WRITE RT_BIT(18)
121#define OPTYPE_INVALID_64 RT_BIT(19) /**< Invalid in 64 bits mode */
122#define OPTYPE_ONLY_64 RT_BIT(20) /**< Only valid in 64 bits mode */
123#define OPTYPE_DEFAULT_64_OP_SIZE RT_BIT(21) /**< Default 64 bits operand size */
124#define OPTYPE_FORCED_64_OP_SIZE RT_BIT(22) /**< Forced 64 bits operand size; regardless of prefix bytes */
125#define OPTYPE_ALL (0xffffffff)
126
127/** Parameter usage flags.
128 * @{
129 */
130#define USE_BASE RT_BIT_64(0)
131#define USE_INDEX RT_BIT_64(1)
132#define USE_SCALE RT_BIT_64(2)
133#define USE_REG_GEN8 RT_BIT_64(3)
134#define USE_REG_GEN16 RT_BIT_64(4)
135#define USE_REG_GEN32 RT_BIT_64(5)
136#define USE_REG_GEN64 RT_BIT_64(6)
137#define USE_REG_FP RT_BIT_64(7)
138#define USE_REG_MMX RT_BIT_64(8)
139#define USE_REG_XMM RT_BIT_64(9)
140#define USE_REG_CR RT_BIT_64(10)
141#define USE_REG_DBG RT_BIT_64(11)
142#define USE_REG_SEG RT_BIT_64(12)
143#define USE_REG_TEST RT_BIT_64(13)
144#define USE_DISPLACEMENT8 RT_BIT_64(14)
145#define USE_DISPLACEMENT16 RT_BIT_64(15)
146#define USE_DISPLACEMENT32 RT_BIT_64(16)
147#define USE_DISPLACEMENT64 RT_BIT_64(17)
148#define USE_RIPDISPLACEMENT32 RT_BIT_64(18)
149#define USE_IMMEDIATE8 RT_BIT_64(19)
150#define USE_IMMEDIATE8_REL RT_BIT_64(20)
151#define USE_IMMEDIATE16 RT_BIT_64(21)
152#define USE_IMMEDIATE16_REL RT_BIT_64(22)
153#define USE_IMMEDIATE32 RT_BIT_64(23)
154#define USE_IMMEDIATE32_REL RT_BIT_64(24)
155#define USE_IMMEDIATE64 RT_BIT_64(25)
156#define USE_IMMEDIATE_ADDR_0_32 RT_BIT_64(26)
157#define USE_IMMEDIATE_ADDR_16_32 RT_BIT_64(27)
158#define USE_IMMEDIATE_ADDR_0_16 RT_BIT_64(28)
159#define USE_IMMEDIATE_ADDR_16_16 RT_BIT_64(29)
160/** DS:ESI */
161#define USE_POINTER_DS_BASED RT_BIT_64(30)
162/** ES:EDI */
163#define USE_POINTER_ES_BASED RT_BIT_64(31)
164#define USE_IMMEDIATE16_SX8 RT_BIT_64(32)
165#define USE_IMMEDIATE32_SX8 RT_BIT_64(33)
166
167#define USE_IMMEDIATE (USE_IMMEDIATE8|USE_IMMEDIATE16|USE_IMMEDIATE32|USE_IMMEDIATE64|USE_IMMEDIATE8_REL|USE_IMMEDIATE16_REL|USE_IMMEDIATE32_REL|USE_IMMEDIATE_ADDR_0_32|USE_IMMEDIATE_ADDR_16_32|USE_IMMEDIATE_ADDR_0_16|USE_IMMEDIATE_ADDR_16_16|USE_IMMEDIATE16_SX8|USE_IMMEDIATE32_SX8)
168
169/** @} */
170
171/** index in {"RAX", "RCX", "RDX", "RBX", "RSP", "RBP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"}
172 * @{
173 */
174#define USE_REG_RAX 0
175#define USE_REG_RCX 1
176#define USE_REG_RDX 2
177#define USE_REG_RBX 3
178#define USE_REG_RSP 4
179#define USE_REG_RBP 5
180#define USE_REG_RSI 6
181#define USE_REG_RDI 7
182#define USE_REG_R8 8
183#define USE_REG_R9 9
184#define USE_REG_R10 10
185#define USE_REG_R11 11
186#define USE_REG_R12 12
187#define USE_REG_R13 13
188#define USE_REG_R14 14
189#define USE_REG_R15 15
190/** @} */
191
192/** index in {"EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI"}
193 * @{
194 */
195#define USE_REG_EAX 0
196#define USE_REG_ECX 1
197#define USE_REG_EDX 2
198#define USE_REG_EBX 3
199#define USE_REG_ESP 4
200#define USE_REG_EBP 5
201#define USE_REG_ESI 6
202#define USE_REG_EDI 7
203/** @} */
204/** index in {"AX", "CX", "DX", "BX", "SP", "BP", "SI", "DI"}
205 * @{
206 */
207#define USE_REG_AX 0
208#define USE_REG_CX 1
209#define USE_REG_DX 2
210#define USE_REG_BX 3
211#define USE_REG_SP 4
212#define USE_REG_BP 5
213#define USE_REG_SI 6
214#define USE_REG_DI 7
215/** @} */
216
217/** index in {"AL", "CL", "DL", "BL", "AH", "CH", "DH", "BH"}
218 * @{
219 */
220#define USE_REG_AL 0
221#define USE_REG_CL 1
222#define USE_REG_DL 2
223#define USE_REG_BL 3
224#define USE_REG_AH 4
225#define USE_REG_CH 5
226#define USE_REG_DH 6
227#define USE_REG_BH 7
228/** @} */
229
230/** index in {ES, CS, SS, DS, FS, GS}
231 * @{
232 */
233#define USE_REG_ES 0
234#define USE_REG_CS 1
235#define USE_REG_SS 2
236#define USE_REG_DS 3
237#define USE_REG_FS 4
238#define USE_REG_GS 5
239/** @} */
240
241#define USE_REG_FP0 0
242#define USE_REG_FP1 1
243#define USE_REG_FP2 2
244#define USE_REG_FP3 3
245#define USE_REG_FP4 4
246#define USE_REG_FP5 5
247#define USE_REG_FP6 6
248#define USE_REG_FP7 7
249
250#define USE_REG_CR0 0
251#define USE_REG_CR1 1
252#define USE_REG_CR2 2
253#define USE_REG_CR3 3
254#define USE_REG_CR4 4
255
256#define USE_REG_DR0 0
257#define USE_REG_DR1 1
258#define USE_REG_DR2 2
259#define USE_REG_DR3 3
260#define USE_REG_DR4 4
261#define USE_REG_DR5 5
262#define USE_REG_DR6 6
263#define USE_REG_DR7 7
264
265#define USE_REG_MMX0 0
266#define USE_REG_MMX1 1
267#define USE_REG_MMX2 2
268#define USE_REG_MMX3 3
269#define USE_REG_MMX4 4
270#define USE_REG_MMX5 5
271#define USE_REG_MMX6 6
272#define USE_REG_MMX7 7
273
274#define USE_REG_XMM0 0
275#define USE_REG_XMM1 1
276#define USE_REG_XMM2 2
277#define USE_REG_XMM3 3
278#define USE_REG_XMM4 4
279#define USE_REG_XMM5 5
280#define USE_REG_XMM6 6
281#define USE_REG_XMM7 7
282
283/** Used by DISQueryParamVal & EMIQueryParamVal
284 * @{
285 */
286#define PARAM_VAL8 RT_BIT(0)
287#define PARAM_VAL16 RT_BIT(1)
288#define PARAM_VAL32 RT_BIT(2)
289#define PARAM_VAL64 RT_BIT(3)
290#define PARAM_VALFARPTR16 RT_BIT(4)
291#define PARAM_VALFARPTR32 RT_BIT(5)
292
293#define PARMTYPE_REGISTER 1
294#define PARMTYPE_ADDRESS 2
295#define PARMTYPE_IMMEDIATE 3
296
297typedef struct
298{
299 uint32_t type;
300 uint32_t size;
301 uint64_t flags;
302
303 union
304 {
305 uint8_t val8;
306 uint16_t val16;
307 uint32_t val32;
308 uint64_t val64;
309
310 struct
311 {
312 uint16_t sel;
313 uint32_t offset;
314 } farptr;
315 } val;
316
317} OP_PARAMVAL;
318/** Pointer to opcode parameter value. */
319typedef OP_PARAMVAL *POP_PARAMVAL;
320
321typedef enum
322{
323 PARAM_DEST,
324 PARAM_SOURCE
325} PARAM_TYPE;
326
327/** @} */
328
329/**
330 * Operand Parameter.
331 */
332typedef struct _OP_PARAMETER
333{
334 int param;
335 uint64_t parval;
336 char szParam[32];
337
338 int32_t disp8, disp16, disp32;
339 uint32_t size;
340
341 int64_t disp64;
342 uint64_t flags;
343
344 union
345 {
346 uint32_t reg_gen;
347 /** ST(0) - ST(7) */
348 uint32_t reg_fp;
349 /** MMX0 - MMX7 */
350 uint32_t reg_mmx;
351 /** XMM0 - XMM7 */
352 uint32_t reg_xmm;
353 /** {ES, CS, SS, DS, FS, GS} */
354 uint32_t reg_seg;
355 /** TR0-TR7 (?) */
356 uint32_t reg_test;
357 /** CR0-CR4 */
358 uint32_t reg_ctrl;
359 /** DR0-DR7 */
360 uint32_t reg_dbg;
361 } base;
362 union
363 {
364 uint32_t reg_gen;
365 } index;
366
367 /** 2, 4 or 8. */
368 uint32_t scale;
369
370} OP_PARAMETER;
371/** Pointer to opcode parameter. */
372typedef OP_PARAMETER *POP_PARAMETER;
373/** Pointer to opcode parameter. */
374typedef const OP_PARAMETER *PCOP_PARAMETER;
375
376
377struct _OPCODE;
378/** Pointer to opcode. */
379typedef struct _OPCODE *POPCODE;
380/** Pointer to const opcode. */
381typedef const struct _OPCODE *PCOPCODE;
382
383typedef DECLCALLBACK(int) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
384typedef FN_DIS_READBYTES *PFN_DIS_READBYTES;
385
386/* forward decl */
387struct _DISCPUSTATE;
388/** Pointer to the disassembler CPU state. */
389typedef struct _DISCPUSTATE *PDISCPUSTATE;
390
391/** Parser callback.
392 * @remark no DECLCALLBACK() here because it's considered to be internal (really, I'm too lazy to update all the functions). */
393typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);
394typedef FNDISPARSE *PFNDISPARSE;
395
396typedef struct _DISCPUSTATE
397{
398 /* Global setting */
399 DISCPUMODE mode;
400
401 /* Per instruction prefix settings */
402 uint32_t prefix;
403 /** segment prefix value. */
404 uint32_t prefix_seg;
405 /** rex prefix value (64 bits only */
406 uint32_t prefix_rex;
407 /** addressing mode (16 or 32 bits). (CPUMODE_*) */
408 DISCPUMODE addrmode;
409 /** operand mode (16 or 32 bits). (CPUMODE_*) */
410 DISCPUMODE opmode;
411
412 OP_PARAMETER param1;
413 OP_PARAMETER param2;
414 OP_PARAMETER param3;
415
416 /** ModRM fields. */
417 union
418 {
419 /* Bitfield view */
420 struct
421 {
422 unsigned Rm : 4;
423 unsigned Reg : 4;
424 unsigned Mod : 2;
425 } Bits;
426 /* unsigned view */
427 unsigned u;
428 } ModRM;
429
430 /** SIB fields. */
431 union
432 {
433 /* Bitfield view */
434 struct
435 {
436 unsigned Base : 4;
437 unsigned Index : 4;
438 unsigned Scale : 2;
439 } Bits;
440 /* unsigned view */
441 unsigned u;
442 } SIB;
443
444 int32_t disp;
445
446 /** First opcode byte of instruction. */
447 uint8_t opcode;
448 /** Last prefix byte (for SSE2 extension tables) */
449 uint8_t lastprefix;
450 RTUINTPTR opaddr;
451 uint32_t opsize;
452#ifndef DIS_CORE_ONLY
453 /** Opcode format string for current instruction. */
454 const char *pszOpcode;
455#endif
456
457 /** Internal: pointer to disassembly function table */
458 PFNDISPARSE *pfnDisasmFnTable;
459 /** Internal: instruction filter */
460 uint32_t uFilter;
461
462 /** Pointer to the current instruction. */
463 PCOPCODE pCurInstr;
464
465 void *apvUserData[3];
466
467 /** Optional read function */
468 PFN_DIS_READBYTES pfnReadBytes;
469#ifdef __L4ENV__
470 jmp_buf *pJumpBuffer;
471#endif /* __L4ENV__ */
472} DISCPUSTATE;
473
474/** Opcode. */
475#pragma pack(4)
476typedef struct _OPCODE
477{
478#ifndef DIS_CORE_ONLY
479 const char *pszOpcode;
480#endif
481 uint8_t idxParse1;
482 uint8_t idxParse2;
483 uint8_t idxParse3;
484 uint16_t opcode;
485 uint16_t param1;
486 uint16_t param2;
487 uint16_t param3;
488
489 uint32_t optype;
490} OPCODE;
491#pragma pack()
492
493
494/**
495 * Disassembles a code block.
496 *
497 * @returns VBox error code
498 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode
499 * set correctly.
500 * @param pvCodeBlock Pointer to the strunction to disassemble.
501 * @param cbMax Maximum number of bytes to disassemble.
502 * @param pcbSize Where to store the size of the instruction.
503 * NULL is allowed.
504 *
505 *
506 * @todo Define output callback.
507 * @todo Using signed integers as sizes is a bit odd. There are still
508 * some GCC warnings about mixing signed and unsigend integers.
509 * @todo Need to extend this interface to include a code address so we
510 * can dissassemble GC code. Perhaps a new function is better...
511 * @remark cbMax isn't respected as a boundry. DISInstr() will read beyond cbMax.
512 * This means *pcbSize >= cbMax sometimes.
513 */
514DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize);
515
516/**
517 * Disassembles one instruction
518 *
519 * @returns VBox error code
520 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode
521 * set correctly.
522 * @param pu8Instruction Pointer to the instrunction to disassemble.
523 * @param u32EipOffset Offset to add to instruction address to get the real virtual address
524 * @param pcbSize Where to store the size of the instruction.
525 * NULL is allowed.
526 * @param pszOutput Storage for disassembled instruction
527 *
528 * @todo Define output callback.
529 */
530DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, char *pszOutput);
531
532/**
533 * Disassembles one instruction
534 *
535 * @returns VBox error code
536 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode
537 * set correctly.
538 * @param pu8Instruction Pointer to the strunction to disassemble.
539 * @param u32EipOffset Offset to add to instruction address to get the real virtual address
540 * @param pcbSize Where to store the size of the instruction.
541 * NULL is allowed.
542 * @param pszOutput Storage for disassembled instruction
543 * @param uFilter Instruction type filter
544 *
545 * @todo Define output callback.
546 */
547DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,
548 char *pszOutput, unsigned uFilter);
549
550/**
551 * Parses one instruction.
552 * The result is found in pCpu.
553 *
554 * @returns VBox error code
555 * @param pCpu Pointer to cpu structure which has DISCPUSTATE::mode set correctly.
556 * @param InstructionAddr Pointer to the instruction to parse.
557 * @param pcbInstruction Where to store the size of the instruction.
558 * NULL is allowed.
559 */
560DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction);
561
562/**
563 * Parses one guest instruction.
564 * The result is found in pCpu and pcbInstruction.
565 *
566 * @returns VBox status code.
567 * @param InstructionAddr Address of the instruction to decode. What this means
568 * is left to the pfnReadBytes function.
569 * @param enmCpuMode The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.
570 * @param pfnReadBytes Callback for reading instruction bytes.
571 * @param pvUser User argument for the instruction reader. (Ends up in apvUserData[0].)
572 * @param pCpu Pointer to cpu structure. Will be initialized.
573 * @param pcbInstruction Where to store the size of the instruction.
574 * NULL is allowed.
575 */
576DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, DISCPUMODE enmCpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser,
577 PDISCPUSTATE pCpu, unsigned *pcbInstruction);
578
579DISDECL(int) DISGetParamSize(PDISCPUSTATE pCpu, POP_PARAMETER pParam);
580DISDECL(int) DISDetectSegReg(PDISCPUSTATE pCpu, POP_PARAMETER pParam);
581DISDECL(uint8_t) DISQuerySegPrefixByte(PDISCPUSTATE pCpu);
582
583/**
584 * Returns the value of the parameter in pParam
585 *
586 * @returns VBox error code
587 * @param pCtx Exception structure pointer
588 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode
589 * set correctly.
590 * @param pParam Pointer to the parameter to parse
591 * @param pParamVal Pointer to parameter value (OUT)
592 * @param parmtype Parameter type
593 *
594 * @note Currently doesn't handle FPU/XMM/MMX/3DNow! parameters correctly!!
595 *
596 */
597DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, POP_PARAMETER pParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype);
598DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, POP_PARAMETER pParam, void **ppReg, size_t *pcbSize);
599
600DISDECL(int) DISFetchReg8(PCPUMCTXCORE pCtx, unsigned reg8, uint8_t *pVal);
601DISDECL(int) DISFetchReg16(PCPUMCTXCORE pCtx, unsigned reg16, uint16_t *pVal);
602DISDECL(int) DISFetchReg32(PCPUMCTXCORE pCtx, unsigned reg32, uint32_t *pVal);
603DISDECL(int) DISFetchReg64(PCPUMCTXCORE pCtx, unsigned reg64, uint64_t *pVal);
604DISDECL(int) DISFetchRegSeg(PCPUMCTXCORE pCtx, unsigned sel, RTSEL *pVal);
605DISDECL(int) DISFetchRegSegEx(PCPUMCTXCORE pCtx, unsigned sel, RTSEL *pVal, PCPUMSELREGHID *ppSelHidReg);
606DISDECL(int) DISWriteReg8(PCPUMCTXCORE pRegFrame, unsigned reg8, uint8_t val8);
607DISDECL(int) DISWriteReg16(PCPUMCTXCORE pRegFrame, unsigned reg32, uint16_t val16);
608DISDECL(int) DISWriteReg32(PCPUMCTXCORE pRegFrame, unsigned reg32, uint32_t val32);
609DISDECL(int) DISWriteReg64(PCPUMCTXCORE pRegFrame, unsigned reg64, uint64_t val64);
610DISDECL(int) DISWriteRegSeg(PCPUMCTXCORE pCtx, unsigned sel, RTSEL val);
611DISDECL(int) DISPtrReg8(PCPUMCTXCORE pCtx, unsigned reg8, uint8_t **ppReg);
612DISDECL(int) DISPtrReg16(PCPUMCTXCORE pCtx, unsigned reg16, uint16_t **ppReg);
613DISDECL(int) DISPtrReg32(PCPUMCTXCORE pCtx, unsigned reg32, uint32_t **ppReg);
614DISDECL(int) DISPtrReg64(PCPUMCTXCORE pCtx, unsigned reg64, uint64_t **ppReg);
615
616__END_DECLS
617
618#endif
619
Note: See TracBrowser for help on using the repository browser.

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