TianoCore EDK2 master
Loading...
Searching...
No Matches
InstructionParsing.h
Go to the documentation of this file.
1
9#ifndef __INSTRUCTION_PARSING_H__
10#define __INSTRUCTION_PARSING_H__
11
12#include <Base.h>
13#include <Uefi.h>
14
15//
16// Instruction REX prefix definition
17//
18typedef union {
19 struct {
20 UINT8 BitB : 1;
21 UINT8 BitX : 1;
22 UINT8 BitR : 1;
23 UINT8 BitW : 1;
24 UINT8 Rex : 4;
25 } Bits;
26
27 UINT8 Uint8;
29
30//
31// Instruction ModRM definition
32//
33typedef union {
34 struct {
35 UINT8 Rm : 3;
36 UINT8 Reg : 3;
37 UINT8 Mod : 2;
38 } Bits;
39
40 UINT8 Uint8;
42
43//
44// Instruction SIB definition
45//
46typedef union {
47 struct {
48 UINT8 Base : 3;
49 UINT8 Index : 3;
50 UINT8 Scale : 2;
51 } Bits;
52
53 UINT8 Uint8;
55
56//
57// Legacy Instruction Prefixes
58//
59#define OVERRIDE_SEGMENT_CS 0x2E
60#define OVERRIDE_SEGMENT_DS 0x3E
61#define OVERRIDE_SEGMENT_ES 0x26
62#define OVERRIDE_SEGMENT_SS 0x36
63#define OVERRIDE_SEGMENT_FS 0x64
64#define OVERRIDE_SEGMENT_GS 0x65
65#define OVERRIDE_OPERAND_SIZE 0x66
66#define OVERRIDE_ADDRESS_SIZE 0x67
67#define LOCK_PREFIX 0xF0
68#define REPNZ_PREFIX 0xF2
69#define REPZ_PREFIX 0xF3
70
71//
72// REX Prefixes
73//
74#define REX_PREFIX_START 0x40
75#define REX_PREFIX_STOP 0x4F
76#define REX_64BIT_OPERAND_SIZE_MASK 0x08
77
78//
79// Two-byte Opcode Flag
80//
81#define TWO_BYTE_OPCODE_ESCAPE 0x0F
82
83#endif