Smali语法DalvikVM运codeS [英] Smali syntax for DalvikVM opcodes
问题描述
我想了解如何使用Smali / Baksmali组装/分解为DEX文件DalvikVM说明。
I am trying to learn about DalvikVM instructions using the Smali/Baksmali assembler/disassembler for dex files.
从这个.java文件
package gd;
class Hello {
public static void main(String[] args)
{
System.out.println("Hello!");
}
}
我已经生成以下smali汇编文件:
I have generated the following smali assembly file:
.class Lgd/Hello;
.super Ljava/lang/Object;
.source "Hello.java"
# direct methods
.method constructor <init>()V
.registers 1
.prologue
.line 3
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static main([Ljava/lang/String;)V
.registers 3
.parameter
.prologue
.line 6
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
const-string v1, "Hello!"
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
.line 7
return-void
.end method
我的问题是关于下面一行。
My question is about the following line.
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
据我了解这个加载静态对象的PrintStream
的 java.lang.System中的
类成的 V0
注册。现在,这是什么出来:
的意思是
As I understand this loads the static object PrintStream
of the java.lang.System
class into the v0
register. Now, what does this out:
mean?
推荐答案
的PrintStream实际上是被加载的东西的类型。您正在加载的对象可能被称为 java.lang.System.out
,其中的java.lang
是包,系统
是类,而退出
是要装载的部件(静态字段)。
PrintStream is actually the type of the thing being loaded. The object you're loading might be referred to as java.lang.System.out
, where java.lang
is the package, System
is the class, and out
is the member (a static field) to be loaded.
您可以看到在调用虚拟相同的模式: java.io
的包,的PrintStream
是类和的println
是部件(在这种情况下,一个实例方法)。在这两种情况下,该成员是一个 pceded $ P $ - &GT;
。我不知道这种模式在整个Smali一致的。
You can see the same pattern in the invoke-virtual: java.io
is the package, PrintStream
is the class and println
is the member (in this case, an instance method). In both cases, the member is preceded with a ->
. I don't know if this pattern is consistent throughout Smali.
我发现 http://source.android.com/高科技/达尔维克/ Dalvik的字节code.html当我与Dalvik的东西玩,但在这种情况下,它的贡献只是标识sget对象宝贵只花了两个参数。这告诉我, - &GT;的:
业务必须是静态字段引用的一部分
I found http://source.android.com/tech/dalvik/dalvik-bytecode.html invaluable when I was playing with dalvik stuff, although in this case its contribution was just identifying that sget-object only took two arguments. That told me the ->out:
business had to be part of the static field reference.
这篇关于Smali语法DalvikVM运codeS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!