udis86sx/UDIS86Instruction.st
changeset 49 704b049b9aa2
parent 48 d55d740fb1fc
child 51 bac3aa0c73ef
equal deleted inserted replaced
48:d55d740fb1fc 49:704b049b9aa2
    77 
    77 
    78 assembly
    78 assembly
    79     ^ assembly
    79     ^ assembly
    80 !
    80 !
    81 
    81 
    82 branchTargetAddress
    82 branchTarget
    83     "
    83     "
    84     Return and address of next instruction if branch is taken.
    84      Return and address of next instruction if branch is taken.
    85     Assumes that this instruction is a branch instruction.
    85      Assumes that this instruction is a branch instruction."
    86     "
    86     
    87     self assert: self isBranchInstruction.
    87     self assert:self isBranch.
    88     self assert: operand0 notNil.
    88     self assert:operand0 notNil.
    89     self assert: operand0 type = UD_OP_JIMM.
    89     self assert:operand0 type = UD_OP_JIMM.
    90 
       
    91     ^ pc + len + operand0 sval.
    90     ^ pc + len + operand0 sval.
    92 
    91 
    93     "Created: / 26-06-2018 / 11:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    92     "Created: / 26-06-2018 / 11:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    93 ! !
       
    94 
       
    95 !UDIS86Instruction methodsFor:'enumerating'!
       
    96 
       
    97 instructionsDo: aBlock
       
    98     aBlock value: self.
       
    99 
       
   100     "Created: / 16-08-2018 / 16:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    94 ! !
   101 ! !
    95 
   102 
    96 !UDIS86Instruction methodsFor:'initialization'!
   103 !UDIS86Instruction methodsFor:'initialization'!
    97 
   104 
    98 setAssembly: aString
   105 setAssembly: aString
   147     "Created: / 11-12-2015 / 21:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   154     "Created: / 11-12-2015 / 21:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   148 ! !
   155 ! !
   149 
   156 
   150 !UDIS86Instruction methodsFor:'testing'!
   157 !UDIS86Instruction methodsFor:'testing'!
   151 
   158 
   152 isBranchInstruction
   159 isBranch
   153     "
   160     "
   154     Return `true` is this instruction is some sort of branch instruction.
   161      Return `true` is this instruction is some sort of branch instruction."
   155     "    
   162     
   156     ^ mnemonic between: UD_Ijo and: UD_Ijmp
   163     ^ mnemonic between:UD_Ijo and:UD_Ijmp
   157 
   164 
   158     "Created: / 26-06-2018 / 11:35:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   165     "Created: / 26-06-2018 / 11:35:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   159 !
   166 !
   160 
   167 
   161 isReturnInstruction
   168 isReturn
   162     "
   169     "Return `true` is this instruction is a return"
   163     Return `true` is this instruction is a return
   170     
   164     "    
   171     ^ mnemonic between:UD_Iret and:UD_Iretf
   165     ^ mnemonic between: UD_Iret and: UD_Iretf
       
   166 
   172 
   167     "Created: / 26-06-2018 / 15:39:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   173     "Created: / 26-06-2018 / 15:39:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   174     "Modified (comment): / 16-08-2018 / 14:02:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   168 ! !
   175 ! !
   169 
   176 
   170 !UDIS86Instruction class methodsFor:'documentation'!
   177 !UDIS86Instruction class methodsFor:'documentation'!
   171 
   178 
   172 version_HG
   179 version_HG