The Assembly Language Level - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

The Assembly Language Level

Description:

Each module has its own address space, starting at 0. Tasks Performed by the Linker (2) ... The same object modules after linking and after relocation has been ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 36
Provided by: steve1847
Category:

less

Transcript and Presenter's Notes

Title: The Assembly Language Level


1
The Assembly Language Level
  • Chapter 7

2
Assembly Language
  • True assembly is a one to one mapping with
    machine language instructions
  • Assembly language translated into object program
    or executable binary program
  • When running program, 3 levels are present,
  • microarchitecture
  • ISA
  • OSM

3
Reasons for Assembly
  • Pro Faster
  • Pro - Smaller
  • Pro- Full access to hardware
  • interrupts
  • device controllers
  • Con- takes longer to write
  • Con takes longer to debug
  • Con Harder to maintain
  • Con Limited to single family architecture

4
Why Use Assembly Language?
  • Comparison of assembly language and high-level
    language
  • programming, with and without tuning.

5
Assembly
  1. Optimize code
  2. Writing for machine with limited resources
  3. Tuning recoding in assembly to speed critical
    code sections
  4. Understand how compilers work and what they
    produce
  5. Only way to get feel of ISA level

6
Format of an Assembly Language Statement (1)
  • Computation of N I J. (a) Pentium 4.

7
Format of an Assembly Language Statement (2)
  • Computation of N I J. (b) Motorola 680x0.

8
Format of an Assembly Language Statement (3)
  • Computation of N I J. (c) SPARC.

9
Pseudoinstructions (1)
  • Some of the pseudoinstructions available in the
  • Pentium 4 assembler (MASM).

10
Pseudoinstructions (2)
  • Some of the pseudoinstructions available in the
  • Pentium 4 assembler (MASM).

11
Macro Definition, Call, Expansion (1)
  • Assembly language code for interchanging P and Q
    twice.
  • (a) Without a macro. (b) With a macro.

12
Macro Definition, Call, Expansion (2)
  • Comparison of macro calls with procedure calls.

13
Macros with Parameters
  • Nearly identical sequences of statements.
  • (a) Without a macro. (b) With a macro.

14
Two Pass Assemblers (1)
  • The instruction location counter (ILC) keeps
    track of the address
  • where the instructions will be loaded in memory.
    In this example, the statements prior to MARIA
    occupy 100 bytes.

15
Two Pass Assemblers (2)
  • A symbol table for the program of Fig. 7-7.

16
Two Pass Assemblers (3)
  • A few excerpts from the opcode table for a
    Pentium 4 assembler.

17
Pass One (1)
. . .
  • Pass one of a simple assembler.

18
Pass One (2)
. . .
. . .
  • Pass one of a simple assembler.

19
Pass One (3)
. . .
  • Pass one of a simple assembler.

20
Pass Two (1)
. . .
  • Pass two of a simple assembler.

21
Pass Two (2)
. . .
  • Pass two of a simple assembler.

22
The Symbol Table (1)
  • Hash coding. (a) Symbols, values, and the hash
    codes derived from the symbols.

23
The Symbol Table (2)
  • Hash coding. (b) Eight-entry hash table with
    linked lists of symbols and values.

24
Linking and Loading
  • Generation of an executable binary program from a
    collection of
  • independently translated source procedures
    requires using a linker.

25
Tasks Performed by the Linker (1)
  • Each module has its own address space, starting
    at 0.

26
Tasks Performed by the Linker (2)
  • Each module has its own address space, starting
    at 0.

27
Tasks Performed by the Linker (3)
  • Each module has its own address space, starting
    at 0.

28
Tasks Performed by the Linker (4)
  • Each module has its own address space, starting
    at 0.

29
Tasks Performed by the Linker (5)
  • The object modules of Fig. 7-14 after being
    positioned in the binary image but before being
    relocated and linked.

30
Tasks Performed by the Linker (6)
  • The same object modules after linking and
    after relocation has been performed. Together
    they form an executable binary program, ready to
    run

31
Structure of an Object Module
  • The internal structure of an object module
    produced by a translator.

32
Binding Time and Dynamic Relocation
  • The relocated binary program of Fig. 7-15(b)
    moved up 300 addresses. Many instructions now
    refer to an incorrect memory address.

33
Dynamic Linking in MULTICS (1)
  • Before EARTH is called.

34
Dynamic Linking in MULTICS (2)
  • After EARTH has been called and linked.

35
Dynamic Linking in Windows
  • Use of a DLL file by two processes.
Write a Comment
User Comments (0)
About PowerShow.com