func GNUSyntax(inst Inst, pc uint64) string
This is the function that is called to print the disassembled instruction in the GNU (AT&T) syntax form.
func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) string
GoSyntax returns the Go assembler syntax for the instruction. The syntax was originally defined by Plan 9. The inst relates to single instruction. 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.
func HandleExtndMnemonic(inst *Inst) string
"func Handleextndmnemonic" - This is the function where the extended mnemonic logic is implemented. This function defines various structures to keep a list of base instructions and their extended mnemonic strings. These structure will also have M-field values and offset values defined, based on their type. HandleExtndMnemonic takes "inst" structure as the input variable. Inst structure will have all the details related to an instruction. Based on the opcode base string, a switch-case statement is executed. In that, based on the M-field value and the offset value of that particular M-field, extended mnemonic string is either searched or constructed by adding couple of extra strings to the base opcode string from one of the structure defined below.
An Arg is a single instruction argument. One of these types: Reg, Base, Index, Disp20, Disp12, Len, Mask, Sign8, Sign16, Sign32, RegIm12, RegIm16, RegIm24, RegIm32.
type Arg interface {
IsArg()
String(pc uint64) string
}
type ArgType int8
const (
TypeUnknown ArgType = iota
TypeReg // integer register
TypeFPReg // floating point register
TypeACReg // access register
TypeCReg // control register
TypeVecReg // vector register
TypeImmUnsigned // unsigned immediate/flag/mask, this is the catch-all type
TypeImmSigned8 // Signed 8-bit Immdediate
TypeImmSigned16 // Signed 16-bit Immdediate
TypeImmSigned32 // Signed 32-bit Immdediate
TypeBaseReg // Base Register for accessing memory
TypeIndexReg // Index Register
TypeDispUnsigned // Displacement 12-bit unsigned for memory address
TypeDispSigned20 // Displacement 20-bit signed for memory address
TypeRegImSigned12 // RegisterImmediate 12-bit signed data
TypeRegImSigned16 // RegisterImmediate 16-bit signed data
TypeRegImSigned24 // RegisterImmediate 24-bit signed data
TypeRegImSigned32 // RegisterImmediate 32-bit signed data
TypeMask // 4-bit Mask
TypeLen // Length of Memory Operand
TypeLast
)
func (t ArgType) GoString() string
func (t ArgType) String() string
An Args holds the instruction arguments. If an instruction has fewer than 6 arguments, the final elements in the array are nil.
type Args [8]Arg
Base represents an 4-bit Base Register field
type Base uint8
const (
B0 Base = iota
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
B11
B12
B13
B14
B15
)
func (Base) IsArg()
func (r Base) String(pc uint64) string
A BitField is a bit-field in a 64-bit double word. Bits are counted from 0 from the MSB to 63 as the LSB.
type BitField struct {
Offs uint8 // the offset of the left-most bit.
Bits uint8 // length in bits.
}
func (b BitField) Parse(i uint64) uint64
Parse extracts the bitfield b from i, and return it as an unsigned integer. Parse will panic if b is invalid.
func (b BitField) ParseSigned(i uint64) int64
ParseSigned extracts the bitfield b from i, and return it as a signed integer. ParseSigned will panic if b is invalid.
func (b BitField) String() string
Disp12 represents an 12-bit Unsigned Displacement
type Disp12 uint16
func (Disp12) IsArg()
func (r Disp12) String(pc uint64) string
Disp20 represents an 20-bit Unsigned Displacement
type Disp20 uint32
func (Disp20) IsArg()
func (r Disp20) String(pc uint64) string
Imm represents an immediate number.
type Imm uint32
func (Imm) IsArg()
func (i Imm) String(pc uint64) string
Index represents an 4-bit Index Register field
type Index uint8
const (
X0 Index = iota
X1
X2
X3
X4
X5
X6
X7
X8
X9
X10
X11
X12
X13
X14
X15
)
func (Index) IsArg()
func (r Index) String(pc uint64) string
type Inst struct {
Op Op // Opcode mnemonic
Enc uint64 // Raw encoding bits
Len int // Length of encoding in bytes.
Args Args // Instruction arguments, in s390x ISA manual order.
}
func Decode(src []byte) (inst Inst, err error)
Decode decodes the leading bytes in src as a single instruction using byte order ord.
func (i Inst) String(pc uint64) string
Len represents an 8-bit type holds 4/8-bit Len argument
type Len uint8
func (Len) IsArg()
func (i Len) String(pc uint64) string
Mask represents an 4-bit mask value
type Mask uint8
func (Mask) IsArg()
func (i Mask) String(pc uint64) string
An Op is an instruction operation.
type Op uint16
const (
A Op
AR
ARK
AY
AG
AGR
AGRK
AGF
AGFR
AXBR
AXT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TZ
VDP
VEC
VECL
VERIM
VERLL
VERLLV
VESLV
VESL
VESRA
VESRAV
VESRL
VESRLV
VX
VFAE
VFEE
VFENE
VFA
WFK
VFCE
VFCH
VFCHE
WFC
VCLFNH
VCLFNL
VCRNF
VCFPS
VCDG
VCFPL
VCDLG
VCFN
VCSFP
VCGD
VCLFP
VCLGD
VCNF
VFD
VFLL
VFLR
VFMAX
VFMIN
VFM
VFMA
VFMS
VFNMA
VFNMS
VFPSO
VFSQ
VFS
VFTCI
VGFM
VGFMA
VGEF
VGEG
VGBM
VGM
VISTR
VL
VLR
VLREP
VLEBRH
VLEBRF
VLEBRG
VLBRREP
VLLEBRZ
VLBR
VLC
VLEH
VLEF
VLEG
VLEB
VLEIH
VLEIF
VLEIG
VLEIB
VLER
VFI
VLGV
VLIP
VLLEZ
VLM
VLP
VLRL
VLRLR
VLBB
VLVG
VLVGP
VLL
VMX
VMXL
VMRH
VMRL
VMN
VMNL
VMAE
VMAH
VMALE
VMALH
VMALO
VMAL
VMAO
VMSP
VMP
VME
VMH
VMLE
VMLH
VMLO
VML
VMO
VMSL
VNN
VNO
VNX
VO
VOC
VPK
VPKLS
VPKS
VPKZ
VPKZR
VPSOP
VPERM
VPDI
VPOPCT
VRP
VREP
VREPI
VSCEF
VSCEG
VSEL
VSDP
VSRP
VSRPR
VSL
VSLB
VSLD
VSLDB
VSRA
VSRAB
VSRD
VSRL
VSRLB
VSEG
VST
VSTEBRH
VSTEBRF
VSTEBRG
VSTBR
VSTEH
VSTEF
VSTEG
VSTEB
VSTER
VSTM
VSTRL
VSTRLR
VSTL
VSTRC
VSTRS
VS
VSCBI
VSP
VSBCBI
VSBI
VSUMG
VSUMQ
VSUM
VTP
VTM
VUPH
VUPLH
VUPLL
VUPL
VUPKZ
VUPKZH
VUPKZL
ZAP
)
func (o Op) String() string
A Reg is a single register. The zero value means R0, not the absence of a register. It also includes special registers.
type Reg uint16
const (
R0 Reg = iota
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
R15
F0
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
A15
C0
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
C13
C14
C15
)
func (Reg) IsArg()
func (r Reg) String(pc uint64) string
RegIm12 represents an 12-bit Register immediate number.
type RegIm12 uint16
func (RegIm12) IsArg()
func (r RegIm12) String(pc uint64) string
RegIm16 represents an 16-bit Register immediate number.
type RegIm16 uint16
func (RegIm16) IsArg()
func (r RegIm16) String(pc uint64) string
RegIm24 represents an 24-bit Register immediate number.
type RegIm24 uint32
func (RegIm24) IsArg()
func (r RegIm24) String(pc uint64) string
RegIm32 represents an 32-bit Register immediate number.
type RegIm32 uint32
func (RegIm32) IsArg()
func (r RegIm32) String(pc uint64) string
Sign16 represents an 16-bit signed immediate number.
type Sign16 int16
func (Sign16) IsArg()
func (i Sign16) String(pc uint64) string
Sign32 represents an 32-bit signed immediate number.
type Sign32 int32
func (Sign32) IsArg()
func (i Sign32) String(pc uint64) string
Sign8 represents an 8-bit signed immediate number.
type Sign8 int8
func (Sign8) IsArg()
func (i Sign8) String(pc uint64) string
type VReg uint8
const (
V0 VReg = iota
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
)
func (VReg) IsArg()
func (r VReg) String(pc uint64) string