vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

x86dis.h (765B)


      1 // X86 assembly library, adapted for use in VX32
      2 
      3 #include <stdint.h>
      4 
      5 typedef struct xdarg xdarg;
      6 typedef struct xdinst xdinst;
      7 typedef struct xinst xinst;
      8 
      9 struct xinst
     10 {
     11 	int op;
     12 	int flags;
     13 	int arg1;
     14 	int arg2;
     15 	int arg3;
     16 	xinst *sub;
     17 };
     18 
     19 // Decoded instruction argument.
     20 struct xdarg
     21 {
     22 	int op;	// Kind of argument (DA_NONE, ...)
     23 	int reg;
     24 	int index;
     25 	int scale;
     26 	int seg;	// Segment number (>=0) or register (<0).
     27 	uint32_t disp;
     28 };
     29 
     30 // Decoded instruction.
     31 struct xdinst
     32 {
     33 	uint32_t addr;
     34 	uint32_t len;
     35 	char *name;			// Mnemonic.
     36 	int opsz;                       // Operand size: 8, 16, 32
     37 	int flags;
     38 	xdarg arg[3];		// Instruction arguments.
     39 };
     40 
     41 uint8_t*	x86decode(uint8_t *a0, uint8_t *a, xdinst *dec);
     42 int	x86print(char *buf, int nbuf, xdinst *dec);