Package jnr.x86asm

Class Assembler


public final class Assembler extends Serializer
Low level code generation.
  • Field Details

    • _buffer

      private final CodeBuffer _buffer
    • _relocData

      private final List<RelocData> _relocData
    • cpuInfo

      private final CpuInfo cpuInfo
    • _properties

      private int _properties
    • _trampolineSize

      int _trampolineSize
      Size of possible trampolines.
    • _logger

      private final Logger _logger
    • cpu

      private final CPU cpu
    • I386

      public static final CPU I386
    • X86_64

      public static final CPU X86_64
    • nop1

      private static final int[] nop1
    • nop2

      private static final int[] nop2
    • nop3

      private static final int[] nop3
    • nop4

      private static final int[] nop4
    • nop5

      private static final int[] nop5
    • nop6

      private static final int[] nop6
    • nop7

      private static final int[] nop7
    • nop8

      private static final int[] nop8
    • nop9

      private static final int[] nop9
    • nop10

      private static final int[] nop10
    • nop11

      private static final int[] nop11
  • Constructor Details

    • Assembler

      public Assembler(CPU cpu)
  • Method Details

    • is64

      boolean is64()
      Specified by:
      is64 in class SerializerCore
    • intValue

      private static final int intValue(boolean b)
    • offset

      public final int offset()
    • codeSize

      public final int codeSize()
      Gets the required size of memory required to store all the generated code
    • trampolineSize

      int trampolineSize()
      Return size of all possible trampolines needed to successfuly generate relative jumps to absolute addresses. This value is only non-zero if jmp of call instructions were used with immediate operand (this means jump or call absolute address directly). Currently only _emitJmpOrCallReloc() method can increase trampoline size value.
    • getByteAt

      public final byte getByteAt(int pos)
    • getWordAt

      public final short getWordAt(int pos)
    • getDWordAt

      public final int getDWordAt(int pos)
    • getQWordAt

      public final long getQWordAt(int pos)
    • setByteAt

      public final void setByteAt(int pos, byte x)
    • setWordAt

      public final void setWordAt(int pos, short x)
    • setDWordAt

      public final void setDWordAt(int pos, int x)
    • setQWordAt

      public final void setQWordAt(int pos, long x)
    • getInt32At

      public final int getInt32At(int pos)
    • setInt32At

      public final void setInt32At(int pos, long x)
    • setVarAt

      public final void setVarAt(int pos, long i, boolean isUnsigned, int size)
    • _emitByte

      final void _emitByte(int x)
      Emit Byte to internal buffer.
    • _emitWord

      final void _emitWord(int x)
      Emit Word (2 bytes) to internal buffer.
    • _emitDWord

      final void _emitDWord(int x)
      Emit DWord (4 bytes) to internal buffer.
    • _emitQWord

      final void _emitQWord(long x)
      Emit QWord (8 bytes) to internal buffer.
    • _emitInt32

      final void _emitInt32(int x)
      Emit Int32 (4 bytes) to internal buffer.
    • _emitSysInt

      final void _emitSysInt(long x)
      Emit system signed integer (4 or 8 bytes) to internal buffer.
    • _emitOpCode

      final void _emitOpCode(int opCode)
    • _emitSegmentPrefix

      void _emitSegmentPrefix(Operand rm)
    • _emitImmediate

      void _emitImmediate(Immediate imm, int size)
    • _emitRexR

      void _emitRexR(int w, int opReg, int regCode)
      Emit REX prefix (64 bit mode only).
    • _emitRexR

      void _emitRexR(boolean w, int opReg, int regCode)
    • _emitRexRM

      void _emitRexRM(int w, int opReg, Operand rm)
      Emit REX prefix (64 bit mode only).
    • _emitRexRM

      void _emitRexRM(boolean w, int opReg, Operand rm)
    • _emitModM

      void _emitModM(int opReg, Mem mem, int immSize)
    • _emitX86Inl

      void _emitX86Inl(int opCode, boolean i16bit, boolean rexw, int reg)
    • _emitX86Inl

      void _emitX86Inl(int opCode, boolean i16bit, int rexw, int reg)
    • _emitModRM

      void _emitModRM(int opReg, Operand op, int immSize)
    • _emitMod

      void _emitMod(int m, int o, int r)
      Emit MODR/M byte.
    • _emitSib

      void _emitSib(int s, int i, int b)
      Emit SIB byte.
    • _emitModR

      void _emitModR(int opReg, int r)
      Emit Register / Register - calls _emitMod(3, opReg, r)
    • _emitModR

      void _emitModR(int opReg, BaseReg r)
      Emit Register / Register - calls _emitMod(3, opReg, r.code())
    • _emitX86RM

      void _emitX86RM(int opCode, boolean i16bit, boolean rexw, int o, Operand op, int immSize)
    • _emitX86RM

      void _emitX86RM(int opCode, boolean i16bit, int rexw, int o, Operand op, int immSize)
    • _emitX86

      void _emitX86(INST_CODE code, Operand o1, Operand o2, Operand o3)
      Specified by:
      _emitX86 in class SerializerCore
    • _emitFpu

      void _emitFpu(int opCode)
    • _emitFpuSTI

      void _emitFpuSTI(int opCode, int sti)
    • _emitFpuMEM

      void _emitFpuMEM(int opCode, int opReg, Mem mem)
    • _emitMmu

      void _emitMmu(int opCode, int rexw, int opReg, Operand src, int immSize)
    • _emitDisplacement

      LinkData _emitDisplacement(Label label, long inlinedDisplacement, int size)
    • _emitJmpOrCallReloc

      void _emitJmpOrCallReloc(InstructionGroup instruction, long target)
    • relocCode

      public void relocCode(ByteBuffer buffer, long address)
    • align

      public void align(long m)