summaryrefslogtreecommitdiffhomepage
path: root/asm/intel64/codes.h
blob: 9d737e0a3f5bd8bbc9f56efce0f628faefb410db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <cstdint>
#include <string>
#include <vector>

// REX prefix: 0b0100WRXB
std::vector<uint8_t> REX(const std::string& s);

// Manual, page 530
// Reg + Reg/Memory
// disp: optional, only necessary in some cases, e.g. indexed memory access
// returns: Encoded ModRM byte, followed by SIB and disp bytes, if appropriate
std::vector<uint8_t> ModRM(const std::string& reg, const std::string& rm, int32_t disp = 0);

// Just the number of reg, e.g. for encoding inside primary opcode
uint8_t RegNo(const std::string& reg);

std::vector<uint8_t> OpSizePrefix();