Smali語法學習六

#回顧 語法學習五中就有以下的數據定義:java

move v0,p1                                         #賦值,v0=v1
const/4 v1,0x1                                    #定義常量,v1=1
const-string v2,"MainActivity"             #定義常量字符串,v2="MainActivity"
.local v1,"b1":Z                                   #定義局部變量,寄存器聲明

#數據定義DEMO java代碼:數組

private void test(){
    int a = 1;
    int b = 7;
    int c = 254;
    int d = 2345;
    int d1 = 65538;
    long e = 12435465657677L;
    float f = 123235409234.09097945F
    double g = 111343333454999999999.912384376;
}

對應的smali代碼:ide

.method private test()V
    .locals 10
    .prologue
    .line 49
    const/4 v0,0x1            #int a=1
    
    .line 50
    .local v0,"a":I
    const/4 v1,0x7            #int b=7
    
    .line51
    .local v1,"b":I
    const/16 v2,0xfe        #int c =254
    
    .line 52
    .local v2,"c":I
    const/16 v3,0x929        #int d=2345
    

    .line 53
    .local v3,"d":I
    const v4,0x10002        #int d1=65538

    .line 55
    .local v4,"d1":I
    const wide v6,0xb4f5b835d4dl        #llong e = 12435465657677L

    .line 56
    .local  v6,"e":J
    const v5,0x51e58b39                 #float f = 123235409234.09097945F

    .line 57
    .local v5,"f":F
    const-wide v8,0x441824cbef6b9491L    #1.11343333455E20

    .line 58
    .local v8,"g":D
    return-void
.end method

#數據定義格式 const/4 vA,#+B 將數組擴展爲32位後賦給寄存器vA
const/16 vAA,#+BBBB
const vAA,#+BBBBBBBB 將數組賦給寄存器vAA
const-wide/16 vAA,#+BBBBB 將數值擴展爲64 位後賦給寄存器vA
const-string vAA,string@BBBB 將字符串索引構造一個字符串並賦給vAA
const-class vAA,type@BBBB 經過類型索引獲取一個類的引用並賦給vAA學習

相關文章
相關標籤/搜索