summaryrefslogtreecommitdiffhomepage
path: root/asm/intel64/codes.h
blob: ba378a64e3a478145836ab27a75a5b6d3c3735ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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);