summaryrefslogtreecommitdiffhomepage
path: root/asm/intel64/trivials.cpp
blob: ef537b601ac0a7a020df1eb2e58131fae182bb34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "trivials.h"

#include <asm/assembler.h>

Op_lahf::Op_lahf(): OpSimple({ 0x9F }) {} // Load flags to AH
Op_nop::Op_nop(): OpSimple({ 0x90 }) {} // No operation
Op_ret::Op_ret(): OpSimple({ 0xC3 }) {} // near return; TODO: far return is 0xCB
Op_syscall::Op_syscall(): OpSimple({ 0x0F, 0x05 }) {} // Syscall
Op_ud2::Op_ud2(): OpSimple({ 0x0F, 0x0B }) {} // Undefined Instruction, variant 2: with no operands

namespace {

bool registered {
 registerOp("lahf", [](const Asm::Args& args) -> std::shared_ptr<Op>{
                            return std::make_shared<Op_lahf>();
                           }) &&
 registerOp("nop", [](const Asm::Args& args) -> std::shared_ptr<Op>{
                            return std::make_shared<Op_nop>();
                           }) &&
 registerOp("ret", [](const Asm::Args& args) -> std::shared_ptr<Op>{
                            return std::make_shared<Op_ret>();
                           }) &&
 registerOp("syscall", [](const Asm::Args& args) -> std::shared_ptr<Op>{
                            return std::make_shared<Op_syscall>();
                           }) &&
 registerOp("ud2", [](const Asm::Args& args) -> std::shared_ptr<Op>{
                            return std::make_shared<Op_ud2>();
                           })
};

}