NAME
Asm::X86 - List of instructions and registers of Intel x86-compatible processors, validating and converting instructions and memory references.
VERSION
Version 0.21
DESCRIPTION
This module provides the user with the ability to check whether a given string represents an x86 processor register or instruction. It also provides lists of registers and instructions and allows to check if a given expression is a valid addressing mode. Other subrotuines include converting between AT&T and Intel syntaxes.
SYNOPSIS
use Asm::X86 qw(@instr is_instr);
print "YES" if is_instr ("MOV");
EXPORT
Nothing is exported by default.
The following functions are exported on request:
is_reg_intel is_reg8_intel is_reg16_intel is_reg32_intel
is_reg64_intel is_reg_mm_intel is_segreg_intel is_reg_fpu_intel
is_reg_opmask_intel
is_reg_att is_reg8_att is_reg16_att is_reg32_att
is_reg64_att is_reg_mm_att is_segreg_att is_reg_fpu_att
is_reg_opmask_att
is_reg is_reg8 is_reg16 is_reg32 is_reg64 is_reg_mm is_segreg is_reg_fpu
is_reg_opmask
is_instr_intel is_instr_att is_instr
is_valid_16bit_addr_intel is_valid_32bit_addr_intel is_valid_64bit_addr_intel is_valid_addr_intel
is_valid_16bit_addr_att is_valid_32bit_addr_att is_valid_64bit_addr_att is_valid_addr_att
is_valid_16bit_addr is_valid_32bit_addr is_valid_64bit_addr is_valid_addr
conv_att_addr_to_intel conv_intel_addr_to_att
conv_att_instr_to_intel conv_intel_instr_to_att
is_addressable32_intel is_addressable32_att is_addressable32
is_r32_in64_intel is_r32_in64_att is_r32_in64
is_att_suffixed_instr is_att_suffixed_instr_fpu add_att_suffix_instr
These check if the given string parameter belongs to the specified
class of registers or instructions or is a vaild addressing mode.
The "convert*" functions can be used to convert the given instruction (including the
operands)/addressing mode between AT&T and Intel syntaxes.
The "_intel" and "_att" suffixes mean the Intel and AT&T syntaxes, respectively.
No suffix means either Intel or AT&T.
The following arrays are exported on request:
@regs8_intel @regs16_intel @segregs_intel @regs32_intel @regs64_intel @regs_mm_intel
@regs_intel @regs_fpu_intel @regs_opmask_intel
@regs8_att @regs16_att @segregs_att @regs32_att @regs64_att @regs_mm_att
@regs_att @regs_fpu_att @regs_opmask_att
@instr_intel @instr_att @instr
These contain all register and instruction mnemonic names as lower-case strings.
The "_intel" and "_att" suffixes mean the Intel and AT&T syntaxes, respectively.
No suffix means either Intel or AT&T.
DATA
@regs8_intel
A list of 8-bit registers (as strings) in Intel syntax.
@regs8_att
A list of 8-bit registers (as strings) in AT&T syntax.
@segregs_intel
A list of segment registers (as strings) in Intel syntax.
@segregs_att
A list of segment registers (as strings) in AT&T syntax.
@regs16_intel
A list of 16-bit registers (as strings), including the segment registers, in Intel syntax.
@regs16_att
A list of 16-bit registers (as strings), including the segment registers, in AT&T syntax.
@regs32_intel
A list of 32-bit registers (as strings) in Intel syntax.
@regs32_att
A list of 32-bit registers (as strings) in AT&T syntax.
@regs_fpu_intel
A list of FPU registers (as strings) in Intel syntax.
@regs_fpu_att
A list of FPU registers (as strings) in AT&T syntax.
@regs64_intel
A list of 64-bit registers (as strings) in Intel syntax.
@regs64_att
A list of 64-bit registers (as strings) in AT&T syntax.
@regs_mm_intel
A list of multimedia (MMX/3DNow!/SSEn) registers (as strings) in Intel syntax.
@regs_mm_att
A list of multimedia (MMX/3DNow!/SSEn) registers (as strings) in AT&T syntax.
@regs_opmask_intel
A list of opmask registers (as strings) in Intel syntax.
@regs_opmask_att
A list of opmask registers (as strings) in AT&T syntax.
@regs_intel
A list of all x86 registers (as strings) in Intel syntax.
@regs_att
A list of all x86 registers (as strings) in AT&T syntax.
@instr_intel
A list of all x86 instructions (as strings) in Intel syntax.
@instr_att
A list of all x86 instructions (as strings) in AT&T syntax.
@instr
A list of all x86 instructions (as strings) in Intel and AT&T syntax.
FUNCTIONS
is_reg_intel
Checks if the given string parameter is a valid x86 register (any size) in Intel syntax.
Returns 1 if yes.
is_reg_att
Checks if the given string parameter is a valid x86 register (any size) in AT&T syntax.
Returns 1 if yes.
is_reg
Checks if the given string parameter is a valid x86 register (any size).
Returns 1 if yes.
is_reg8_intel
Checks if the given string parameter is a valid x86 8-bit register in Intel syntax.
Returns 1 if yes.
is_reg8_att
Checks if the given string parameter is a valid x86 8-bit register in AT&T syntax.
Returns 1 if yes.
is_reg8
Checks if the given string parameter is a valid x86 8-bit register.
Returns 1 if yes.
is_reg16_intel
Checks if the given string parameter is a valid x86 16-bit register in Intel syntax.
Returns 1 if yes.
is_reg16_att
Checks if the given string parameter is a valid x86 16-bit register in AT&T syntax.
Returns 1 if yes.
is_reg16
Checks if the given string parameter is a valid x86 16-bit register.
Returns 1 if yes.
is_segreg_intel
Checks if the given string parameter is a valid x86 segment register in Intel syntax.
Returns 1 if yes.
is_segreg_att
Checks if the given string parameter is a valid x86 segment register in AT&T syntax.
Returns 1 if yes.
is_segreg
Checks if the given string parameter is a valid x86 segment register.
Returns 1 if yes.
is_reg32_intel
Checks if the given string parameter is a valid x86 32-bit register in Intel syntax.
Returns 1 if yes.
is_reg32_att
Checks if the given string parameter is a valid x86 32-bit register in AT&T syntax.
Returns 1 if yes.
is_reg32
Checks if the given string parameter is a valid x86 32-bit register.
Returns 1 if yes.
is_addressable32_intel
Checks if the given string parameter is a valid x86 32-bit register which can be used
for addressing in Intel syntax.
Returns 1 if yes.
is_addressable32_att
Checks if the given string parameter is a valid x86 32-bit register which can be used
for addressing in AT&T syntax.
Returns 1 if yes.
is_addressable32
Checks if the given string parameter is a valid x86 32-bit register which can be used
for addressing.
Returns 1 if yes.
is_r32_in64_intel
Checks if the given string parameter is a valid x86 32-bit register which can only be used
in 64-bit mode (that is, checks if the given string parameter is a 32-bit
subregister of a 64-bit register).
Returns 1 if yes.
is_r32_in64_att
Checks if the given string parameter is a valid x86 32-bit register in Intel syntax
which can only be used in 64-bit mode (that is, checks if the given string
parameter is a 32-bit subregister of a 64-bit register).
Returns 1 if yes.
is_r32_in64
Checks if the given string parameter is a valid x86 32-bit register in AT&T syntax
which can only be used in 64-bit mode (that is, checks if the given string
parameter is a 32-bit subregister of a 64-bit register).
Returns 1 if yes.
is_reg64_intel
Checks if the given string parameter is a valid x86 64-bit register in Intel syntax.
Returns 1 if yes.
is_reg64_att
Checks if the given string parameter is a valid x86 64-bit register in AT&T syntax.
Returns 1 if yes.
is_reg64
Checks if the given string parameter is a valid x86 64-bit register.
Returns 1 if yes.
is_reg_mm_intel
Checks if the given string parameter is a valid x86 multimedia (MMX/3DNow!/SSEn)
register in Intel syntax.
Returns 1 if yes.
is_reg_mm_att
Checks if the given string parameter is a valid x86 multimedia (MMX/3DNow!/SSEn)
register in AT&T syntax.
Returns 1 if yes.
is_reg_mm
Checks if the given string parameter is a valid x86 multimedia (MMX/3DNow!/SSEn) register.
Returns 1 if yes.
is_reg_fpu_intel
Checks if the given string parameter is a valid x86 FPU register in Intel syntax.
Returns 1 if yes.
is_reg_fpu_att
Checks if the given string parameter is a valid x86 FPU register in AT&T syntax.
Returns 1 if yes.
is_reg_fpu
Checks if the given string parameter is a valid x86 FPU register.
Returns 1 if yes.
is_reg_opmask_intel
Checks if the given string parameter is a valid x86 opmask register in Intel syntax.
Returns 1 if yes.
is_reg_opmask_att
Checks if the given string parameter is a valid x86 opmask register in AT&T syntax.
Returns 1 if yes.
is_reg_opmask
Checks if the given string parameter is a valid x86 opmask register.
Returns 1 if yes.
is_instr_intel
Checks if the given string parameter is a valid x86 instruction in Intel syntax.
Returns 1 if yes.
is_instr_att
Checks if the given string parameter is a valid x86 instruction in AT&T syntax.
Returns 1 if yes.
is_instr
Checks if the given string parameter is a valid x86 instruction in any syntax.
Returns 1 if yes.
is_valid_16bit_addr_intel
Checks if the given string parameter (must contain the square braces)
is a valid x86 16-bit addressing mode in Intel syntax.
Returns 1 if yes.
is_valid_16bit_addr_att
Checks if the given string parameter (must contain the parentheses)
is a valid x86 16-bit addressing mode in AT&T syntax.
Returns 1 if yes.
is_valid_16bit_addr
Checks if the given string parameter (must contain the parentheses)
is a valid x86 16-bit addressing mode in AT&T or Intel syntax.
Returns 1 if yes.
is_valid_32bit_addr_intel
Checks if the given string parameter (must contain the square braces)
is a valid x86 32-bit addressing mode in Intel syntax.
Returns 1 if yes.
is_valid_32bit_addr_att
Checks if the given string parameter (must contain the parentheses)
is a valid x86 32-bit addressing mode in AT&T syntax.
Returns 1 if yes.
is_valid_32bit_addr
Checks if the given string parameter (must contain the parentheses)
is a valid x86 32-bit addressing mode in AT&T or Intel syntax.
Returns 1 if yes.
is_valid_64bit_addr_intel
Checks if the given string parameter (must contain the square braces)
is a valid x86 64-bit addressing mode in Intel syntax.
Returns 1 if yes.
is_valid_64bit_addr_att
Checks if the given string parameter (must contain the parentheses)
is a valid x86 64-bit addressing mode in AT&T syntax.
Returns 1 if yes.
is_valid_64bit_addr
Checks if the given string parameter (must contain the parentheses)
is a valid x86 64-bit addressing mode in AT&T or Intel syntax.
Returns 1 if yes.
is_valid_addr_intel
Checks if the given string parameter (must contain the square braces)
is a valid x86 addressing mode in Intel syntax.
Returns 1 if yes.
is_valid_addr_att
Checks if the given string parameter (must contain the braces)
is a valid x86 addressing mode in AT&T syntax.
Returns 1 if yes.
is_valid_addr
Checks if the given string parameter (must contain the square braces)
is a valid x86 addressing mode (Intel or AT&T syntax).
Returns 1 if yes.
add_percent
PRIVATE SUBROUTINE.
Add a percent character ('%') in front of each element in the array given as a parameter.
Returns the new array.
is_att_suffixed_instr
Tells if the given instruction is suffixed in AT&T syntax.
Returns 1 if yes
is_att_suffixed_instr_fpu
Tells if the given FPU non-integer instruction is suffixed in AT&T syntax.
Returns 1 if yes
add_att_suffix_instr
Creates the AT&T syntax instruction array from the Intel-syntax array.
Returns the new array.
remove_duplicates
PRIVATE SUBROUTINE.
Returns an array of the provided arguments with duplicate entries removed.
nopluses
PRIVATE SUBROUTINE.
Removes unnecessary '+' characters from the beginning of the given string.
Returns the resulting string (or '+' if it was empty).
conv_att_addr_to_intel
Converts the given string representing a valid AT&T addressing mode to Intel syntax.
Returns the resulting string.
conv_intel_addr_to_att
Converts the given string representing a valid Intel addressing mode to AT&T syntax.
Returns the resulting string.
conv_att_instr_to_intel
Converts the given string representing a valid AT&T instruction to Intel syntax.
Returns the resulting string.
conv_intel_instr_to_att
Converts the given string representing a valid Intel instruction to AT&T syntax.
Returns the resulting string.
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the perldoc command.
perldoc Asm::X86
You can also look for information at:
Search CPAN
http://search.cpan.org/dist/Asm-X86
CPAN Request Tracker:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Asm-X86
AnnoCPAN, annotated CPAN documentation:
http://annocpan.org/dist/Asm-X86
CPAN Ratings:
http://cpanratings.perl.org/d/Asm-X86
AUTHOR
Bogdan Drozdowski, <bogdandr at op.pl>
COPYRIGHT & LICENSE
Copyright 2008-2012 Bogdan Drozdowski, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.