Introduction to Machine And Assembly Language - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Introduction to Machine And Assembly Language

Description:

Attached to the rest of the hardware via the data bus, control bus and address bus ... Not necessarily, but some are more apropos for some things than others ... – PowerPoint PPT presentation

Number of Views:183
Avg rating:3.0/5.0
Slides: 16
Provided by: richar134
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Machine And Assembly Language


1
Introduction to Machine And Assembly Language
  • IA-32 Processor Architecture
  • Dr. Richard Ford

2
Understanding the Processor
  • How is the IA-32 processor structured?
  • How is the computer structured?
  • Fundamental items
  • Registers
  • Heap
  • Stack

3
Why the IA-32 Arch?
  • Probably most common architecture out there
  • The host for Windows
  • Probably one of the worst assembly languages to
    learn!
  • Why?

4
The Structure of the Computer
  • Processor (CPU)
  • Memory Storage Unit
  • I/O Devices
  • Driven by the clock

5
The Processor Itself
  • Attached to the rest of the hardware via the data
    bus, control bus and address bus
  • Is responsible for all(?) calculations and logic
    for the machine
  • Is the location that the real program runs
    broken down into very simple instructions
  • Has access to limited storage locations called
    registers

6
Multitasking?
  • The CPU can, in general, execute one full
    instruction at a time
  • So how does Windows run five different things at
    once?

7
Processor Modes of Operation
  • Protected Mode
  • All instructions and features available programs
    work in their own protected memory segment
  • Virtual 8086 Mode
  • Execution of old MSDOS programs in a safe
    multitasking environment
  • Real Address Mode
  • Looks like an 8086 processor
  • System Management Mode
  • Functions for power management etc.

8
Address Space
  • Protected mode Direct memory addressing of up to
    4GB
  • Real mode 1MB of memory can be accessed
  • How? Wait and see, its a little messy

9
Registers
  • High speed storage locations no lag compared to
    regular memory
  • Note Much quicker to access registers than
    system memory
  • Basic Program Execution Registers
  • 8 General Purpose Registers
  • 8 Segment Registers
  • 1 Flags Register
  • 1 Instruction Pointer

10
General Purpose Registers
  • Primarily arithmetic and data movement
  • 8 bit, 16 bit and 32 bit
  • 32-bit
  • EAX, EBX, ECX, EDX, EBP, ESP, ESI, EDI
  • 16-bit
  • AX, BX, CX etc.
  • 8-bit
  • AH, AL, BH, BL etc.

11
Specialized Uses?
  • Not necessarily, but some are more apropos for
    some things than others
  • EAX Multiplication and division instructions
  • ECX Loop counter
  • ESP Stack pointer (more on this later)
  • ESI, EDI High speed memory transfer (indexes
    remember this as Source Index and Destination
    Index)
  • EBP Frame pointer, pointing to a particular
    stack frame
  • CAVEAT Dont assume that a register is for
    something. This is especially important when
    reverse engineering code!

12
Segment Registers
  • Used to address particular segments of memory
    (code segment, various data segments etc.)

13
Instruction Pointer
  • The address of the next instruction to be
    executed by the processor. Jumps and Calls work
    by manipulating this value.

14
EFLAGS
  • Bit-field of states
  • Each bit means something different
  • Control flags which effect the CPU operation
    (more later as needed)
  • Status Flags
  • Carry (CF) set when an unsigned arithmetic
    operation overflows
  • Overflow (OF) set when a signed arithmetic
    operation overflows
  • Sign (SF) set when a negative result is
    generated logically or arithmetically
  • Zero (ZF) set when the result of a comparison
    or arithmetical operation is Zero
  • Auxiliary Carry Set when an 8-bit operation
    causes a carry from bit 3 to bit 4
  • Parity sums the number of set bits in a number
    and indicates whether the result is odd or even

15
Other Registers
  • Not really going to use them in an introductory
    class, but
  • FPU Registers
  • ST(0), ST(1) ST(7)
  • 64-bit registers for MMX instruction set
  • 128-bit XMM registers
Write a Comment
User Comments (0)
About PowerShow.com