Maurice's Notes
Blog
Low Level Computing
Low Level Computing
  • Operating Systems
    • General Operating Systems
      • OS Structure
      • Main Memory
        • Basic Hardware
        • Address Binding
        • Memory Address Register
      • Booting
        • MBR (Master Boot Record)
        • Global Descriptor Table
      • Direct Memory Access (DMA)
        • DMA
      • Processes
        • Basics
        • Process Scheduling
    • Linux Operating System
      • Linker Scripts
      • Position Independent Code/Executable
      • Relocation
      • Understanding PLT and GOT
    • Windows Operating System
      • Page 1
    • Real-Time Embedded Systems
      • Real-Time Scheduling
        • Cyclic Executive
  • Computer Architecture
    • Architecture Fundamentals
      • Introduction
      • Cache Basics
      • Cache Memory
      • A Few CPU Formulas
    • RISC Architectures
      • ARM
        • ARM Design Philosophy
        • RISC Review
        • Exceptions, Interrupts, & Vector Table
        • ARM Pipelines
        • ARM Registers
        • ARM Branch Instructions
        • ARM CSPR (Instructions)
        • ARM Data Processing Instructions
        • Load/Store Instructions
        • Profiling Cycle Counter
        • Compiler Optimizations
      • RISCV
    • CISC Architectures
    • Cache Coherency
      • Basic Introduction
      • Memory Sequential Consistency
  • Exploits
    • Walkthrough: Return-to-Libc
    • Access Physical Memory
  • Compilers & Runtime Systems
    • Introduction
      • Programming Language Basics
      • Static Scope
    • Syntax Translation
      • Syntax Defined
      • Parsing
    • Algorithms
      • FIRST FOLLOW (Top-Down) Parsing
      • Building a Recursive Descent Parser
      • Construction: Regular Expression -> NFA
Powered by GitBook
On this page

Was this helpful?

  1. Computer Architecture
  2. RISC Architectures
  3. ARM

Load/Store Instructions

  • Load / Store instructions

    • used to move data from memory into a register, and from a register to memory

    • 3 Types of load-store instructions

      • single-register transfer

      • multiple-register transfer

      • swap

  • Single register transfer

    • moving a single data item in/out of a register

      • example: LDR / STR

    • can only operate on a boundary alignment that is the same as the datatype size being loaded/stored.

      • e.g. a 32-bit word can only be loaded on a mem address that is a multiple of 0, 4, 8, 16, and so on.

    • example (load register r0 with contents of memory address pointed to by reg r1)

      LDR r0, [r1] ; Can also be LDR r0, [r1, #0] STR r0, [r1] ; Can also be STR r0, [r1, #0]

    • Addressing Modes: Data Base Address Example

  • Preindex with writeback: mem[base + offset] base + offset LDR r0, [r1,#4]!

  • preindex mem[base + offset] not updated LDR r0, [r1, #4]

  • postindex mem[base] base + offset LDR r0, [r1], #4

  • predindex with w/b calculates an address from base register plus offset and updates that address base register with new addr.

    • the '!' denotes update, so given: LDR r0, [r1, #4]!

    • r1 is the base register, #4 is the offset, and '!' means update r1 with the calculated address (base + offset)

      • remember enclosing in [ ] means memory calculation. [base, #offset] is calculate memory address as address of base + offset.

  • preindex is similar to preindex with w/b, except it does not update base with the newly calculated addr.

  • postfix only updates address base register after the address is used

  • Addressing mode combinations

    • note: Rn is source register, but it is not the source register Rm that can be preprocessed by the barrel shifter

    • some modes use Rn others use Rm

preindex with immediate offset [Rn, #+/-offset_12] predindex register offset [Rn, +/-Rm] Preindex with scaled register offset [Rn, +/-Rm, shift #shift_immediate] ... repeat patterns above for preindex and postindex

  • Multiple-register transfer

    • can transfer multiple registers b/t memory and the processor in a single instruction

PreviousARM Data Processing InstructionsNextProfiling Cycle Counter

Was this helpful?