x86csv

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2023 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package x86csv provides means to work with "x86.csv". Only latest version of "x86.csv" format is supported.

Terminology:

given "OPCODE [ARGS...]" line;

Opcode - instruction name/mnemonic/class. Args - instruction operands. Syntax - Opcode with Args.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inst

type Inst struct {
	// Intel syntax (example: "SHR r/m32, imm8").
	Intel string

	// Go assembler syntax (example: "SHRL imm8, r/m32").
	Go string

	// GNU binutils syntax (example: "shrl imm8, r/m32").
	GNU string

	// Binary encoding (example: "C1 /4 ib").
	Encoding string

	// Validity in 32bit mode ("V", "I" or "N.E.").
	Mode32 string

	// Validity in 64bit mode ("V", "I", "N.E.", "N.P.", "N.I." or "N.S.").
	Mode64 string

	// CPUID feature flags required (comma-separated).
	CPUID string

	// Hints about instruction (comma-separated).
	// See "x86spec" package to see detailed overview of possible
	// tags and their meaning.
	Tags string

	// Read/write action of the instruction on its arguments, in Intel order.
	// For example, "rw,r" denotes that "SHR r/m32, imm8" reads and writes
	// its first argument but only reads its second argument.
	Action string

	// Whether Intel syntax has encoding forms distinguished only by
	// operand size, like most arithmetic instructions ("" or "Y").
	Multisize string

	// DataSize is the size of the data operation in bits ("8" for MOVB, "16" for MOVW, and so on).
	DataSize string
}

An Inst describes single x86 instruction encoding form.

func (*Inst) GNUArgs

func (inst *Inst) GNUArgs() []string

GNUArgs returns the arguments in GNU binutils (mostly AT&T) syntax.

func (*Inst) GNUOpcode

func (inst *Inst) GNUOpcode() string

GNUOpcode returns the opcode in GNU binutils (mostly AT&T) syntax.

func (*Inst) GoArgs

func (inst *Inst) GoArgs() []string

GoArgs returns the arguments in Go (Plan9) syntax.

func (*Inst) GoOpcode

func (inst *Inst) GoOpcode() string

GoOpcode returns the opcode in Go (Plan9) syntax.

func (*Inst) HasTag

func (inst *Inst) HasTag(tag string) bool

HasTag reports whether inst tag list contains the specified tag.

func (*Inst) IntelArgs

func (inst *Inst) IntelArgs() []string

IntelArgs returns the arguments in the Intel syntax.

func (*Inst) IntelOpcode

func (inst *Inst) IntelOpcode() string

IntelOpcode returns the opcode in the Intel syntax.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

A Reader reads entries from an "x86.csv" file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a Reader reading from r, which should be of the content of the "x86.csv" (format version=0.2).

func (*Reader) Read

func (r *Reader) Read() (*Inst, error)

Read reads and returns the next Row from the "x86.csv" file. If there is no data left to be read, Read returns {nil, io.EOF}.

func (*Reader) ReadAll

func (r *Reader) ReadAll() ([]*Inst, error)

ReadAll reads all remaining rows from r.

If error has occurred, still returns all rows that have been read during method execution.

A successful call returns err == nil, not err == io.EOF. Because ReadAll is defined to read until EOF, it does not treat end of file as an error to be reported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL