SlideShare une entreprise Scribd logo
1  sur  17
ARMSIM
16BEC069 - MANAV KANOJIYA
16BEC070 - VIDHI SHAH
16BEC077 - PRITI KHANDELWAL
16BEC084 - SHREEYA MAKWANA
16BEC100 - SHIVEN PANDYA
16BEC101 - RAHUL BANSAL
Courtesy : [1]
Architecture Profile
A
(Architecture)
R
(Real-time)
M
(Microcontroller)
Architecture
A64 A32 T32
DIFFERENT ISA FOR ARM
ARM THUMB
Instructions are always of 32 bit. Instructions are of 16 bit and they can be
converted into 32 bit for arm exploit
development process.
All instructions support the conditional
execution.
Thumb state can support conditional
execution by using IT instruction.
All ARM versions support the arm state . Not all versions of ARM support the thumb
state.
While writing arm shellcode, we need to
get rid of null bytes in arm state.
Due to availability of 16 bit instructions, it
reduces the chances of having null bytes.
ARM REGISTERS
Flag Description
N
(Negative)
Enabled if result of the instruction yields a
negative number.
Z
(Zero)
Enabled if result of the instruction yields a zero
value.
C
(Carry)
Enabled if result of the instruction yields a value
that requires a 33rd bit to be fully represented.
V
(Overflow)
Enabled if result of the instruction yields a value
that cannot be represented in 32 bit two’s
complement.
E
(Endian-bit)
ARM can operate either in little endian, or big
endian. This bit is set to 0 for little endian, or 1
for big endian mode.
T
(Thumb-bit)
This bit is set if you are in Thumb state and is
disabled when you are in ARM state.
M
(Mode-bits)
These bits specify the current privilege mode
(USR, SVC, etc.).
J
(Jazelle)
Third execution state that allows some ARM
processors to execute Java bytecode in
hardware.
MNEMONICS IN ARM
Instruction Description Instruction Description
MOV Move data POP Pop on stack
ADD Addition SUB Subtraction
MUL Multiplication LSL Logical shift left
LSR Logical shift right ASR Arithmetic shift right
ROR Rotate right CMP Compare
AND Bitwise AND ORR Bitwise OR
EOR Bitwise XOR LDR Load
STR Store LDM Load multiply
STM Store multiply PUSH Push on stack
B Branch BL Branch with link
BX Branch with exchange BLX Branch with link and
exchange
SWI/SVC System call MVN Move 2’s complement
FORMAT OF ARM INSTRUCTIONS
• MNEMONIC{S} {condition} {Rd}, Operand1, Operand2
Where, MNEMONIC : Short name of the instruction
{S} : An optional suffix. If S is specified, the condition flags are updated on the result of the operation.
{Condition} : Conditions that has to be met for the execution of the instruction.
{Rd} : Destination of the register for storing the output of the instruction.
Operand1 : First register (either can be a register or an immediate value).
Operand2 : Second (Flexible) operand (can be a register or an immediate value with a level of shift).
INSTRUCTION EXAMPLES
Rx, LSR n Register x with logical shift right by n bits (1 = n = 32)
Rx, RRX Register x with rotate right by one bit, with extend
ADD R0, R1, R2 Adds contents of R1 (Operand1) and R2 (Operand2 in a form of
register) and stores the result into R0 (Rd).
MOVLE R0, #5 Moves number 5 (Operand2, because the compiler treats it as MOVE
R0, R0, #5) to R0 (Rd) ONLY if the condition LE (Less Than or Equal) is
satisfied.
LOAD AND STORE
• ARM uses Load-store model for memory access
• On ARM data is must be moved from memory into registers before being
operated on.
• This means that incrementing a 32-bit value at a particular address into
register, increment it within the register, and store it back to the memory
from register.
DATA TYPES WITH THE INSTRUCTIONS LOAD AND STORE:
• ldr = Load Word
• ldrh = Load unsigned Half Word
• ldrsh = Load signed Half Word
• ldrb = Load unsigned Byte
• ldrsb = Load signed Bytes
• str = Store Word
• strh = Store unsigned Half Word
• strsh = Store signed Half Word
• strb = Store unsigned Byte
• strsb = Store signed Byte
ADDRESS MODES
Three basic offset forms with different address modes for each offset form.
1. Offset form: Immediate value as the offset
• Offset mode uses an immediate as offset
Example: ldr r3,[r1,#3]
2. Offset form: Register as the offset
• Offset mode uses a register as offset
Example: ldr r3,[r1,r2]
3. Offset form: scaled register as the offset
• Offset mode uses a scaled register as offset
Example: ldr r3,[r1,r2,LSL#2]
BRANCHES
Branches (aka Jumps) allow us to jump to another code segment. This is useful when we
need to skip (or repeat) blocks of codes or jump to a specific function. Best examples of such
a use case are IFs and Loops. So let’s look into the IF case first.
There are three types of branching instructions:
• Branch (B)
• Simple jump to a function
• Branch link (BL)
• Saves (PC+4) in LR and jumps to function
• Branch exchange (BX) and Branch link exchange (BLX)
• Same as B/BL + exchange instruction set (ARM <-> Thumb)
• Needs a register as first operand: BX/BLX reg
CONDITIONAL EXECUTION
Condition
Code
Meaning
(for cmp
or subs)
Status of
Flags
EQ Equal Z==1
NE Not Equal Z==0
GT
Signed
Greater
Than
(Z==0) &&
(N==V)
LT
Signed
Less Than
N!=V
GE
Signed
Greater
Than or
Equal
N==V
LE
Signed
Less Than
or Equal
(Z==1) ||
(N!=V)
CS or HS
Unsigned
Higher or
Same (or
Carry Set)
C==1
CC or LO
Unsigned
Lower (or
Carry
Clear)
C==0
• Branches can also be executed conditionally
and used for branching to a function if a specific
condition is met.
ARMSIM
• ARMsim is a desktop application, it allows users to simulate the execution of
ARM assembly language programs on a system based on the ‘ARM7TDMI’
processor.
• ARMsim includes both an assembler and a linker. However editor is not there,
so file must be loaded into the application.
• The file to be opened must be a source (.s) file or an object (.o) file.
ARMSIM LIMITATION
• The ARM architecture supports both little‐endian and big‐endian access to memory. But the
ARMsim supports only the little‐endian format.
• The ARM architecture has a special mode of execution called ‘Thumb mode’ which is
intended for embedded system applications where memory is a scarce resource. (each
thumb instruction occupies only 2 bytes).
Thumb mode is not currently supported by ARMsim.

Contenu connexe

Tendances

Tendances (20)

8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
microcomputer architecture-Instruction formats
microcomputer architecture-Instruction formatsmicrocomputer architecture-Instruction formats
microcomputer architecture-Instruction formats
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
ARM lab programs
ARM  lab programs  ARM  lab programs
ARM lab programs
 
Register transfer language
Register  transfer languageRegister  transfer language
Register transfer language
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Al2ed chapter13
Al2ed chapter13Al2ed chapter13
Al2ed chapter13
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
microcomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instructionmicrocomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instruction
 
Intrl 8086 instruction set
Intrl 8086 instruction setIntrl 8086 instruction set
Intrl 8086 instruction set
 
Ch4
Ch4Ch4
Ch4
 
Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor Instruction set of 8086 Microprocessor
Instruction set of 8086 Microprocessor
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignment
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
8051 addressing modes
 8051 addressing modes 8051 addressing modes
8051 addressing modes
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
10 8086 instruction set
10 8086 instruction set10 8086 instruction set
10 8086 instruction set
 
Avr instruction set
Avr instruction setAvr instruction set
Avr instruction set
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modes
 

Similaire à Armsim (simualtor)

Similaire à Armsim (simualtor) (20)

Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
UNIT 2 ERTS.ppt
UNIT 2 ERTS.pptUNIT 2 ERTS.ppt
UNIT 2 ERTS.ppt
 
07-arm_overview.ppt
07-arm_overview.ppt07-arm_overview.ppt
07-arm_overview.ppt
 
ARM Introduction
ARM IntroductionARM Introduction
ARM Introduction
 
arm-intro.ppt
arm-intro.pptarm-intro.ppt
arm-intro.ppt
 
07-arm_overview.ppt
07-arm_overview.ppt07-arm_overview.ppt
07-arm_overview.ppt
 
mod 4-2.pptx
mod 4-2.pptxmod 4-2.pptx
mod 4-2.pptx
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
 
ARM Fundamentals
ARM FundamentalsARM Fundamentals
ARM Fundamentals
 
ARM Micro-controller
ARM Micro-controllerARM Micro-controller
ARM Micro-controller
 
Lecture9
Lecture9Lecture9
Lecture9
 
Instruction set
Instruction setInstruction set
Instruction set
 
Memory Access Instructions
Memory Access InstructionsMemory Access Instructions
Memory Access Instructions
 
16201104.ppt
16201104.ppt16201104.ppt
16201104.ppt
 
06. thumb instructions
06. thumb instructions06. thumb instructions
06. thumb instructions
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
ARM Architecture Instruction Set
ARM Architecture Instruction SetARM Architecture Instruction Set
ARM Architecture Instruction Set
 
ARM AAE - Intrustion Sets
ARM AAE - Intrustion SetsARM AAE - Intrustion Sets
ARM AAE - Intrustion Sets
 

Dernier

Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 

Dernier (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 

Armsim (simualtor)

  • 1. ARMSIM 16BEC069 - MANAV KANOJIYA 16BEC070 - VIDHI SHAH 16BEC077 - PRITI KHANDELWAL 16BEC084 - SHREEYA MAKWANA 16BEC100 - SHIVEN PANDYA 16BEC101 - RAHUL BANSAL
  • 2. Courtesy : [1] Architecture Profile A (Architecture) R (Real-time) M (Microcontroller)
  • 4. DIFFERENT ISA FOR ARM ARM THUMB Instructions are always of 32 bit. Instructions are of 16 bit and they can be converted into 32 bit for arm exploit development process. All instructions support the conditional execution. Thumb state can support conditional execution by using IT instruction. All ARM versions support the arm state . Not all versions of ARM support the thumb state. While writing arm shellcode, we need to get rid of null bytes in arm state. Due to availability of 16 bit instructions, it reduces the chances of having null bytes.
  • 6.
  • 7. Flag Description N (Negative) Enabled if result of the instruction yields a negative number. Z (Zero) Enabled if result of the instruction yields a zero value. C (Carry) Enabled if result of the instruction yields a value that requires a 33rd bit to be fully represented. V (Overflow) Enabled if result of the instruction yields a value that cannot be represented in 32 bit two’s complement. E (Endian-bit) ARM can operate either in little endian, or big endian. This bit is set to 0 for little endian, or 1 for big endian mode. T (Thumb-bit) This bit is set if you are in Thumb state and is disabled when you are in ARM state. M (Mode-bits) These bits specify the current privilege mode (USR, SVC, etc.). J (Jazelle) Third execution state that allows some ARM processors to execute Java bytecode in hardware.
  • 8. MNEMONICS IN ARM Instruction Description Instruction Description MOV Move data POP Pop on stack ADD Addition SUB Subtraction MUL Multiplication LSL Logical shift left LSR Logical shift right ASR Arithmetic shift right ROR Rotate right CMP Compare AND Bitwise AND ORR Bitwise OR EOR Bitwise XOR LDR Load STR Store LDM Load multiply STM Store multiply PUSH Push on stack B Branch BL Branch with link BX Branch with exchange BLX Branch with link and exchange SWI/SVC System call MVN Move 2’s complement
  • 9. FORMAT OF ARM INSTRUCTIONS • MNEMONIC{S} {condition} {Rd}, Operand1, Operand2 Where, MNEMONIC : Short name of the instruction {S} : An optional suffix. If S is specified, the condition flags are updated on the result of the operation. {Condition} : Conditions that has to be met for the execution of the instruction. {Rd} : Destination of the register for storing the output of the instruction. Operand1 : First register (either can be a register or an immediate value). Operand2 : Second (Flexible) operand (can be a register or an immediate value with a level of shift).
  • 10. INSTRUCTION EXAMPLES Rx, LSR n Register x with logical shift right by n bits (1 = n = 32) Rx, RRX Register x with rotate right by one bit, with extend ADD R0, R1, R2 Adds contents of R1 (Operand1) and R2 (Operand2 in a form of register) and stores the result into R0 (Rd). MOVLE R0, #5 Moves number 5 (Operand2, because the compiler treats it as MOVE R0, R0, #5) to R0 (Rd) ONLY if the condition LE (Less Than or Equal) is satisfied.
  • 11. LOAD AND STORE • ARM uses Load-store model for memory access • On ARM data is must be moved from memory into registers before being operated on. • This means that incrementing a 32-bit value at a particular address into register, increment it within the register, and store it back to the memory from register.
  • 12. DATA TYPES WITH THE INSTRUCTIONS LOAD AND STORE: • ldr = Load Word • ldrh = Load unsigned Half Word • ldrsh = Load signed Half Word • ldrb = Load unsigned Byte • ldrsb = Load signed Bytes • str = Store Word • strh = Store unsigned Half Word • strsh = Store signed Half Word • strb = Store unsigned Byte • strsb = Store signed Byte
  • 13. ADDRESS MODES Three basic offset forms with different address modes for each offset form. 1. Offset form: Immediate value as the offset • Offset mode uses an immediate as offset Example: ldr r3,[r1,#3] 2. Offset form: Register as the offset • Offset mode uses a register as offset Example: ldr r3,[r1,r2] 3. Offset form: scaled register as the offset • Offset mode uses a scaled register as offset Example: ldr r3,[r1,r2,LSL#2]
  • 14. BRANCHES Branches (aka Jumps) allow us to jump to another code segment. This is useful when we need to skip (or repeat) blocks of codes or jump to a specific function. Best examples of such a use case are IFs and Loops. So let’s look into the IF case first. There are three types of branching instructions: • Branch (B) • Simple jump to a function • Branch link (BL) • Saves (PC+4) in LR and jumps to function • Branch exchange (BX) and Branch link exchange (BLX) • Same as B/BL + exchange instruction set (ARM <-> Thumb) • Needs a register as first operand: BX/BLX reg
  • 15. CONDITIONAL EXECUTION Condition Code Meaning (for cmp or subs) Status of Flags EQ Equal Z==1 NE Not Equal Z==0 GT Signed Greater Than (Z==0) && (N==V) LT Signed Less Than N!=V GE Signed Greater Than or Equal N==V LE Signed Less Than or Equal (Z==1) || (N!=V) CS or HS Unsigned Higher or Same (or Carry Set) C==1 CC or LO Unsigned Lower (or Carry Clear) C==0 • Branches can also be executed conditionally and used for branching to a function if a specific condition is met.
  • 16. ARMSIM • ARMsim is a desktop application, it allows users to simulate the execution of ARM assembly language programs on a system based on the ‘ARM7TDMI’ processor. • ARMsim includes both an assembler and a linker. However editor is not there, so file must be loaded into the application. • The file to be opened must be a source (.s) file or an object (.o) file.
  • 17. ARMSIM LIMITATION • The ARM architecture supports both little‐endian and big‐endian access to memory. But the ARMsim supports only the little‐endian format. • The ARM architecture has a special mode of execution called ‘Thumb mode’ which is intended for embedded system applications where memory is a scarce resource. (each thumb instruction occupies only 2 bytes). Thumb mode is not currently supported by ARMsim.