[Android reverse] smali basics (1)

Dalvik instruction set

  • register definition
    • .localsDefine the number of registers
  • function definition
    • .methodstart of function
    • endend of function
  • data manipulation instruction
    • move vA,vBAssign the value of the vB register to the vA register
    • move/16 vAA,vBBThe data width is defined as 16 bits
    • move-object vA,vBfor object assignment
    • move-object/16 vAA,vBBDefine data width
  • return command
    • return vAAReturns the value of the vAA register
    • return-objectreturn object
  • Data Definition Instructions
    • constdata definition
    • const-stringdefine a string
  • Instance operation instruction
    • check-cast vAA,type@BBConvert the object reference of the vAA register to the specified type
    • instance-of vA,vB,type@CCIt will be judged whether the object reference of the vB register can be converted to the specified type, it is vA=1, anyway vA=0
    • new-instance vAA,type@AAAConstructs a new instance of the specified type
  • Array manipulation instructions
    • array-length vA,vBGet the length of the array in the vB register, and assign the result to the vA register
    • new-array vA,vB,type@CCConstructs an array of the specified type and size (vB), and assigns the result to vA
  • abnormal
    • throw vAAThrows an exception of the type specified in the vAA register
  • instruction jump
    • gotounconditional jump
    • packed-switch vAA,+BBBranch jump instruction, +BB only wants to increment the offset table
    • sparse-switch vAA,+BBbranch jump, irregular
  • if jump instruction
    • if-test
      • eqequal
      • nenot equal to
      • ltless than
      • leless than or equal to
      • gegreater than greater than
      • gtmore than the
      • neznot equal to 0
      • nqzequal to 0
  • comparison instruction
    • cmp-floatCompares two single-precision floating-point numbers
    • cmp-doublecompares double-precision floating-point numbers
    • cmp-longcompares two long integers
  • field operation
    • Common fields start with "i"
      • igetread operation
      • iputwrite operation
    • Static fields start with "s"
      • sgetread operation
      • sputwrite operation
  • method call
    • invoke-virtualcall instance virtual method
    • invoke-superInvoking the instance's superclass method
    • invoke-directInvoking the direct method of the instance
    • invoke-staticInvoking a static method on an instance

Guess you like

Origin blog.csdn.net/qq_49619863/article/details/129895987