CS2422 Assembly Language & System Programming December 22, 2005.

Slides:



Advertisements
Similar presentations
The Assembly Language Level
Advertisements

Chapter 3 Loaders and Linkers
Linkage Editors Difference between a linkage editor and a linking loader: Linking loader performs all linking and relocation operations, including automatic.
3. Loaders & Linkers1 Chapter III: Loaders and Linkers Chapter goal: r To realize how a source program be loaded into memory m Loading m Relocation m Linking.
Chapter 3 Loaders and Linkers
Macro Processor.
Mr. D. J. Patel, AITS, Rajkot 1 Operating Systems, by Dhananjay Dhamdhere1 Static and Dynamic Memory Allocation Memory allocation is an aspect of a more.
Machine Independent Assembler Features
Assembler Design Options
Machine-Independent Loader Features
1 Machine-Independent Features Automatic Library Search automatically incorporate routines from a subprogram library Loading Options.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler I.
CS2422 Assembly Language and System Programming Linking Loader Department of Computer Science National Tsing Hua University.
Chih-Hung Wang Chapter 2: Assembler (Full) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley,
Chih-Hung Wang Chapter 2: Assembler (Part-1) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley, 1997.
CS2422 Assembly Language & System Programming January 2, 2007.
System Software by Leland L. Beck Chapter 2
Assembler – Assembler Design Options. One-Pass Assemblers (1/2) Main problem  Forward references Data items Labels on instructions Solution  Data items:
Loader- Machine Independent Loader Features
Chapter 2 Assemblers Assembler Linker Source Program Object Code
Assemblers Dr. Monther Aldwairi 10/21/20071Dr. Monther Aldwairi.
An introduction to systems programming
1 Chapter 3 Loaders and Linkers Source Program Assembler Object Code Loader Executable Code Linker.
Software Development Process Compiler Linker C File Asm. File Binary File Exec. File Assemble r Library Implementation Phase Debugger Profiler Verification.
Machine-Independent Assembler Features
Assembler (Basic Functions)
Assembler – Machine Independent Features. Literals Design idea  Let programmers to be able to write the value of a constant operand as a part of the.
CS2422 Assembly Language & System Programming December 14, 2006.
UNIT II ASSEMBLERS.
A Simple Two-Pass Assembler
Assemblers.
Assembler Design Options
Assemblers.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler II.
One Pass with Fixup One-pass structure definition must occur before any uses (that is, uses can have only backward references to definitions) examples:
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
1 Assemblers System Software by Leland L. Beck Chapter 2.
Assemblers System Software by Leland L. Beck Chapter 2.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
CS2422 Assembly Language and System Programming Assembler Design Options Department of Computer Science National Tsing Hua University.
1 Assemblers System Programming by Leland L. Beck Chapter 2.
Machine-Independent Assembler Features Literals, Symbol-Defining Statements, Expressions, Program Blocks, Control Sections and Program Linking.
2 : Assembler 1 Chapter II: Assembler Chapter goal: r Introduce the fundamental functions that any assembler must perform. m Assign machine address m Translate.
1 Assemblers System Software by Leland L. Beck Chapter 2.
Machine Independent Assembler Features
Loader and Linker.
LINKERS Execution of a program written in a language L involves the following steps: 1.Translation of the program: Performed by the translator for language.
Assembler Design Options One-Pass and Multi-Pass Assemblers.
Assemblers System Software.
Linking Loader untuk SIC/XE Machine. Lebih Lanjut mengenai Absolute Loader Shortcoming of an absolute loader –Programmer needs to specify the actual address.
One-pass structure definition must occur before any uses (that is, uses can have only backward references to definitions) examples: macro definition before.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 9 - Assembler 4.
CC410: System Programming
Machine Independent Assembler Features
System Programming and administration
System Software by Leland L. Beck Chapter 2
Machine Independent Assembler Features
Chapter 9 : Assembler Design Options
Assembler Design Options
Assembler Design Options
Optional Assembler Features
Loaders and Linkers: Features
Machine Independent Features
Assembler Design Options
A Simple Two-Pass Assembler
Optional Assembler Features 2
System Programming by Leland L. Beck Chapter 2
Machine Independent Assembler Features
Machine Independent Assembler Features
An introduction to systems programming
Presentation transcript:

CS2422 Assembly Language & System Programming December 22, 2005

Today’s Topic Beck’s Section 2.4: Assembler Design Options –One-pass assemblers –Multi-pass assemblers –Two-pass assembler with overlay structure

Study Guide

Two-Pass Assembler with Overlay Structure (1/3) For small memory –Pass 1 and pass 2 are never required at the same time –Three segments Root: driver program and shared tables and subroutines Pass 1 Pass 2 –Tree structure –Overlay program

Two-Pass Assembler with Overlay Structure (2/3) Tree structure

Two-Pass Assembler with Overlay Structure (3/3) Overlay programs

One-Pass Assemblers (1/2) Main problem –Forward references Data items Labels on instructions Solution –Data items: require all such areas be defined before they are referenced –Labels on instructions: no good solution

One-Pass Assemblers (2/2) Two types of one-pass assembler –Load-and-go Produces object code directly in memory for immediate execution –The other Produces usual kind of object code for later execution

Load-and-go Assembler (1/3) Characteristics –Useful for program development and testing –Avoids the overhead of writing the object program out and reading it back –Both one-pass and two-pass assemblers can be designed as load-and-go. –However one-pass also avoids the over head of an additional pass over the source program –For a load-and-go assembler, the actual address must be known at assembly time, we can use an absolute program

Load-and-go Assembler (2/3) Forward references handling 1. Omit the address translation 2. Insert the symbol into SYMTAB, and mark this symbol undefined 3. The address that refers to the undefined symbol is added to a list of forward references associated with the symbol table entry 4. When the definition for a symbol is encountered, the proper address for the symbol is then inserted into any instructions previous generated according to the forward reference list

Load-and-go Assembler (3/3) At the end of the program –Any SYMTAB entries that are still marked with * indicate undefined symbols –Search SYMTAB for the symbol named in the END statement and jump to this location to begin execution The actual starting address must be specified at assembly time Example –Figure 2.18, 2.19

Figure 2.18

Figure 2.19(a)

Figure 2.19(b)

Producing Object Code When external working-storage devices are not available or too slow (for the intermediate file between the two passes Solution: –When definition of a symbol is encountered, the assembler must generate another Tex record with the correct operand address –The loader is used to complete forward references that could not be handled by the assembler –The object program records must be kept in their original order when they are presented to the loader Example: Figure 2.20

Figure 2.20

Multi-Pass Assemblers Restriction on EQU and ORG –No forward reference, since symbols’ value can’t be defined during the first pass Example –Use link list to keep track of whose value depend on an undefined symbol Figure 2.21

Figure 2.21 (1/5)

Figure 2.21 (2/5)

Figure 2.21 (3/5)

Figure 2.21 (4/5)

Figure 2.21 (5/5)