1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:47:34 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -33,7 +33,7 @@ static bool opcode_has_register_index(u8 op)
return false;
}
static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed)
static void build(InstructionDescriptor* table, u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed)
{
InstructionDescriptor& d = table[op];
@ -111,7 +111,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins
case OP_NEAR_imm:
d.imm1_bytes = CurrentAddressSize;
break;
//default:
// default:
case InvalidFormat:
case MultibyteWithSlash:
case InstructionPrefix:
@ -202,7 +202,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins
}
}
static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler handler, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
InstructionDescriptor& d = table[op];
VERIFY(d.handler == nullptr);
@ -214,7 +214,7 @@ static void build_slash(InstructionDescriptor* table, u8 op, u8 slash, const cha
build(d.slashes, slash, mnemonic, format, handler, lock_prefix_allowed);
}
static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler handler)
static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm, char const* mnemonic, InstructionFormat format, InstructionHandler handler)
{
VERIFY((rm & 0xc0) == 0xc0);
VERIFY(((rm >> 3) & 7) == slash);
@ -235,79 +235,79 @@ static void build_slash_rm(InstructionDescriptor* table, u8 op, u8 slash, u8 rm,
build(d.slashes, rm & 7, mnemonic, format, handler, LockPrefixNotAllowed);
}
static void build_0f(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_0f(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_0f_table16, op, mnemonic, format, impl, lock_prefix_allowed);
build(s_0f_table32, op, mnemonic, format, impl, lock_prefix_allowed);
}
static void build(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_table16, op, mnemonic, format, impl, lock_prefix_allowed);
build(s_table32, op, mnemonic, format, impl, lock_prefix_allowed);
}
static void build(u8 op, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build(u8 op, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_table16, op, mnemonic, format16, impl16, lock_prefix_allowed);
build(s_table32, op, mnemonic, format32, impl32, lock_prefix_allowed);
}
static void build_0f(u8 op, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_0f(u8 op, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_0f_table16, op, mnemonic, format16, impl16, lock_prefix_allowed);
build(s_0f_table32, op, mnemonic, format32, impl32, lock_prefix_allowed);
}
static void build(u8 op, const char* mnemonic16, InstructionFormat format16, InstructionHandler impl16, const char* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build(u8 op, char const* mnemonic16, InstructionFormat format16, InstructionHandler impl16, char const* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_table16, op, mnemonic16, format16, impl16, lock_prefix_allowed);
build(s_table32, op, mnemonic32, format32, impl32, lock_prefix_allowed);
}
static void build_0f(u8 op, const char* mnemonic16, InstructionFormat format16, InstructionHandler impl16, const char* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_0f(u8 op, char const* mnemonic16, InstructionFormat format16, InstructionHandler impl16, char const* mnemonic32, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build(s_0f_table16, op, mnemonic16, format16, impl16, lock_prefix_allowed);
build(s_0f_table32, op, mnemonic32, format32, impl32, lock_prefix_allowed);
}
static void build_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build_slash(s_table16, op, slash, mnemonic, format, impl, lock_prefix_allowed);
build_slash(s_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed);
}
static void build_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build_slash(s_table16, op, slash, mnemonic, format16, impl16, lock_prefix_allowed);
build_slash(s_table32, op, slash, mnemonic, format32, impl32, lock_prefix_allowed);
}
static void build_0f_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_0f_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format16, InstructionHandler impl16, InstructionFormat format32, InstructionHandler impl32, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build_slash(s_0f_table16, op, slash, mnemonic, format16, impl16, lock_prefix_allowed);
build_slash(s_0f_table32, op, slash, mnemonic, format32, impl32, lock_prefix_allowed);
}
static void build_0f_slash(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_0f_slash(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
build_slash(s_0f_table16, op, slash, mnemonic, format, impl, lock_prefix_allowed);
build_slash(s_0f_table32, op, slash, mnemonic, format, impl, lock_prefix_allowed);
}
static void build_slash_rm(u8 op, u8 slash, u8 rm, const char* mnemonic, InstructionFormat format, InstructionHandler impl)
static void build_slash_rm(u8 op, u8 slash, u8 rm, char const* mnemonic, InstructionFormat format, InstructionHandler impl)
{
build_slash_rm(s_table16, op, slash, rm, mnemonic, format, impl);
build_slash_rm(s_table32, op, slash, rm, mnemonic, format, impl);
}
static void build_slash_reg(u8 op, u8 slash, const char* mnemonic, InstructionFormat format, InstructionHandler impl)
static void build_slash_reg(u8 op, u8 slash, char const* mnemonic, InstructionFormat format, InstructionHandler impl)
{
for (int i = 0; i < 8; ++i)
build_slash_rm(op, slash, 0xc0 | (slash << 3) | i, mnemonic, format, impl);
}
static void build_sse_np(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_sse_np(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
if (s_0f_table32[op].format == InvalidFormat) {
build_0f(op, mnemonic, format, impl, lock_prefix_allowed);
@ -321,7 +321,7 @@ static void build_sse_np(u8 op, const char* mnemonic, InstructionFormat format,
build(s_sse_table_np, op, mnemonic, format, impl, lock_prefix_allowed);
}
static void build_sse_66(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_sse_66(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
if (s_0f_table32[op].format != __SSE)
build_0f(op, "__SSE_temp", __SSE, nullptr, lock_prefix_allowed);
@ -329,7 +329,7 @@ static void build_sse_66(u8 op, const char* mnemonic, InstructionFormat format,
build(s_sse_table_66, op, mnemonic, format, impl, lock_prefix_allowed);
}
static void build_sse_f3(u8 op, const char* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
static void build_sse_f3(u8 op, char const* mnemonic, InstructionFormat format, InstructionHandler impl, IsLockPrefixAllowed lock_prefix_allowed = LockPrefixNotAllowed)
{
if (s_0f_table32[op].format != __SSE)
build_0f(op, "__SSE_temp", __SSE, nullptr, lock_prefix_allowed);
@ -1086,44 +1086,44 @@ static void build_sse_f3(u8 op, const char* mnemonic, InstructionFormat format,
build_0f(0xFF, "UD0", OP, &Interpreter::UD0);
}
static const char* register_name(RegisterIndex8);
static const char* register_name(RegisterIndex16);
static const char* register_name(RegisterIndex32);
static const char* register_name(FpuRegisterIndex);
static const char* register_name(SegmentRegister);
static const char* register_name(MMXRegisterIndex);
static const char* register_name(XMMRegisterIndex);
static char const* register_name(RegisterIndex8);
static char const* register_name(RegisterIndex16);
static char const* register_name(RegisterIndex32);
static char const* register_name(FpuRegisterIndex);
static char const* register_name(SegmentRegister);
static char const* register_name(MMXRegisterIndex);
static char const* register_name(XMMRegisterIndex);
const char* Instruction::reg8_name() const
char const* Instruction::reg8_name() const
{
return register_name(static_cast<RegisterIndex8>(register_index()));
}
const char* Instruction::reg16_name() const
char const* Instruction::reg16_name() const
{
return register_name(static_cast<RegisterIndex16>(register_index()));
}
const char* Instruction::reg32_name() const
char const* Instruction::reg32_name() const
{
return register_name(static_cast<RegisterIndex32>(register_index()));
}
String MemoryOrRegisterReference::to_string_o8(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_o8(Instruction const& insn) const
{
if (is_register())
return register_name(reg8());
return String::formatted("[{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_o16(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_o16(Instruction const& insn) const
{
if (is_register())
return register_name(reg16());
return String::formatted("[{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_o32(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_o32(Instruction const& insn) const
{
if (is_register())
return register_name(reg32());
@ -1136,7 +1136,7 @@ String MemoryOrRegisterReference::to_string_fpu_reg() const
return register_name(reg_fpu());
}
String MemoryOrRegisterReference::to_string_fpu_mem(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_fpu_mem(Instruction const& insn) const
{
VERIFY(!is_register());
return String::formatted("[{}]", to_string(insn));
@ -1148,46 +1148,46 @@ String MemoryOrRegisterReference::to_string_fpu_ax16() const
return register_name(reg16());
}
String MemoryOrRegisterReference::to_string_fpu16(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_fpu16(Instruction const& insn) const
{
if (is_register())
return register_name(reg_fpu());
return String::formatted("word ptr [{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_fpu32(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_fpu32(Instruction const& insn) const
{
if (is_register())
return register_name(reg_fpu());
return String::formatted("dword ptr [{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_fpu64(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_fpu64(Instruction const& insn) const
{
if (is_register())
return register_name(reg_fpu());
return String::formatted("qword ptr [{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_fpu80(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_fpu80(Instruction const& insn) const
{
VERIFY(!is_register());
return String::formatted("tbyte ptr [{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_mm(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_mm(Instruction const& insn) const
{
if (is_register())
return register_name(static_cast<MMXRegisterIndex>(m_register_index));
return String::formatted("[{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string_xmm(const Instruction& insn) const
String MemoryOrRegisterReference::to_string_xmm(Instruction const& insn) const
{
if (is_register())
return register_name(static_cast<XMMRegisterIndex>(m_register_index));
return String::formatted("[{}]", to_string(insn));
}
String MemoryOrRegisterReference::to_string(const Instruction& insn) const
String MemoryOrRegisterReference::to_string(Instruction const& insn) const
{
if (insn.a32())
return to_string_a32();
@ -1407,7 +1407,7 @@ static String relative_address(u32 origin, bool x32, i32 imm)
return String::formatted("{:#04x}", w + si);
}
String Instruction::to_string(u32 origin, const SymbolProvider* symbol_provider, bool x32) const
String Instruction::to_string(u32 origin, SymbolProvider const* symbol_provider, bool x32) const
{
StringBuilder builder;
if (has_segment_prefix())
@ -1424,7 +1424,7 @@ String Instruction::to_string(u32 origin, const SymbolProvider* symbol_provider,
return builder.to_string();
}
void Instruction::to_string_internal(StringBuilder& builder, u32 origin, const SymbolProvider* symbol_provider, bool x32) const
void Instruction::to_string_internal(StringBuilder& builder, u32 origin, SymbolProvider const* symbol_provider, bool x32) const
{
if (!m_descriptor) {
builder.appendff("db {:02x}", m_op);
@ -2215,45 +2215,45 @@ String Instruction::mnemonic() const
return m_descriptor->mnemonic;
}
const char* register_name(SegmentRegister index)
char const* register_name(SegmentRegister index)
{
static constexpr const char* names[] = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" };
static constexpr char const* names[] = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" };
return names[(int)index & 7];
}
const char* register_name(RegisterIndex8 register_index)
char const* register_name(RegisterIndex8 register_index)
{
static constexpr const char* names[] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
static constexpr char const* names[] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
return names[register_index & 7];
}
const char* register_name(RegisterIndex16 register_index)
char const* register_name(RegisterIndex16 register_index)
{
static constexpr const char* names[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" };
static constexpr char const* names[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" };
return names[register_index & 7];
}
const char* register_name(RegisterIndex32 register_index)
char const* register_name(RegisterIndex32 register_index)
{
static constexpr const char* names[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" };
static constexpr char const* names[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" };
return names[register_index & 7];
}
const char* register_name(FpuRegisterIndex register_index)
char const* register_name(FpuRegisterIndex register_index)
{
static constexpr const char* names[] = { "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" };
static constexpr char const* names[] = { "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" };
return names[register_index & 7];
}
const char* register_name(MMXRegisterIndex register_index)
char const* register_name(MMXRegisterIndex register_index)
{
static constexpr const char* names[] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" };
static constexpr char const* names[] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" };
return names[register_index & 7];
}
const char* register_name(XMMRegisterIndex register_index)
char const* register_name(XMMRegisterIndex register_index)
{
static constexpr const char* names[] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" };
static constexpr char const* names[] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" };
return names[register_index & 7];
}

View file

@ -17,7 +17,7 @@ namespace X86 {
class Instruction;
class Interpreter;
typedef void (Interpreter::*InstructionHandler)(const Instruction&);
typedef void (Interpreter::*InstructionHandler)(Instruction const&);
class SymbolProvider {
public:
@ -194,7 +194,7 @@ static constexpr unsigned CurrentAddressSize = 0xB33FBABE;
struct InstructionDescriptor {
InstructionHandler handler { nullptr };
bool opcode_has_register_index { false };
const char* mnemonic { nullptr };
char const* mnemonic { nullptr };
InstructionFormat format { InvalidFormat };
bool has_rm { false };
unsigned imm1_bytes { 0 };
@ -352,7 +352,7 @@ protected:
class SimpleInstructionStream final : public InstructionStream {
public:
SimpleInstructionStream(const u8* data, size_t size)
SimpleInstructionStream(u8 const* data, size_t size)
: m_data(data)
, m_size(size)
{
@ -389,7 +389,7 @@ public:
size_t offset() const { return m_offset; }
private:
const u8* m_data { nullptr };
u8 const* m_data { nullptr };
size_t m_offset { 0 };
size_t m_size { 0 };
};
@ -398,18 +398,18 @@ class MemoryOrRegisterReference {
friend class Instruction;
public:
String to_string_o8(const Instruction&) const;
String to_string_o16(const Instruction&) const;
String to_string_o32(const Instruction&) const;
String to_string_o8(Instruction const&) const;
String to_string_o16(Instruction const&) const;
String to_string_o32(Instruction const&) const;
String to_string_fpu_reg() const;
String to_string_fpu_mem(const Instruction&) const;
String to_string_fpu_mem(Instruction const&) const;
String to_string_fpu_ax16() const;
String to_string_fpu16(const Instruction&) const;
String to_string_fpu32(const Instruction&) const;
String to_string_fpu64(const Instruction&) const;
String to_string_fpu80(const Instruction&) const;
String to_string_mm(const Instruction&) const;
String to_string_xmm(const Instruction&) const;
String to_string_fpu16(Instruction const&) const;
String to_string_fpu32(Instruction const&) const;
String to_string_fpu64(Instruction const&) const;
String to_string_fpu80(Instruction const&) const;
String to_string_mm(Instruction const&) const;
String to_string_xmm(Instruction const&) const;
bool is_register() const { return m_register_index != 0x7f; }
@ -425,38 +425,38 @@ public:
u8 rm() const { return m_rm_byte & 0b111; }
template<typename CPU, typename T>
void write8(CPU&, const Instruction&, T);
void write8(CPU&, Instruction const&, T);
template<typename CPU, typename T>
void write16(CPU&, const Instruction&, T);
void write16(CPU&, Instruction const&, T);
template<typename CPU, typename T>
void write32(CPU&, const Instruction&, T);
void write32(CPU&, Instruction const&, T);
template<typename CPU, typename T>
void write64(CPU&, const Instruction&, T);
void write64(CPU&, Instruction const&, T);
template<typename CPU, typename T>
void write128(CPU&, const Instruction&, T);
void write128(CPU&, Instruction const&, T);
template<typename CPU, typename T>
void write256(CPU&, const Instruction&, T);
void write256(CPU&, Instruction const&, T);
template<typename CPU>
typename CPU::ValueWithShadowType8 read8(CPU&, const Instruction&);
typename CPU::ValueWithShadowType8 read8(CPU&, Instruction const&);
template<typename CPU>
typename CPU::ValueWithShadowType16 read16(CPU&, const Instruction&);
typename CPU::ValueWithShadowType16 read16(CPU&, Instruction const&);
template<typename CPU>
typename CPU::ValueWithShadowType32 read32(CPU&, const Instruction&);
typename CPU::ValueWithShadowType32 read32(CPU&, Instruction const&);
template<typename CPU>
typename CPU::ValueWithShadowType64 read64(CPU&, const Instruction&);
typename CPU::ValueWithShadowType64 read64(CPU&, Instruction const&);
template<typename CPU>
typename CPU::ValueWithShadowType128 read128(CPU&, const Instruction&);
typename CPU::ValueWithShadowType128 read128(CPU&, Instruction const&);
template<typename CPU>
typename CPU::ValueWithShadowType256 read256(CPU&, const Instruction&);
typename CPU::ValueWithShadowType256 read256(CPU&, Instruction const&);
template<typename CPU>
LogicalAddress resolve(const CPU&, const Instruction&);
LogicalAddress resolve(const CPU&, Instruction const&);
private:
MemoryOrRegisterReference() = default;
String to_string(const Instruction&) const;
String to_string(Instruction const&) const;
String to_string_a16() const;
String to_string_a32() const;
@ -550,17 +550,17 @@ public:
bool a32() const { return m_a32; }
String to_string(u32 origin, const SymbolProvider* = nullptr, bool x32 = true) const;
String to_string(u32 origin, SymbolProvider const* = nullptr, bool x32 = true) const;
private:
template<typename InstructionStreamType>
Instruction(InstructionStreamType&, bool o32, bool a32);
void to_string_internal(StringBuilder&, u32 origin, const SymbolProvider*, bool x32) const;
void to_string_internal(StringBuilder&, u32 origin, SymbolProvider const*, bool x32) const;
const char* reg8_name() const;
const char* reg16_name() const;
const char* reg32_name() const;
char const* reg8_name() const;
char const* reg16_name() const;
char const* reg32_name() const;
InstructionDescriptor* m_descriptor { nullptr };
mutable MemoryOrRegisterReference m_modrm;
@ -697,7 +697,7 @@ ALWAYS_INLINE u32 MemoryOrRegisterReference::evaluate_sib(const CPU& cpu, Segmen
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, Instruction const& insn, T value)
{
if (is_register()) {
cpu.gpr8(reg8()) = value;
@ -709,7 +709,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write8(CPU& cpu, const Instruction
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, Instruction const& insn, T value)
{
if (is_register()) {
cpu.gpr16(reg16()) = value;
@ -721,7 +721,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write16(CPU& cpu, const Instructio
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, Instruction const& insn, T value)
{
if (is_register()) {
cpu.gpr32(reg32()) = value;
@ -733,7 +733,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write32(CPU& cpu, const Instructio
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, Instruction const& insn, T value)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -741,7 +741,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write64(CPU& cpu, const Instructio
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, Instruction const& insn, T value)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -749,7 +749,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write128(CPU& cpu, const Instructi
}
template<typename CPU, typename T>
ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, const Instruction& insn, T value)
ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, Instruction const& insn, T value)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -757,7 +757,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::write256(CPU& cpu, const Instructi
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read8(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read8(CPU& cpu, Instruction const& insn)
{
if (is_register())
return cpu.const_gpr8(reg8());
@ -767,7 +767,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType8 MemoryOrRegisterReference::read
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::read16(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::read16(CPU& cpu, Instruction const& insn)
{
if (is_register())
return cpu.const_gpr16(reg16());
@ -777,7 +777,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType16 MemoryOrRegisterReference::rea
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::read32(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::read32(CPU& cpu, Instruction const& insn)
{
if (is_register())
return cpu.const_gpr32(reg32());
@ -787,7 +787,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType32 MemoryOrRegisterReference::rea
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::read64(CPU& cpu, Instruction const& insn)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -795,7 +795,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType64 MemoryOrRegisterReference::rea
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::read128(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::read128(CPU& cpu, Instruction const& insn)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -803,7 +803,7 @@ ALWAYS_INLINE typename CPU::ValueWithShadowType128 MemoryOrRegisterReference::re
}
template<typename CPU>
ALWAYS_INLINE typename CPU::ValueWithShadowType256 MemoryOrRegisterReference::read256(CPU& cpu, const Instruction& insn)
ALWAYS_INLINE typename CPU::ValueWithShadowType256 MemoryOrRegisterReference::read256(CPU& cpu, Instruction const& insn)
{
VERIFY(!is_register());
auto address = resolve(cpu, insn);
@ -1085,7 +1085,7 @@ ALWAYS_INLINE void MemoryOrRegisterReference::decode32(InstructionStreamType& st
}
template<typename CPU>
ALWAYS_INLINE LogicalAddress MemoryOrRegisterReference::resolve(const CPU& cpu, const Instruction& insn)
ALWAYS_INLINE LogicalAddress MemoryOrRegisterReference::resolve(const CPU& cpu, Instruction const& insn)
{
if (insn.a32())
return resolve32(cpu, insn.segment_prefix());

File diff suppressed because it is too large Load diff