SlideShare una empresa de Scribd logo
1 de 55
How to Implement A Simple
Dalvik Virtual Machine
Agenda
• Java Virtual Machine (JVM)
– Java Virtual Machine and its instructions
– Implement a Simple JVM

• Dalvik Virtual Machine (DVM)
– Dalvik Virtual Machine and its instructions
– Implement a Simple DVM

• References
Java Virtual Machine
Java Virtual Machine Overview
• Java Virtual Machine
– JVM Model
– Java ByteCode
– Java ByteCode instructions

• How to make a Java VM
– A Simple Java Virtual Machine
– Experiment
Java Virtual Machine
• Stack-based (Last-In First-Out) Virtual Machine
• Computation in Stack
• Load Java ByteCode to execute program
Lines

Stack-based VM Pseudo
Code

0

POP 20

1

POP 7

2

ADD 20, 7, result

3

PUSH result

http://www.codeproject.com/Articles/461052/Stack-based-vs-Register-based-VirtualMachine-Arch
Java Source to ByteCode

http://javabook1.blogspot.tw/2013/07/introduction-to-java.html
JVM Model
• Local Variables:
• place the method
input parameters

• Operand Stack:
• Computation Area
• Put Instruction
Operands and Return
address

• Constant Pool
• Put Constant Data
Java ByteCode
• What is ByteCode ?
– also known as p-code (portable code), is a form of
instruction set designed for efficient execution by
a software interpreter.
An Java Addition Example a = 20, b = 30
C-pseudo

X86 ASM

Java ByteCode
(Human-syntax)

Java ByteCode
binary

int add
mov eax, byte [ebp-4]
(int a, int b ) mov edx, byte [ebp-8]
{
return a+b; add eax, edx

iload_1

0x1a

iload_2

0x1b

iadd

0x60

}

ireturn

0x3e

ret
A Java Addition Example
Local Variables

20

30
Stack

<<init>>

C-pseudo

An Addition
Example
a = 20, b = 30

Java ByteCode
(Human-syntax)

void add
iload_1
(int a, int b ) iload_2
{
iadd
b = a+b;
}
istore_2

Local Variables

Local Variables

Local Variables

Local Variables

1

20

20

20

20

2

30

30

30

50

Stack

Stack

Stack

Stack

20

20

50

50

iadd

istore_2

0

30

iload_1

iload_2
More Java ByteCode Example
class Example3c {
public static void addAndPrint() {
double result = addTwoTypes
(1, 88.88);
System.out.println(result);
}
public static double addTwoTypes
(int i, double d) {
return i + d;
}
}

Inside the Java Virtual Machine, 2000, Bill Venners
Java Bytecode instructions (Partials)
Mnemonic

iadd
isub
idiv

imul
irem

Opcode

Stack

0x60

Pop value1, Pop value2
result = value1 + value2
Push result

0x64

Pop value1, Pop value2
result = value1 - value2
Push result

0x6C

Pop value1, Pop value2
result = value2 / value1
Push result

0x68

Pop value1, Pop value2
result = value1 * value2
Push result

0x70

Pop value1, Pop value2
result = value2 % value1
Push result

http://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
How to make a Java Virtual Machine
• At least to know about Java Class File
– Wikipedia
• http://en.wikipedia.org/wiki/Java_bytecode
• http://en.wikipedia.org/wiki/Java_class_file

– the Java Specification
• http://docs.oracle.com/javase/6/docs/index.html
Java Class File
Java Class File Structure

Magic Number:

0xCAFEBABE

Version of Class File Format:

the minor and major versions of the class file

Constant Pool:

Pool of constants for the class

Access Flags:

for example whether the class is abstract, static,
etc.

This Class:

The name of the current class

Super Class:

The name of the super class

Interfaces:

Any interfaces in the class

Fields:

Any fields in the class

Methods:

Any methods in the class

Attributes:

Any attributes of the class (for example the name
of the sourcefile, etc.)
Java Class File
Structure
Download Simple JVM
• goo.gl/FA3fwx
Simple JVM Source Code Structure
Simple JVM
Constant Pool

Interface Pool

Stack

Method Pool

VM Engine ( Bytecode Loader)
Class File Parser
Compile Simple JVM
Test Foo

Java Foo

Simple JVM Foo
Simple JVM
Instruction Table :
simple_jvm_bytecodes.c
iadd : simple_jvm_bytecodes.c

iadd

0x60

Pop value1, Pop value2
result = value1 + value2
Push result
imul: simple_jvm_bytecodes.c

imul

0x68

Pop value1, Pop value2
result = value1 * value2
Push result
Experiment: add irem instruction into
Simple JVM
irem

0x70

goo.gl/xIMuym

Execution Result:

Pop value1, Pop value2
result = value2 % value1
Push result
Dalvik Virtual Machine
Dalvik Virtual Machine Overview
•
•
•
•

Java Translation for JVM and DVM
Hello World on Dalvik VM
DVM ByteCode
DVM ByteCode Interpreter Generation on
Android Open Source
• Dex File Header
• An Simple Dalvik Virtual Machine
Java Translation for JVM and DVM

http://www.codeproject.com/Articles/461052/
Stack-based-vs-Register-based-VirtualMachine-Arch
Hello World on Dalvik VM Roadmap
Build Environment
Setup

JDK Installation

Download Android
Open Source

Compile Dalvik VM
x86 host

Build Dalvik VM

Produce

Compile Hello
World

Dalvik x86

Foo.jar

Compile Hello World

Run
Android Open Source Build Setup
• Ubuntu 12.04
– Virtual Box

• sudo apt-get install git gnupg flex bison gperf build-essential zip
curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11dev:i386 libreadline6-dev:i386 libgl1-mesa-dri:i386 libgl1-mesadev g++-multilib mingw32 tofrodos python-markdown libxml2utils xsltproc zlib1g-dev:i386
• 如果發生衝突使用 libgl1-mesa-glx:i386

Android Open Source Initializing a Build Environment
http://source.android.com/source/initializing.html
Build Setup Result
JDK Installation on Ubuntu
• sudo add-apt-repository ppa:webupd8team/java
• sudo apt-get update
• sudo apt-get install oracle-java6-installer

Android Open Source Initializing a Build Environment
http://source.android.com/source/initializing.html
Download Android Open Source(1)
•
•
•
•

cd ~
mkdir android_source
cd android_source
mkdir bin

• curl http://commondatastorage.googleapis.com/
git-repo-downloads/repo > repo

• chmod a+x repo
• cd ..
Download Android Open Source(2)
• Check android release Tag
Download Android Open Source(3)
• mkdir test & cd test
• mkdir bin & cd bin
• curl http://commondatastorage.googleapis.com/gitrepo-downloads/repo > repo
• chmod 777 repo
• cd ..
• mkdir android-4.3_r1
• cd android-4.3_r1
• ../bin/repo init -u
https://android.googlesource.com/platform/manifest b android-4.3_r1
– Initial android-4.3_r1

• repo sync
– Download Android Open Source
Download Android Open Source Result

Repo Init

Repo Sync
Compile Dalvik VM x86
• source build/envsetup.sh
• lunch 2
• make dalvikvm dalvik-host core ext dexopt
framework android.policy services

make_dvm.sh
Compile Dalvik VM x86 Result
Setup DalvikVM x86
• mkdir -p dalvik-x86-android-4.3
• mkdir -p dalvik-x86-android-4.3/tmp/dalvik-cache
• cp -r android-4.3_r1/out/target/product/generic_x86/system/
dalvik-x86-android-4.3/system/
• cp -r android-4.3_r1/out/host/linux-x86/bin dalvik-x86-android4.3/
• cp -r android-4.3_r1/out/host/linux-x86/lib dalvik-x86-android4.3/
• cp -r android-4.3_r1/out/host/linux-x86/usr dalvik-x86-android4.3/system/
Hello World on Dalvik VM Roadmap
Build Environment
Setup

JDK Installation

Download Android
Open Source

Compile Dalvik VM
x86 host

Build Dalvik VM

Produce

Compile Hello
World

Dalvik x86

Foo.jar

Compile Hello World

Run
Download ADT (Android Development Tools ) for
Compile Hello World

http://developer.android.com/sdk/index.html#
download
Compile Hello World to DEX
Foo.java

javac Foo.java

javac
Foo.class

dx --dex –output=foo.jar Foo.class

Classes.dex

dx

foo.jar
Hello World
• Foo1.java
Foo1 {
public static void main ( String args[] ) {
System.out.println(“Hello World”);
}

}

• javac Foo1.java
• dx --dex --output=foo1.jar Foo1.class
Run Hello World on DalvikVM x86

run_dvm2.sh

$@ 是 bash script 的 parameters
./run_dvm2.sh –cp foo1.jar Foo
Dalvik VM and ByteCode
• Register-based, 32bits
• Instructions Fetch Unit : 16 bits
– Byte code store as binary

• Constant pools
– String, Type, Field, Method, Class

• Human-syntax and mnemonics
Insturction Suffix
-wide(64bits OpCodes)

-char

-boolean

-short

-byte

-int

-long

-float

-object

-string

-class

-void
Dalvik ByteCode Human-syntax
• Example "move-wide/from16 vAA, vBBBB":
– Opcode : “move" move a register's value).
– "wide" is the name suffix
• it operates on wide (64 bit) data.

– "from16" is the opcode suffix
• 16-bit register reference as a source.

– "vAA" is the destination register
• v0 – v255.

– "vBBBB" is the source register
• v0 – v65535.
Dalvik ByteCode Example
OpCode

suffix1

Suffix2

destination

source

move

wide

from16

vAA

vBBBB

4

v6

int #0

double-to-int

v0

v0

invoke-virtual

method@0002

{v3,v4}

const-string

string@0005

v4

mul-int

v3

v0,v1

v2

v2,v3

const

add-int

2addr
DVM ByteCode Interpreter
Generation on AOSP
• How to generate the InterpC-portable.cpp
– rebuild.sh TARGET_ARCH=portable
– parse Makefile-mterp
– gen-mterp.py TARGET_ARCH=portable
– parse config-portable
– concatenate cpp files to one files
• InterpC-portable.cpp
Dalvik Mterp Generation flow
Rebuild.sh

Invoke makefile

Makefile-mterp

TARGET_ARCH_EXT=portable

gen-mterp.py

parse config-portable
Concatenate files

InterpC-portable.cpp
Dex Header

http://www.strazzere.com/blog/2008/11/updated-dalvik-vm-dex-file-format/
Dex Translation Example

SymDroid: Symbolic Execution for Dalvik Bytecode- Technical Report CS-TR-5022, July 2012
Jinseong Jeon, Kristopher K. Micinski, Je rey S. Foster
Department of Computer Science, University of Maryland, College Park
Dalvik ByteCode Example 2
A Simple Dalvik Virtual Machine
Register Bank
v0 ~ v65535

Program
Context

VM Stat / PC

Heap

VM Engine
DEX Parser
Simple DVM
Instruction Table :
simple_dvm_bytecodes.c
add-int implementation
An Simple Dalvik VM Experiment
goo.gl/J5VFQV

1. make_simple_dvm
2. simple_dvm Foo1.dex
References
• Android Open Source
– http://source.android.com/index.html

• Android XRef
– http://androidxref.com/

• Java ByteCodes Fundamentals
– http://arhipov.blogspot.tw/2011/01/java-bytecodefundamentals.html

• Java ByteCode Instruction listings
– http://en.wikipedia.org/wiki/Java_bytecode_instructi
on_listings

• Dalvik Wiki
– http://en.wikipedia.org/wiki/Dalvik_(software)

Más contenido relacionado

La actualidad más candente

DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DaliaAboSheasha
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivityVaishali Modi
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread SynchronizationBenj Del Mundo
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practicesfelixbillon
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest MatchersShai Yallin
 
Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
Node.js, Uma breve introdução
Node.js, Uma breve introduçãoNode.js, Uma breve introdução
Node.js, Uma breve introduçãoPablo Feijó
 
Analysing in depth work manager
Analysing in depth work managerAnalysing in depth work manager
Analysing in depth work managerbhatnagar.gaurav83
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Xavier Hallade
 

La actualidad más candente (20)

Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Spring boot
Spring bootSpring boot
Spring boot
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Node.js, Uma breve introdução
Node.js, Uma breve introduçãoNode.js, Uma breve introdução
Node.js, Uma breve introdução
 
Swing
SwingSwing
Swing
 
Analysing in depth work manager
Analysing in depth work managerAnalysing in depth work manager
Analysing in depth work manager
 
Jboss Tutorial Basics
Jboss Tutorial BasicsJboss Tutorial Basics
Jboss Tutorial Basics
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Java 8 Lambda and Streams
Java 8 Lambda and StreamsJava 8 Lambda and Streams
Java 8 Lambda and Streams
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 

Destacado

Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Doug Hawkins
 
Google ART (Android RunTime)
Google ART (Android RunTime)Google ART (Android RunTime)
Google ART (Android RunTime)Niraj Solanke
 
How to build a virtual machine
How to build a virtual machineHow to build a virtual machine
How to build a virtual machineTerence Parr
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolGabor Paller
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopOpersys inc.
 
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...Gianfranco Tonello
 
Tutto quello che avreste voluto sapere sui malware android
Tutto quello che avreste voluto sapere sui malware androidTutto quello che avreste voluto sapere sui malware android
Tutto quello che avreste voluto sapere sui malware androidGianfranco Tonello
 
HKG15-300: Art's Quick Compiler: An unofficial overview
HKG15-300: Art's Quick Compiler: An unofficial overviewHKG15-300: Art's Quick Compiler: An unofficial overview
HKG15-300: Art's Quick Compiler: An unofficial overviewLinaro
 
Dalvik Vm &amp; Jit
Dalvik Vm &amp; JitDalvik Vm &amp; Jit
Dalvik Vm &amp; JitAnkit Somani
 
Scacco matto ai crytpo malware (milano)
Scacco matto ai crytpo malware (milano)Scacco matto ai crytpo malware (milano)
Scacco matto ai crytpo malware (milano)Gianfranco Tonello
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Androidma-polimi
 
Antlr Conference Drools & Hibernate
Antlr Conference   Drools & HibernateAntlr Conference   Drools & Hibernate
Antlr Conference Drools & HibernateAlexandre Porcelli
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideLinaro
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecturesubnesh
 
Algoritmo probabilistico di tipo montecarlo per il list decoding
Algoritmo probabilistico di tipo montecarlo per il list decodingAlgoritmo probabilistico di tipo montecarlo per il list decoding
Algoritmo probabilistico di tipo montecarlo per il list decodingdanielenicassio
 
Reverse engineering android apps
Reverse engineering android appsReverse engineering android apps
Reverse engineering android appsPranay Airan
 

Destacado (20)

Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011
 
Google ART (Android RunTime)
Google ART (Android RunTime)Google ART (Android RunTime)
Google ART (Android RunTime)
 
How to build a virtual machine
How to build a virtual machineHow to build a virtual machine
How to build a virtual machine
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer tool
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with Lollipop
 
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...
Evoluzione dei malware in ambiente Android: dalle metodologie di infezione al...
 
Tutto quello che avreste voluto sapere sui malware android
Tutto quello che avreste voluto sapere sui malware androidTutto quello che avreste voluto sapere sui malware android
Tutto quello che avreste voluto sapere sui malware android
 
Security testing in mobile applications
Security testing in mobile applicationsSecurity testing in mobile applications
Security testing in mobile applications
 
HKG15-300: Art's Quick Compiler: An unofficial overview
HKG15-300: Art's Quick Compiler: An unofficial overviewHKG15-300: Art's Quick Compiler: An unofficial overview
HKG15-300: Art's Quick Compiler: An unofficial overview
 
Jvm internals
Jvm internalsJvm internals
Jvm internals
 
Dalvik Vm &amp; Jit
Dalvik Vm &amp; JitDalvik Vm &amp; Jit
Dalvik Vm &amp; Jit
 
Scacco matto ai crytpo malware (milano)
Scacco matto ai crytpo malware (milano)Scacco matto ai crytpo malware (milano)
Scacco matto ai crytpo malware (milano)
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Android
 
Dalvik jit
Dalvik jitDalvik jit
Dalvik jit
 
3. jvm
3. jvm3. jvm
3. jvm
 
Antlr Conference Drools & Hibernate
Antlr Conference   Drools & HibernateAntlr Conference   Drools & Hibernate
Antlr Conference Drools & Hibernate
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecture
 
Algoritmo probabilistico di tipo montecarlo per il list decoding
Algoritmo probabilistico di tipo montecarlo per il list decodingAlgoritmo probabilistico di tipo montecarlo per il list decoding
Algoritmo probabilistico di tipo montecarlo per il list decoding
 
Reverse engineering android apps
Reverse engineering android appsReverse engineering android apps
Reverse engineering android apps
 

Similar a How to implement a simple dalvik virtual machine

JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesCharles Nutter
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediZeroTurnaround
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Anton Arhipov
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesAlexandra Masterson
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Rittercatherinewall
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentationasync_io
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Jérôme Petazzoni
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele RialdiCodeFest
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on WindowsWO Community
 

Similar a How to implement a simple dalvik virtual machine (20)

JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
 
Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Ritter
 
De Java 8 ate Java 14
De Java 8 ate Java 14De Java 8 ate Java 14
De Java 8 ate Java 14
 
Java platform
Java platformJava platform
Java platform
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentation
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Introduction to java programming part 1
Introduction to java programming   part 1Introduction to java programming   part 1
Introduction to java programming part 1
 
Ropython-windbg-python-extensions
Ropython-windbg-python-extensionsRopython-windbg-python-extensions
Ropython-windbg-python-extensions
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
 
Mastering Java ByteCode
Mastering Java ByteCodeMastering Java ByteCode
Mastering Java ByteCode
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
 
De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14
 

Último

1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改yuu sss
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back17lcow074
 
Architecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfArchitecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfSumit Lathwal
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一F dds
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfneelspinoy
 
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一A SSS
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作7tz4rjpd
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfShivakumar Viswanathan
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造kbdhl05e
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一diploma 1
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一F La
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degreeyuu sss
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryWilliamVickery6
 

Último (20)

1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
1比1办理美国北卡罗莱纳州立大学毕业证成绩单pdf电子版制作修改
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back
 
Architecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfArchitecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdf
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdf
 
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一
办理学位证(NTU证书)新加坡南洋理工大学毕业证成绩单原版一比一
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
Call Girls in Pratap Nagar, 9953056974 Escort Service
Call Girls in Pratap Nagar,  9953056974 Escort ServiceCall Girls in Pratap Nagar,  9953056974 Escort Service
Call Girls in Pratap Nagar, 9953056974 Escort Service
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdf
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William Vickery
 

How to implement a simple dalvik virtual machine

  • 1. How to Implement A Simple Dalvik Virtual Machine
  • 2. Agenda • Java Virtual Machine (JVM) – Java Virtual Machine and its instructions – Implement a Simple JVM • Dalvik Virtual Machine (DVM) – Dalvik Virtual Machine and its instructions – Implement a Simple DVM • References
  • 4. Java Virtual Machine Overview • Java Virtual Machine – JVM Model – Java ByteCode – Java ByteCode instructions • How to make a Java VM – A Simple Java Virtual Machine – Experiment
  • 5. Java Virtual Machine • Stack-based (Last-In First-Out) Virtual Machine • Computation in Stack • Load Java ByteCode to execute program Lines Stack-based VM Pseudo Code 0 POP 20 1 POP 7 2 ADD 20, 7, result 3 PUSH result http://www.codeproject.com/Articles/461052/Stack-based-vs-Register-based-VirtualMachine-Arch
  • 6. Java Source to ByteCode http://javabook1.blogspot.tw/2013/07/introduction-to-java.html
  • 7. JVM Model • Local Variables: • place the method input parameters • Operand Stack: • Computation Area • Put Instruction Operands and Return address • Constant Pool • Put Constant Data
  • 8. Java ByteCode • What is ByteCode ? – also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter. An Java Addition Example a = 20, b = 30 C-pseudo X86 ASM Java ByteCode (Human-syntax) Java ByteCode binary int add mov eax, byte [ebp-4] (int a, int b ) mov edx, byte [ebp-8] { return a+b; add eax, edx iload_1 0x1a iload_2 0x1b iadd 0x60 } ireturn 0x3e ret
  • 9. A Java Addition Example Local Variables 20 30 Stack <<init>> C-pseudo An Addition Example a = 20, b = 30 Java ByteCode (Human-syntax) void add iload_1 (int a, int b ) iload_2 { iadd b = a+b; } istore_2 Local Variables Local Variables Local Variables Local Variables 1 20 20 20 20 2 30 30 30 50 Stack Stack Stack Stack 20 20 50 50 iadd istore_2 0 30 iload_1 iload_2
  • 10. More Java ByteCode Example class Example3c { public static void addAndPrint() { double result = addTwoTypes (1, 88.88); System.out.println(result); } public static double addTwoTypes (int i, double d) { return i + d; } } Inside the Java Virtual Machine, 2000, Bill Venners
  • 11. Java Bytecode instructions (Partials) Mnemonic iadd isub idiv imul irem Opcode Stack 0x60 Pop value1, Pop value2 result = value1 + value2 Push result 0x64 Pop value1, Pop value2 result = value1 - value2 Push result 0x6C Pop value1, Pop value2 result = value2 / value1 Push result 0x68 Pop value1, Pop value2 result = value1 * value2 Push result 0x70 Pop value1, Pop value2 result = value2 % value1 Push result http://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
  • 12. How to make a Java Virtual Machine • At least to know about Java Class File – Wikipedia • http://en.wikipedia.org/wiki/Java_bytecode • http://en.wikipedia.org/wiki/Java_class_file – the Java Specification • http://docs.oracle.com/javase/6/docs/index.html
  • 13. Java Class File Java Class File Structure Magic Number: 0xCAFEBABE Version of Class File Format: the minor and major versions of the class file Constant Pool: Pool of constants for the class Access Flags: for example whether the class is abstract, static, etc. This Class: The name of the current class Super Class: The name of the super class Interfaces: Any interfaces in the class Fields: Any fields in the class Methods: Any methods in the class Attributes: Any attributes of the class (for example the name of the sourcefile, etc.)
  • 15. Download Simple JVM • goo.gl/FA3fwx
  • 16. Simple JVM Source Code Structure
  • 17. Simple JVM Constant Pool Interface Pool Stack Method Pool VM Engine ( Bytecode Loader) Class File Parser
  • 20. Simple JVM Instruction Table : simple_jvm_bytecodes.c
  • 21. iadd : simple_jvm_bytecodes.c iadd 0x60 Pop value1, Pop value2 result = value1 + value2 Push result
  • 22. imul: simple_jvm_bytecodes.c imul 0x68 Pop value1, Pop value2 result = value1 * value2 Push result
  • 23. Experiment: add irem instruction into Simple JVM irem 0x70 goo.gl/xIMuym Execution Result: Pop value1, Pop value2 result = value2 % value1 Push result
  • 25. Dalvik Virtual Machine Overview • • • • Java Translation for JVM and DVM Hello World on Dalvik VM DVM ByteCode DVM ByteCode Interpreter Generation on Android Open Source • Dex File Header • An Simple Dalvik Virtual Machine
  • 26. Java Translation for JVM and DVM http://www.codeproject.com/Articles/461052/ Stack-based-vs-Register-based-VirtualMachine-Arch
  • 27. Hello World on Dalvik VM Roadmap Build Environment Setup JDK Installation Download Android Open Source Compile Dalvik VM x86 host Build Dalvik VM Produce Compile Hello World Dalvik x86 Foo.jar Compile Hello World Run
  • 28. Android Open Source Build Setup • Ubuntu 12.04 – Virtual Box • sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11dev:i386 libreadline6-dev:i386 libgl1-mesa-dri:i386 libgl1-mesadev g++-multilib mingw32 tofrodos python-markdown libxml2utils xsltproc zlib1g-dev:i386 • 如果發生衝突使用 libgl1-mesa-glx:i386 Android Open Source Initializing a Build Environment http://source.android.com/source/initializing.html
  • 30. JDK Installation on Ubuntu • sudo add-apt-repository ppa:webupd8team/java • sudo apt-get update • sudo apt-get install oracle-java6-installer Android Open Source Initializing a Build Environment http://source.android.com/source/initializing.html
  • 31. Download Android Open Source(1) • • • • cd ~ mkdir android_source cd android_source mkdir bin • curl http://commondatastorage.googleapis.com/ git-repo-downloads/repo > repo • chmod a+x repo • cd ..
  • 32. Download Android Open Source(2) • Check android release Tag
  • 33. Download Android Open Source(3) • mkdir test & cd test • mkdir bin & cd bin • curl http://commondatastorage.googleapis.com/gitrepo-downloads/repo > repo • chmod 777 repo • cd .. • mkdir android-4.3_r1 • cd android-4.3_r1 • ../bin/repo init -u https://android.googlesource.com/platform/manifest b android-4.3_r1 – Initial android-4.3_r1 • repo sync – Download Android Open Source
  • 34. Download Android Open Source Result Repo Init Repo Sync
  • 35. Compile Dalvik VM x86 • source build/envsetup.sh • lunch 2 • make dalvikvm dalvik-host core ext dexopt framework android.policy services make_dvm.sh
  • 36. Compile Dalvik VM x86 Result
  • 37. Setup DalvikVM x86 • mkdir -p dalvik-x86-android-4.3 • mkdir -p dalvik-x86-android-4.3/tmp/dalvik-cache • cp -r android-4.3_r1/out/target/product/generic_x86/system/ dalvik-x86-android-4.3/system/ • cp -r android-4.3_r1/out/host/linux-x86/bin dalvik-x86-android4.3/ • cp -r android-4.3_r1/out/host/linux-x86/lib dalvik-x86-android4.3/ • cp -r android-4.3_r1/out/host/linux-x86/usr dalvik-x86-android4.3/system/
  • 38. Hello World on Dalvik VM Roadmap Build Environment Setup JDK Installation Download Android Open Source Compile Dalvik VM x86 host Build Dalvik VM Produce Compile Hello World Dalvik x86 Foo.jar Compile Hello World Run
  • 39. Download ADT (Android Development Tools ) for Compile Hello World http://developer.android.com/sdk/index.html# download
  • 40. Compile Hello World to DEX Foo.java javac Foo.java javac Foo.class dx --dex –output=foo.jar Foo.class Classes.dex dx foo.jar
  • 41. Hello World • Foo1.java Foo1 { public static void main ( String args[] ) { System.out.println(“Hello World”); } } • javac Foo1.java • dx --dex --output=foo1.jar Foo1.class
  • 42. Run Hello World on DalvikVM x86 run_dvm2.sh $@ 是 bash script 的 parameters ./run_dvm2.sh –cp foo1.jar Foo
  • 43. Dalvik VM and ByteCode • Register-based, 32bits • Instructions Fetch Unit : 16 bits – Byte code store as binary • Constant pools – String, Type, Field, Method, Class • Human-syntax and mnemonics Insturction Suffix -wide(64bits OpCodes) -char -boolean -short -byte -int -long -float -object -string -class -void
  • 44. Dalvik ByteCode Human-syntax • Example "move-wide/from16 vAA, vBBBB": – Opcode : “move" move a register's value). – "wide" is the name suffix • it operates on wide (64 bit) data. – "from16" is the opcode suffix • 16-bit register reference as a source. – "vAA" is the destination register • v0 – v255. – "vBBBB" is the source register • v0 – v65535.
  • 45. Dalvik ByteCode Example OpCode suffix1 Suffix2 destination source move wide from16 vAA vBBBB 4 v6 int #0 double-to-int v0 v0 invoke-virtual method@0002 {v3,v4} const-string string@0005 v4 mul-int v3 v0,v1 v2 v2,v3 const add-int 2addr
  • 46. DVM ByteCode Interpreter Generation on AOSP • How to generate the InterpC-portable.cpp – rebuild.sh TARGET_ARCH=portable – parse Makefile-mterp – gen-mterp.py TARGET_ARCH=portable – parse config-portable – concatenate cpp files to one files • InterpC-portable.cpp
  • 47. Dalvik Mterp Generation flow Rebuild.sh Invoke makefile Makefile-mterp TARGET_ARCH_EXT=portable gen-mterp.py parse config-portable Concatenate files InterpC-portable.cpp
  • 49. Dex Translation Example SymDroid: Symbolic Execution for Dalvik Bytecode- Technical Report CS-TR-5022, July 2012 Jinseong Jeon, Kristopher K. Micinski, Je rey S. Foster Department of Computer Science, University of Maryland, College Park
  • 51. A Simple Dalvik Virtual Machine Register Bank v0 ~ v65535 Program Context VM Stat / PC Heap VM Engine DEX Parser
  • 52. Simple DVM Instruction Table : simple_dvm_bytecodes.c
  • 54. An Simple Dalvik VM Experiment goo.gl/J5VFQV 1. make_simple_dvm 2. simple_dvm Foo1.dex
  • 55. References • Android Open Source – http://source.android.com/index.html • Android XRef – http://androidxref.com/ • Java ByteCodes Fundamentals – http://arhipov.blogspot.tw/2011/01/java-bytecodefundamentals.html • Java ByteCode Instruction listings – http://en.wikipedia.org/wiki/Java_bytecode_instructi on_listings • Dalvik Wiki – http://en.wikipedia.org/wiki/Dalvik_(software)