### Download and Run instgen Example Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen A workflow example showing how to download the ARM64 XML instruction manual, decompress it, and run the instgen tool against the extracted directory. ```bash curl -o foo.gz https://developer.arm.com/-/cdn-downloads/permalink/Exploration-Tools-A64-ISA/ISA_A64/ISA_A64_xml_A_profile-2025-12.tar.gz mkdir foo (cd foo; tar xfz ../foo.gz) ./instgen -i foo/ISA_A64_xml_A_profile-2025-12 ``` -------------------------------- ### ExpandStates Example Output Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Shows the transformation of strings using ExpandStates. ```text Output: old: "_M_VV_TRUE 0x58 _M_VEX_P_66 _M_VLEN_128 _M_MAP_0F MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM()" new: "VEXVALID=1 0x58 VEX_PREFIX=1 VL=0 MAP=1 MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM()" old: "_M_VV_TRUE 0x58 _M_VEX_P_66 _M_VLEN_128 _M_MAP_0F MOD[0b11] MOD=3 REG[rrr] RM[nnn]" new: "VEXVALID=1 0x58 VEX_PREFIX=1 VL=0 MAP=1 MOD[0b11] MOD=3 REG[rrr] RM[nnn]" old: "_M_VV_TRUE 0x58 _M_VEX_P_66 _M_VLEN_256 _M_MAP_0F MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM()" new: "VEXVALID=1 0x58 VEX_PREFIX=1 VL=1 MAP=1 MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM()" old: "_M_VV_TRUE 0x58 _M_VEX_P_66 _M_VLEN_256 _M_MAP_0F MOD[0b11] MOD=3 REG[rrr] RM[nnn]" new: "VEXVALID=1 0x58 VEX_PREFIX=1 VL=1 MAP=1 MOD[0b11] MOD=3 REG[rrr] RM[nnn]" ``` -------------------------------- ### Reader output example Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Example output showing raw XED objects printed using the Reader. ```text Output: VEXADD (AVX-Q): [0] REG0=XMM_R():w:width_dq:fword64 REG1=XMM_N():r:width_dq:fword64 MEM0:r:width_dq:fword64 COND_MOV_Z (BASE): [0] REG0=GPRv_R():cw MEM0:r:width_v [1] REG0=GPRv_R():cw REG1=GPRv_B():r ``` -------------------------------- ### Example Output for Inst OPERANDS field Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Example output showing the decoded structure of an instruction's OPERANDS field. ```text Output: (explicit) MEM0:r:width_v: name: "MEM0" 32/64bit width: 4/8 bytes (implicit) REG0=AX:rw:SUPP: name: "REG0=AX" (implicit) REG1=DX:w:SUPP: name: "REG1=DX" ``` -------------------------------- ### x86spec CSV line example Source: https://pkg.go.dev/golang.org/x/arch/x86/x86spec Example of a full CSV line output by x86spec. The fields are: Intel, Go, and GNU mnemonics; encoding; validity in 32-bit and 64-bit modes; CPUID flags; tags; read/write actions; operand-size flag; and data size. ```csv "SHR r/m32, imm8","SHRL imm8, r/m32","shrl imm8, r/m32","C1 /5 ib","V","V","","operand32","rw,r","Y","32" ``` -------------------------------- ### Brief String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Brief. ```go func (b Brief) String() string ``` -------------------------------- ### Inst.String Method Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns a pretty-printed representation of the instruction template. ```go func (inst *Inst) String() string ``` -------------------------------- ### Entry String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Entry. ```go func (e Entry) String() string ``` -------------------------------- ### Global encoding descriptions map - AllEncodingDescs Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Global map mapping encoding function descriptions with expanded named bit ranges to example instructions. ```go var AllEncodingDescs = map[string]*InstructionParsed{} ``` -------------------------------- ### NewDatabase Function and Lookup Mapping Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns a Database that loads files from the provided path. Missing lookup files are not errors, but parsing errors are. ```go func NewDatabase(xedPath string) (*Database, error) ``` ```text "$xedPath/all-state.txt" => db.LoadStates() "$xedPath/all-widths.txt" => db.LoadWidths() "$xedPath/all-element-types.txt" => db.LoadXtypes() ``` -------------------------------- ### Initialize PatternSet Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Creates a new PatternSet by decoding a pattern string. ```go func NewPatternSet(pattern string) PatternSet ``` -------------------------------- ### Prefix constants block Source: https://pkg.go.dev/golang.org/x/arch/x86/x86asm Declares the Prefix constants block, which is incomplete in the source. The block starts with 'const (' and is followed by the list of prefix constants, but the closing parenthesis is not shown. ```go const ( ``` -------------------------------- ### WalkInsts Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Walks through all instructions in the XED datafiles, calling the visit function for each instruction. ```APIDOC ## WalkInsts ### Description Walks through all instructions in the XED datafiles, calling the visit function for each instruction. ### Function Signature func WalkInsts(xedPath string, visit func(*Inst)) error ### Parameters - **xedPath** (string) - The path to the XED datafiles directory. - **visit** (func(*Inst)) - The function to call for each instruction. ### Returns - **error** - An error if the walk fails. ``` -------------------------------- ### func (op *Operand) NameRHS() string Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata NameRHS returns the right hand side part of the non-terminal name. Example: NameLHS("REG0=GPRv()") => "GPRv()". ```APIDOC ## func (op *Operand) NameRHS() string ### Description NameRHS returns right hand side part of the non-terminal name. Example: NameLHS("REG0=GPRv()") => "GPRv()". ### Signature func (op *Operand) NameRHS() string ### Parameters - **op** (*Operand) - Receiver operand. ### Returns - **string** - Right hand side part of the non-terminal name. ``` -------------------------------- ### x86spec command-line usage Source: https://pkg.go.dev/golang.org/x/arch/x86/x86spec Run the x86spec command with optional flags to specify the input PDF file (-f, default x86manual.pdf) and the download URL (-u, default https://golang.org/s/x86manual). The manual is downloaded only if the input file is missing. ```bash x86spec [-f file] [-u url] >x86.csv ``` -------------------------------- ### func (op *Operand) NameLHS() string Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata NameLHS returns the left hand side part of the non-terminal name. Example: NameLHS("REG0=GPRv()") => "REG0". ```APIDOC ## func (op *Operand) NameLHS() string ### Description NameLHS returns left hand side part of the non-terminal name. Example: NameLHS("REG0=GPRv()") => "REG0". ### Signature func (op *Operand) NameLHS() string ### Parameters - **op** (*Operand) - Receiver operand. ### Returns - **string** - Left hand side part of the non-terminal name. ``` -------------------------------- ### func (i Inst) String() string Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm String returns a human-readable representation of the instruction, including its opcode mnemonic and arguments. ```APIDOC ## func (i Inst) String() string ### Description String returns a human-readable representation of the instruction, including its opcode mnemonic and arguments. ### Signature ```go func (i Inst) String() string ``` ### Parameters - **i** (Inst) - The instruction to format. ### Returns - **string** - The string representation of the instruction. ``` -------------------------------- ### NewDatabase Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Creates a new Database instance by loading metadata from the specified XED path. ```APIDOC ## NewDatabase ### Description Creates a new Database instance by loading required metadata from the XED datafiles directory. ### Function Signature func NewDatabase(xedPath string) (*Database, error) ### Parameters - **xedPath** (string) - The path to the XED datafiles directory (e.g., $XED/obj/dgen). ### Returns - **Database** (*Database) - The initialized database. - **error** - An error if loading fails. ``` -------------------------------- ### Systemreg String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a Systemreg. ```go func (s Systemreg) String() string ``` -------------------------------- ### Run ppc64map command Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64map Execute the ppc64map tool with an optional format flag and the required CSV input file. ```bash ppc64map [-fmt=format] ppc64.csv ``` -------------------------------- ### func (inst *Inst) IntelArgs() []string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the instruction arguments in Intel syntax. ```APIDOC ## IntelArgs ### Description IntelArgs returns the arguments in the Intel syntax. ### Method Signature `func (inst *Inst) IntelArgs() []string` ### Parameters None. ### Returns - **[]string** - The arguments in Intel syntax. ``` -------------------------------- ### Index String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Index. ```go func (r Index) String(pc uint64) string ``` -------------------------------- ### Object.Opcode Method Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns the instruction name or an empty string if the object fields are not initialized. ```go func (o *Object) Opcode() string ``` -------------------------------- ### instgen Command Usage Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen The basic command-line syntax for running the instgen tool with optional input, output, URL, and version flags. ```bash instgen [-i=inputDir] [-o=outputDir] [-url=url] [-version=version] ``` -------------------------------- ### func (*Inst) String() string Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns a pretty-printed representation of the instruction instance as a valid JSON string. This property is not guaranteed to be preserved. ```APIDOC ## func (*Inst) String() string ### Description Returns a pretty-printed representation of the instruction instance as a valid JSON string. This property is not guaranteed to be preserved. ### Method String ### Signature func (inst *Inst) String() string ### Parameters None ### Returns - **string** - A JSON string representation of the instruction. ``` -------------------------------- ### Inst String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Inst. ```go func (i Inst) String(pc uint64) string ``` -------------------------------- ### Imm_hint String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_hint. ```go func (i Imm_hint) String() string ``` -------------------------------- ### Imm64 String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm64. ```go func (i Imm64) String() string ``` -------------------------------- ### RegSP String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a RegSP. ```go func (r RegSP) String() string ``` -------------------------------- ### ImmAlt Methods Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Methods for the ImmAlt type. ```go func (i ImmAlt) Imm() Imm ``` ```go func (ImmAlt) IsArg() ``` ```go func (i ImmAlt) String() string ``` -------------------------------- ### Arrangement String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Arrangement. ```go func (a Arrangement) String() (result string) ``` -------------------------------- ### Simm String method Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm Returns the string representation of a Simm. ```go func (si Simm) String() string ``` -------------------------------- ### func (inst *Inst) GNUArgs() []string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the instruction arguments in GNU binutils (mostly AT&T) syntax. ```APIDOC ## GNUArgs ### Description GNUArgs returns the arguments in GNU binutils (mostly AT&T) syntax. ### Method Signature `func (inst *Inst) GNUArgs() []string` ### Parameters None. ### Returns - **[]string** - The arguments in GNU syntax. ``` -------------------------------- ### RegX Methods Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Methods for the RegX type. ```go func (RegX) IsArg() func (r RegX) String() string ``` -------------------------------- ### Inst.String Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns a string representation of the instruction. ```APIDOC ## Inst.String ### Description Returns a string representation of the instruction. ### Method Signature func (inst *Inst) String() string ### Returns - **string** - The string representation. ``` -------------------------------- ### Disp20 String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Disp20. ```go func (r Disp20) String(pc uint64) string ``` -------------------------------- ### NewDatabase Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata NewDatabase returns a Database that loads everything it can find in xedPath. Missing lookup file is not an error, but error during parsing of found file is. ```APIDOC ## NewDatabase ### Description NewDatabase returns Database that loads everything it can find in xedPath. Missing lookup file is not an error, but error during parsing of found file is. ### Function Signature func NewDatabase(xedPath string) (*Database, error) ### Parameters - **xedPath** (string) - Required - The path to the XED data directory. ### Returns - **\*Database** - The loaded database. - **error** - An error if parsing fails. ### Lookup - "$xedPath/all-state.txt" => db.LoadStates() - "$xedPath/all-widths.txt" => db.LoadWidths() - "$xedPath/all-element-types.txt" => db.LoadXtypes() ``` -------------------------------- ### func (inst *Inst) IntelOpcode() string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the opcode in Intel syntax. ```APIDOC ## IntelOpcode ### Description IntelOpcode returns the opcode in the Intel syntax. ### Method Signature `func (inst *Inst) IntelOpcode() string` ### Parameters None. ### Returns - **string** - The opcode in Intel syntax. ``` -------------------------------- ### func GNUSyntax(inst Inst, pc uint64) string Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64asm Returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This form typically matches the syntax defined in the Power ISA Reference Manual. ```APIDOC ## GNUSyntax ### Description Returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This form typically matches the syntax defined in the Power ISA Reference Manual. ### Function Signature func GNUSyntax(inst Inst, pc uint64) string ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. ### Returns - **string** - The GNU assembler syntax representation of the instruction. ``` -------------------------------- ### Database Load Methods Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Methods to read XED definitions from an io.Reader and update the database. ```go func (db *Database) LoadStates(r io.Reader) error func (db *Database) LoadWidths(r io.Reader) error func (db *Database) LoadXtypes(r io.Reader) error ``` -------------------------------- ### func (inst *Inst) GoArgs() []string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the instruction arguments in Go (Plan9) syntax. ```APIDOC ## GoArgs ### Description GoArgs returns the arguments in Go (Plan9) syntax. ### Method Signature `func (inst *Inst) GoArgs() []string` ### Parameters None. ### Returns - **[]string** - The arguments in Go syntax. ``` -------------------------------- ### Run ppc64spec command Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64spec Executes the ppc64spec tool to parse the Power ISA PDF and redirect the output to a CSV file. ```bash ppc64spec PowerISA_V2.07_PUBLIC.pdf >ppc64.csv ``` -------------------------------- ### Imm_c String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_c. ```go func (i Imm_c) String() string ``` -------------------------------- ### String method for Simm32 Source: https://pkg.go.dev/golang.org/x/arch/loong64/loong64asm Returns the string representation of a Simm32 value. ```go func (si Simm32) String() string ``` -------------------------------- ### Args Type Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Holds the instruction arguments, with a fixed size of 5 elements. ```go type Args [5]Arg ``` -------------------------------- ### Database WidthSize Method Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Translates a width string to a size string using the desired OperandSizeMode. ```go func (db *Database) WidthSize(width string, m OperandSizeMode) string ``` -------------------------------- ### Box String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Box. ```go func (b Box) String() string ``` -------------------------------- ### Imm String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Imm. ```go func (i Imm) String(pc uint64) string ``` -------------------------------- ### ExtShift String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an ExtShift. ```go func (extShift ExtShift) String() string ``` -------------------------------- ### Imm_fp String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_fp. ```go func (i Imm_fp) String() string ``` -------------------------------- ### x86map command invocation with format flag Source: https://pkg.go.dev/golang.org/x/arch/x86/x86map Runs x86map on x86.csv, optionally specifying the output format with -fmt. ```text x86map [-fmt=format] x86.csv ``` -------------------------------- ### Element String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Element. ```go func (e Element) String() string ``` -------------------------------- ### Index IsArg method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the IsArg method for Index. ```go func (Index) IsArg() ``` -------------------------------- ### Imm_option String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_option. ```go func (i Imm_option) String() string ``` -------------------------------- ### AddressSizeMode Type and Constants Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Describes the address size mode (67H prefix) with possible values. ```go type AddressSizeMode int const ( AddrSize16 AddressSizeMode = iota AddrSize32 AddrSize64 ) ``` -------------------------------- ### Definition String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Definition. ```go func (d Definition) String() string ``` -------------------------------- ### func IntelSyntax(inst Inst, pc uint64, symname SymLookup) string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86asm IntelSyntax returns the Intel assembler syntax for the instruction, as defined by Intel's XED tool. ```APIDOC ## func IntelSyntax ### Description IntelSyntax returns the Intel assembler syntax for the instruction, as defined by Intel's XED tool. ### Function Signature ```go func IntelSyntax(inst Inst, pc uint64, symname SymLookup) string ``` ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. - **symname** (SymLookup) - A function to look up symbol names. ### Return Values - **string** - The Intel assembler syntax representation of the instruction. ``` -------------------------------- ### Sign32 String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm The String method for Sign32 returns a string representation of the immediate, given a program counter. ```go func (i Sign32) String(pc uint64) string ``` -------------------------------- ### AddressSizeMode String Method Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns the bit size string for the address size mode, panicking on illegal enumerations. ```go func (asz AddressSizeMode) String() string ``` -------------------------------- ### RegOffset String method Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm Returns the string representation of a RegOffset. ```go func (regofs RegOffset) String() string ``` -------------------------------- ### func (inst *Inst) GNUOpcode() string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the opcode in GNU binutils (mostly AT&T) syntax. ```APIDOC ## GNUOpcode ### Description GNUOpcode returns the opcode in GNU binutils (mostly AT&T) syntax. ### Method Signature `func (inst *Inst) GNUOpcode() string` ### Parameters None. ### Returns - **string** - The opcode in GNU syntax. ``` -------------------------------- ### ImmShift String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an ImmShift. ```go func (is ImmShift) String() string ``` -------------------------------- ### MemImmediate String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a MemImmediate. ```go func (m MemImmediate) String() string ``` -------------------------------- ### WalkInsts Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata WalkInsts calls the visit function for each XED instruction found at $xedPath/all-dec-instructions.txt. ```APIDOC ## WalkInsts ### Description WalkInsts calls visit function for each XED instruction found at $xedPath/all-dec-instructions.txt. ### Function Signature func WalkInsts(xedPath string, visit func(*Inst)) error ### Parameters - **xedPath** (string) - Required - The path to the XED data directory. - **visit** (func(*Inst)) - Required - The function to call for each instruction. ### Returns - **error** - An error if the file cannot be read or parsed. ``` -------------------------------- ### GNUOpcode method Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Method signature for GNUOpcode, which returns the opcode in GNU binutils (mostly AT&T) syntax. ```go func (inst *Inst) GNUOpcode() string ``` -------------------------------- ### func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) string Source: https://pkg.go.dev/golang.org/x/arch/loong64/loong64asm Returns the Go assembler syntax for the instruction, originally defined by Plan 9. The pc is used for expanding PC-relative addresses, and symname queries the symbol table for the program being disassembled. ```APIDOC ## GoSyntax ### Description Returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled. ### Function Signature `func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) string` ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. - **symname** (func(uint64) (string, uint64)) - A function that, given a target address, returns the name and base address of the symbol containing the target, or "", 0 if none. ### Returns - **string** - The Go assembler syntax representation of the instruction. ``` -------------------------------- ### MemExtend String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a MemExtend. ```go func (m MemExtend) String() string ``` -------------------------------- ### RegisterWithArrangementAndIndex String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a RegisterWithArrangementAndIndex. ```go func (r RegisterWithArrangementAndIndex) String() string ``` -------------------------------- ### IntelOpcode method Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Method signature for IntelOpcode, which returns the opcode in Intel syntax. ```go func (inst *Inst) IntelOpcode() string ``` -------------------------------- ### Imm_prfop String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_prfop. ```go func (i Imm_prfop) String() string ``` -------------------------------- ### func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64), text io.ReaderAt) string Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Returns the Go assembler syntax for the instruction, originally defined by Plan 9. It uses the program counter and symbol table to expand PC-relative addresses. ```APIDOC ## GoSyntax ### Description Returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled. Given a target address it returns the name and base address of the symbol containing the target, if any; otherwise it returns "", 0. The reader r should read from the text segment using text addresses as offsets; it is used to display pc-relative loads as constant loads. ### Function Signature ```go func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64), text io.ReaderAt) string ``` ### Parameters - **inst** (Inst) - Required - The instruction to format. - **pc** (uint64) - Required - The program counter of the instruction. - **symname** (func(uint64) (string, uint64)) - Required - A function that queries the symbol table. Given a target address, it returns the name and base address of the symbol containing the target, or "", 0 if none. - **text** (io.ReaderAt) - Required - A reader that reads from the text segment using text addresses as offsets. ### Returns - **string** - The Go assembler syntax representation of the instruction. ``` -------------------------------- ### RegList Methods Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Methods for the RegList type. ```go func (RegList) IsArg() func (r RegList) String() string ``` -------------------------------- ### type Imm_hint Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Represents an immediate for hints. It has a String method. ```APIDOC ## Imm_hint ### Description Represents an immediate for hints. ### Type Definition ```go type Imm_hint uint8 ``` ### Methods #### func (i Imm_hint) String() string Returns a string representation of the immediate. ``` -------------------------------- ### armmap usage: run against arm.csv Source: https://pkg.go.dev/golang.org/x/arch/arm/armmap Run the armmap command with the instruction set CSV file as an argument. Uses the default text output format. ```text armmap [-fmt=format] arm.csv ``` -------------------------------- ### IntelArgs method Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Method signature for IntelArgs, which returns the arguments in Intel syntax. ```go func (inst *Inst) IntelArgs() []string ``` -------------------------------- ### Imm_clrex String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_clrex. ```go func (i Imm_clrex) String() string ``` -------------------------------- ### Label.String method Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64asm Returns the string representation of the Label. ```go func (l Label) String() string ``` -------------------------------- ### func GNUSyntax(inst Inst) string Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the GNU assembler syntax for the given instruction, as defined by GNU binutils. This form typically matches the syntax defined in the ARM Reference Manual. ```APIDOC ## GNUSyntax ### Description Returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This form typically matches the syntax defined in the ARM Reference Manual. ### Function Signature func GNUSyntax(inst Inst) string ### Parameters - **inst** (Inst) - The instruction to format. ### Returns - **string** - The GNU assembler syntax representation of the instruction. ``` -------------------------------- ### func GNUSyntax(inst Inst) string Source: https://pkg.go.dev/golang.org/x/arch/loong64/loong64asm Returns the GNU assembler syntax for the given instruction, as defined by GNU binutils. This form typically matches the syntax defined in the Loong64 Reference Manual. ```APIDOC ## GNUSyntax ### Description Returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This form typically matches the syntax defined in the Loong64 Reference Manual. ### Function Signature `func GNUSyntax(inst Inst) string` ### Parameters - **inst** (Inst) - The instruction to format. ### Returns - **string** - The GNU assembler syntax representation of the instruction. ``` -------------------------------- ### Register constants Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm A comprehensive list of ARM64 register constants including W, X, B, H, S, D, Q, and V registers, as well as SP and WSP mappings. ```go const ( W0 Reg = iota W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 W11 W12 W13 W14 W15 W16 W17 W18 W19 W20 W21 W22 W23 W24 W25 W26 W27 W28 W29 W30 WZR X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 XZR B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 B11 B12 B13 B14 B15 B16 B17 B18 B19 B20 B21 B22 B23 B24 B25 B26 B27 B28 B29 B30 B31 H0 H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 H13 H14 H15 H16 H17 H18 H19 H20 H21 H22 H23 H24 H25 H26 H27 H28 H29 H30 H31 S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 Q22 Q23 Q24 Q25 Q26 Q27 Q28 Q29 Q30 Q31 V0 V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 WSP = WZR // These are different registers with the same encoding. SP = XZR // These are different registers with the same encoding. ) ``` -------------------------------- ### C String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for C. ```go func (c C) String() string ``` -------------------------------- ### CPUMode Type and Constants Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Describes availability in certain CPU modes. ```go type CPUMode int const ( Mode16 CPUMode = iota Mode32 Mode64 ) ``` -------------------------------- ### Offset.String method Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64asm Returns the string representation of the Offset. ```go func (o Offset) String() string ``` -------------------------------- ### Run s390xspec command Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xspec Executes the s390xspec tool to process the PDF manual and redirect the output to a CSV file. ```bash s390xspec z_Architecture_Principles_of_Operation.pdf > s390x.csv ``` -------------------------------- ### List ppc64map output formats Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64map Supported output formats for the ppc64map tool. ```text text (default) - print decoding tree in text form decoder - print decoding tables for the ppc64asm package encoder - generate a self-contained file which can be used to encode go obj.Progs into machine code asm - generate a gnu asm file which can be compiled by gcc containing all opcodes discovered in ppc64.csv using macro friendly arguments. ``` -------------------------------- ### func GNUSyntax(inst Inst) string Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm Returns the GNU assembler syntax for the given instruction, as defined by GNU binutils. This form typically matches the syntax in the RISC-V Instruction Set Manual. ```APIDOC ## GNUSyntax(inst Inst) string ### Description Returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This form typically matches the syntax defined in the RISC-V Instruction Set Manual. ### Function Signature ```go func GNUSyntax(inst Inst) string ``` ### Parameters - **inst** (Inst) - Required - The instruction to format. ### Returns - **string** - The GNU assembler syntax representation of the instruction. ``` -------------------------------- ### Disp20 IsArg method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the IsArg method for Disp20. ```go func (Disp20) IsArg() ``` -------------------------------- ### WalkInsts Function Signature Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Calls the visit function for each XED instruction found at the specified path. ```go func WalkInsts(xedPath string, visit func(*Inst)) error ``` -------------------------------- ### RegPtr String method Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm Returns the string representation of a RegPtr. Added in v0.22.0. ```go func (regPtr RegPtr) String() string ``` -------------------------------- ### func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64), text io.ReaderAt) string Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the Go assembler syntax for the instruction, originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled, and the text reader is used to display pc-relative loads as constant loads. ```APIDOC ## GoSyntax ### Description Returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled. Given a target address it returns the name and base address of the symbol containing the target, if any; otherwise it returns "", 0. The reader text should read from the text segment using text addresses as offsets; it is used to display pc-relative loads as constant loads. ### Function Signature func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64), text io.ReaderAt) string ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. - **symname** (func(uint64) (string, uint64)) - A function that queries the symbol table for the program being disassembled. Given a target address it returns the name and base address of the symbol containing the target, if any; otherwise it returns "", 0. - **text** (io.ReaderAt) - A reader that reads from the text segment using text addresses as offsets. ### Returns - **string** - The Go assembler syntax representation of the instruction. ``` -------------------------------- ### func GNUSyntax(inst Inst, pc uint64) string Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm This function returns the disassembled instruction in GNU (AT&T) syntax form. It takes an Inst and the program counter value as input. ```APIDOC ## GNUSyntax ### Description Returns the disassembled instruction in GNU (AT&T) syntax form. ### Function Signature func GNUSyntax(inst Inst, pc uint64) string ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter value. ### Returns - **string** - The GNU syntax representation of the instruction. ``` -------------------------------- ### Imm_dcps String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of an Imm_dcps. ```go func (i Imm_dcps) String() string ``` -------------------------------- ### Database.LoadStates Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata LoadStates reads XED states definitions from r and updates db. "states" are simple macro substitutions without parameters. ```APIDOC ## Database.LoadStates ### Description LoadStates reads XED states definitions from r and updates db. "states" are simple macro substitutions without parameters. ### Method Signature func (db *Database) LoadStates(r io.Reader) error ### Parameters - **r** (io.Reader) - Required - The reader containing the states definitions. ### Returns - **error** - An error if parsing fails. ``` -------------------------------- ### String method for VType Source: https://pkg.go.dev/golang.org/x/arch/riscv64/riscv64asm Returns the string representation of the VType. ```go func (vtype VType) String() string ``` -------------------------------- ### Reg Methods Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Methods for the Reg type. ```go func (Reg) IsArg() func (r Reg) String() string ``` -------------------------------- ### GNUArgs method Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Method signature for GNUArgs, which returns the arguments in GNU binutils (mostly AT&T) syntax. ```go func (inst *Inst) GNUArgs() []string ``` -------------------------------- ### Len String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Len. ```go func (i Len) String(pc uint64) string ``` -------------------------------- ### Base.String Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Returns a string representation of the Base register. ```APIDOC ## Base.String ### Description Returns a string representation of the Base register. ### Function Signature func (r Base) String(pc uint64) string ### Parameters - **r** (Base) - The receiver. - **pc** (uint64) - The program counter value. ### Returns - **string** - The string representation. ``` -------------------------------- ### Disp12 String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Disp12. ```go func (r Disp12) String(pc uint64) string ``` -------------------------------- ### func (inst *Inst) GoOpcode() string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86csv Returns the opcode in Go (Plan9) syntax. ```APIDOC ## GoOpcode ### Description GoOpcode returns the opcode in Go (Plan9) syntax. ### Method Signature `func (inst *Inst) GoOpcode() string` ### Parameters None. ### Returns - **string** - The opcode in Go syntax. ``` -------------------------------- ### Classes String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Classes. ```go func (c Classes) String() string ``` -------------------------------- ### func GNUSyntax(inst Inst, pc uint64, symname SymLookup) string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86asm GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This general form is often called 'AT&T syntax' as a reference to AT&T System V Unix. ```APIDOC ## func GNUSyntax ### Description GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils. This general form is often called 'AT&T syntax' as a reference to AT&T System V Unix. ### Function Signature ```go func GNUSyntax(inst Inst, pc uint64, symname SymLookup) string ``` ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. - **symname** (SymLookup) - A function to look up symbol names. ### Return Values - **string** - The GNU assembler syntax representation of the instruction. ``` -------------------------------- ### Shift String Method Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm Returns the string representation of a Shift. ```go func (s Shift) String() string ``` -------------------------------- ### type Imm_option Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Represents an immediate option. It has a String method. ```APIDOC ## Imm_option ### Description Represents an immediate option. ### Type Definition ```go type Imm_option uint8 ``` ### Methods #### func (i Imm_option) String() string Returns a string representation of the immediate option. ``` -------------------------------- ### Inst Structure Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Represents a single instruction. ```go type Inst struct { Op Op // Opcode mnemonic Enc uint32 // Raw encoding bits. Args Args // Instruction arguments, in ARM manual order. } ``` -------------------------------- ### AsmTemplate String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for AsmTemplate, returning a string representation. ```go func (at AsmTemplate) String() string ``` -------------------------------- ### func (*Object) Opcode() string Source: https://pkg.go.dev/golang.org/x/arch/x86/xeddata Returns the instruction name (opcode) or an empty string if the appropriate Object fields are not initialized. ```APIDOC ## func (*Object) Opcode() string ### Description Returns the instruction name (opcode) or an empty string if the appropriate Object fields are not initialized. ### Method Opcode ### Signature func (o *Object) Opcode() string ### Parameters None ### Returns - **string** - The instruction name, or an empty string if not initialized. ``` -------------------------------- ### Op constants Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Defines a list of Op constants for various s390x instructions. ```go const ( A Op AR ARK AY AG AGR AGRK AGF AGFR AXBR AXTR AXTRA ADB ADBR ADTR ADTRA AEB AEBR AP AH AHY AGH AHI AGHI AHHHR AHHLR AFI AHIK ASI AGHIK AGFI AGSI AIH AL ALR ALRK ALY ALG ALGR ALGRK ALGF ALGFR ALHHHR ALHHLR ALFI ALGFI ALC ALCR ALCG ALCGR ALHSIK ALSI ALGHSIK ALGSI ALSIH ALSIHN AXR AD ADR AE AER AW AWR AU AUR N NR NRK NY NG NGR NGRK NC NI NIY ) ``` -------------------------------- ### DocVar String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for DocVar. ```go func (dv DocVar) String() string ``` -------------------------------- ### RegisterWithArrangement String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a RegisterWithArrangement. ```go func (r RegisterWithArrangement) String() string ``` -------------------------------- ### Run s390map command Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xmap Basic usage of the s390map command to process an s390x.csv file with an optional format flag. ```bash s390map [-fmt=format] s390x.csv ``` -------------------------------- ### Base String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for Base, returning a string representation given a program counter. ```go func (r Base) String(pc uint64) string ``` -------------------------------- ### func GoSyntax(inst Inst, pc uint64, symname SymLookup) string Source: https://pkg.go.dev/golang.org/x/arch/x86/x86asm GoSyntax returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled. ```APIDOC ## func GoSyntax ### Description GoSyntax returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The pc is the program counter of the instruction, used for expanding PC-relative addresses into absolute ones. The symname function queries the symbol table for the program being disassembled. Given a target address it returns the name and base address of the symbol containing the target, if any; otherwise it returns "", 0. ### Function Signature ```go func GoSyntax(inst Inst, pc uint64, symname SymLookup) string ``` ### Parameters - **inst** (Inst) - The instruction to format. - **pc** (uint64) - The program counter of the instruction. - **symname** (SymLookup) - A function to look up symbol names. ### Return Values - **string** - The Go assembler syntax representation of the instruction. ``` -------------------------------- ### BitFields.String method Source: https://pkg.go.dev/golang.org/x/arch/ppc64/ppc64asm Returns the string representation of the BitFields. ```go func (bs BitFields) String() string ``` -------------------------------- ### Print Pentium II and P6 instruction syntaxes with csv2tsv and awk Source: https://pkg.go.dev/golang.org/x/arch/x86/x86spec Uses csv2tsv to convert the CSV to tab-separated format, then awk filters rows where the 5th field is 'PentiumII' or 'P6' and prints the first field (instruction syntax). ```shell csv2tsv x86.csv | awk -F'\t' '$5 == "PentiumII" || $5 == "P6" { print $1 }' ``` -------------------------------- ### ArgType.GoString Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Returns a Go-syntax representation of the ArgType value. ```APIDOC ## ArgType.GoString ### Description Returns a Go-syntax representation of the ArgType value. ### Function Signature func (t ArgType) GoString() string ### Parameters - **t** (ArgType) - The receiver. ### Returns - **string** - The Go-syntax string representation. ``` -------------------------------- ### ParseXMLFiles Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Parses XML files from a directory and returns a list of parsed instruction pointers. ```APIDOC ## ParseXMLFiles ### Description Parses XML files from a directory and returns a list of parsed instruction pointers. ### Function Signature func ParseXMLFiles(dir string) []*InstructionParsed ### Parameters - **dir** (string) - Required - Directory containing the XML files. ### Return Values - **[]*InstructionParsed** - List of parsed instruction pointers. ``` -------------------------------- ### Sign8 String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm The String method for Sign8 returns a string representation of the immediate, given a program counter. ```go func (i Sign8) String(pc uint64) string ``` -------------------------------- ### List s390map output formats Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xmap Available output formats for the s390map command. ```text text (default) - print decoding tree in text form decoder - print decoding tables for the s390xasm package encoder - generate a self-contained file which can be used to encode go obj.Progs into machine code asm - generate a GNU asm file which can be compiled by gcc containing all opcodes discovered in s390x.csv using macro friendly arguments. ``` -------------------------------- ### Brief struct definition Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Defines the Brief struct that represents a element, containing a brief description. ```go type Brief struct { Para []Para `xml:"para"` } ``` -------------------------------- ### type Mode Source: https://pkg.go.dev/golang.org/x/arch/arm/armasm A Mode is an ARM mode. ```APIDOC ## Mode ### Description A Mode is an ARM mode. ### Type Definition ```go type Mode uint8 ``` t ### Methods - **String() string** - Returns a string representation of the mode. ``` -------------------------------- ### Desc String method Source: https://pkg.go.dev/golang.org/x/arch/arm64/instgen/xmlspec Declares the String method for Desc. ```go func (d Desc) String() string ``` -------------------------------- ### Sign16 String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm The String method for Sign16 returns a string representation of the immediate, given a program counter. ```go func (i Sign16) String(pc uint64) string ``` -------------------------------- ### Cond String Method Source: https://pkg.go.dev/golang.org/x/arch/arm64/arm64asm Returns the string representation of a Cond. ```go func (c Cond) String() string ``` -------------------------------- ### ArgType String method Source: https://pkg.go.dev/golang.org/x/arch/s390x/s390xasm Declares the String method for ArgType, returning a string representation. ```go func (t ArgType) String() string ```