chromium/v8/src/diagnostics/x64/disasm-x64.cc

// Copyright 2011 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <cassert>
#include <cinttypes>
#include <cstdarg>
#include <cstdio>

#if V8_TARGET_ARCH_X64

#include "src/base/compiler-specific.h"
#include "src/base/lazy-instance.h"
#include "src/base/memory.h"
#include "src/base/strings.h"
#include "src/codegen/x64/fma-instr.h"
#include "src/codegen/x64/register-x64.h"
#include "src/codegen/x64/sse-instr.h"
#include "src/common/globals.h"
#include "src/diagnostics/disasm.h"

namespace disasm {

enum OperandType {};

//------------------------------------------------------------------
// Tables
//------------------------------------------------------------------
struct ByteMnemonic {};

static const ByteMnemonic two_operands_instr[] =;

static const ByteMnemonic zero_operands_instr[] =;

static const ByteMnemonic call_jump_instr[] =;

static const ByteMnemonic short_immediate_instr[] =;

static const char* const conditional_code_suffix[] =;

enum InstructionType {};

enum Prefixes {};

struct InstructionDesc {};

class InstructionTable {};

InstructionTable::InstructionTable() {}

void InstructionTable::Clear() {}

void InstructionTable::Init() {}

void InstructionTable::CopyTable(const ByteMnemonic bm[],
                                 InstructionType type) {}

void InstructionTable::SetTableRange(InstructionType type, uint8_t start,
                                     uint8_t end, bool byte_size,
                                     const char* mnem) {}

void InstructionTable::AddJumpConditionalShort() {}

namespace {
DEFINE_LAZY_LEAKY_OBJECT_GETTER()
}  // namespace

static const InstructionDesc cmov_instructions[16] =;

static const char* const cmp_pseudo_op[16] =;

namespace {
int8_t Imm8(const uint8_t* data) {}
uint8_t Imm8_U(const uint8_t* data) {}
int16_t Imm16(const uint8_t* data) {}
uint16_t Imm16_U(const uint8_t* data) {}
int32_t Imm32(const uint8_t* data) {}
uint32_t Imm32_U(const uint8_t* data) {}
int64_t Imm64(const uint8_t* data) {}
}  // namespace

//------------------------------------------------------------------------------
// DisassemblerX64 implementation.

// Forward-declare NameOfYMMRegister to keep its implementation with the
// NameConverter methods and register name arrays at bottom.
const char* NameOfYMMRegister(int reg);

// A new DisassemblerX64 object is created to disassemble each instruction.
// The object can only disassemble a single instruction.
class DisassemblerX64 {};

void DisassemblerX64::AppendToBuffer(const char* format, ...) {}

void DisassemblerX64::TryAppendRootRelativeName(int offset) {}

int DisassemblerX64::PrintRightOperandHelper(
    uint8_t* modrmp, RegisterNameMapping direct_register_name) {}

int DisassemblerX64::PrintImmediate(uint8_t* data, OperandSize size) {}

int DisassemblerX64::PrintRightOperand(uint8_t* modrmp) {}

int DisassemblerX64::PrintRightByteOperand(uint8_t* modrmp) {}

int DisassemblerX64::PrintRightXMMOperand(uint8_t* modrmp) {}

int DisassemblerX64::PrintRightAVXOperand(uint8_t* modrmp) {}

// Returns number of bytes used including the current *data.
// Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'.
int DisassemblerX64::PrintOperands(const char* mnem, OperandType op_order,
                                   uint8_t* data) {}

// Returns number of bytes used by machine instruction, including *data byte.
// Writes immediate instructions to 'tmp_buffer_'.
int DisassemblerX64::PrintImmediateOp(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::F6F7Instruction(uint8_t* data) {}

int DisassemblerX64::ShiftInstruction(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::JumpShort(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::JumpConditional(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::JumpConditionalShort(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::SetCC(uint8_t* data) {}

const char* sf_str[4] =;

int DisassemblerX64::AVXInstruction(uint8_t* data) {}

// Returns number of bytes used, including *data.
int DisassemblerX64::FPUInstruction(uint8_t* data) {}

int DisassemblerX64::MemoryFPUInstruction(int escape_opcode, int modrm_byte,
                                          uint8_t* modrm_start) {}

int DisassemblerX64::RegisterFPUInstruction(int escape_opcode,
                                            uint8_t modrm_byte) {}

// Handle all two-byte opcodes, which start with 0x0F.
// These instructions may be affected by an 0x66, 0xF2, or 0xF3 prefix.
int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) {}

// Handle all three-byte opcodes, which start with 0x0F38 or 0x0F3A.
// These instructions may be affected by an 0x66, 0xF2, or 0xF3 prefix, but we
// only have instructions prefixed with 0x66 for now.
int DisassemblerX64::ThreeByteOpcodeInstruction(uint8_t* data) {}

// Mnemonics for two-byte opcode instructions starting with 0x0F.
// The argument is the second byte of the two-byte opcode.
// Returns nullptr if the instruction is not handled here.
const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) {}

// Disassembles the instruction at instr, and writes it into out_buffer.
int DisassemblerX64::InstructionDecode(v8::base::Vector<char> out_buffer,
                                       uint8_t* instr) {}

//------------------------------------------------------------------------------

static const char* const cpu_regs[16] =;

static const char* const byte_cpu_regs[16] =;

static const char* const xmm_regs[16] =;

static const char* const ymm_regs[16] =;

const char* NameConverter::NameOfAddress(uint8_t* addr) const {}

const char* NameConverter::NameOfConstant(uint8_t* addr) const {}

const char* NameConverter::NameOfCPURegister(int reg) const {}

const char* NameConverter::NameOfByteCPURegister(int reg) const {}

const char* NameConverter::NameOfXMMRegister(int reg) const {}

const char* NameOfYMMRegister(int reg) {}

const char* NameConverter::NameInCode(uint8_t* addr) const {}

//------------------------------------------------------------------------------

int Disassembler::InstructionDecode(v8::base::Vector<char> buffer,
                                    uint8_t* instruction) {}

// The X64 assembler does not use constant pools.
int Disassembler::ConstantPoolSizeAt(uint8_t* instruction) {}

void Disassembler::Disassemble(FILE* f, uint8_t* begin, uint8_t* end,
                               UnimplementedOpcodeAction unimplemented_action) {}

}  // namespace disasm

#endif  // V8_TARGET_ARCH_X64