libmicroemu 0.2.0
ARM Microcontroller Emulator Library
Loading...
Searching...
No Matches
nullary_instr.h
1#pragma once
2#include "libmicroemu/internal/decoder/decoder.h"
3#include "libmicroemu/internal/executor/instr/post_exec.h"
4#include "libmicroemu/internal/executor/instr_context.h"
5#include "libmicroemu/internal/executor/instr_exec_results.h"
7#include "libmicroemu/internal/utils/rarg.h"
8#include "libmicroemu/register_details.h"
9#include "libmicroemu/types.h"
10
11namespace libmicroemu::internal {
12
18template <typename TInstrContext> class Nop0Op {
19public:
20 static Result<InstrExecFlagsSet> Call(TInstrContext &ictx, const InstrFlagsSet &iflags) {
21 PostExecAdvancePcAndIt::Call(ictx, iflags);
22 return Ok(kNoInstrExecFlags);
23 }
24};
25
34template <typename TInstrContext> class Dmb0Op {
35public:
36 static Result<InstrExecFlagsSet> Call(TInstrContext &ictx, const InstrFlagsSet &iflags) {
37 PostExecAdvancePcAndIt::Call(ictx, iflags);
38 return Ok(kNoInstrExecFlags);
39 }
40};
41
42template <typename TOp, typename TInstrContext> class NullaryInstr {
43public:
44 using It = typename TInstrContext::It;
45 using Pc = typename TInstrContext::Pc;
46
47 static Result<InstrExecResult> Call(TInstrContext &ictx, const InstrFlagsSet &iflags) {
48 TRY_ASSIGN(condition_passed, InstrExecResult, It::ConditionPassed(ictx.cpua));
49
50 if (!condition_passed) {
51 PostExecAdvancePcAndIt::Call(ictx, iflags);
52 return Ok(InstrExecResult{kNoInstrExecFlags});
53 }
54
55 TRY_ASSIGN(eflags, InstrExecResult, TOp::Call(ictx, iflags));
56 return Ok(InstrExecResult{eflags});
57 }
58
59private:
63 NullaryInstr() = delete;
64
68 ~NullaryInstr() = delete;
69
74 NullaryInstr(const NullaryInstr &r_src) = delete;
75
80 NullaryInstr &operator=(const NullaryInstr &r_src) = delete;
81
86 NullaryInstr(NullaryInstr &&r_src) = delete;
87
92 NullaryInstr &operator=(NullaryInstr &&r_src) = delete;
93};
94
95} // namespace libmicroemu::internal
Dmb instruction.
Definition nullary_instr.h:34
Nop instruction.
Definition nullary_instr.h:18
The libmicroemu::internal namespace contains all classes and functions of libmicroemu which are priva...
Definition bkpt_flags.h:6
Contains the Result class which is used to return the result of a function.
#define TRY_ASSIGN(NAME, OUT_TYPE, CALL)
Try to assign a value to a variable and return an error if the assignment fails.
Definition result.h:123
Definition instr_exec_results.h:23
Definition result.h:15