System Software: An Introduction To Systems Programming Leland L. Beck 3rd Edition Addison-Wesley, 1997
System Software: An Introduction To Systems Programming Leland L. Beck 3rd Edition Addison-Wesley, 1997
Book
Course Information
Time
Web Sites
http://140.128.101.171/~johnaxer
[email protected] http://www.hpc.csie.thu.edu.tw
Teaching assistant
Gain Score
Participation: 5 % Two quizzes: 20% Two or Three home works: 15 % A final project: 15% A mid exam: 20% A final exam: 25%
System Programming
Chapter 1: Background Chapter 2: Assemblers Chapter 3: Loaders and Linkers Chapter 4: Macro Processors Chapter 5: Compilers
Operating Systems Other System Software Software Engineering Issues
Chapter 1 Background
Outline
Introduction System Software and Machine Architecture The Simplified Instructional Computer (SIC)
1.1 Introduction
System Software consists of a variety of programs that support the operation of a computer. The programs implemented in either software and (or) firmware that makes the computer hardware usable. The software makes it possible for the users to focus on an application or other problem to be solved, without needing to know the details of how the machine works internally.
One characteristic in which most system software differs from application software is machine dependency. System programs are intended to support the operation and use of the computer itself, rather than any particular application. Text editor, assembler, compiler, loader or linker, debugger, macro processors, operating system, database management systems, software engineering tools,
9
Text editor
Loader or linker
Debugger
10
Application Program
Debugger Complier Macro Processor Text Editor Utility Program (Library) Load and Linker
Assembler
Memory Management
Process Management
Device Management
Information Management
OS
Machine dependent ()
Instruction Set, Instruction Format, Addressing Mode, Assembly language General design logic/strategy, Two passes assembler
Machine independent ()
Machine independent
Machine Dependent
Computer
12
The two versions has been designed to be upward compatible SIC (Simplified Instructional Computer) SIC/XE (Extra Equipment)
13
SIC
Upward compatible Memory consists of 8-bit bytes, 3 consecutive bytes form a word (24 bits) There are a total of 32768 bytes (32 KB) in the computer memory. 5 registers, 24 bits in length
A X L PC SW
0 1 2 8 9
Accumulator Index register Linkage register (JSUB) Program counter Status word (Condition Code)
14
Data Formats
Integers are stored as 24-bit binary number 2s complement representation for negative values Characters are stored using 8-bit ASCII codes No floating-point hardware on the standard version of SIC
15
Instruction Cycle
CPU
Control Unit (CU) Arithmetic and Logic Unit (ALU) Register Fetch Cycle Execution Cycle
Instruction Cycle
Fetch Instruction
Decoder
Fetch Operand
Computation
Store Result
16
Instruction format
Addressing Modes
17
Instruction set
Format 3 Load and store registers (LDA, LDX, STA, STX, etc.) Integer arithmetic operations (ADD, SUB, MUL, DIV) Compare instruction (COMP) Conditional jump instructions (JLT, JEQ, JGT) JSUB jumps to the subroutine, placing the return address in register L. RSUB returns by jumping to the address contained in register L.
18
I/O
I/O are performed by transferring 1 byte at a time to or from the rightmost 8 bits of register A. Each device is assigned a unique 8-bit code as an operand. Test Device (TD): tests whether the addressed device is ready to send or receive
< ready
= not ready
19
B S T
3 4 5
Base register; used for addressing General working register General working register
20
Data format
24-bit binary number for integer, 2s complement for negative values 48-bit floating-point data type The exponent is between 0 and 2047 f*2(e-1024) 0: set all bits to 0
1 S 11 36
exponent
fraction
21
Instruction formats
Relative addressing () - format 3 (e=0) Extend the address to 20 bits - format 4 (e=1) Dont refer memory at all - formats 1 and 2
22
Addressing modes
n i x b p e Simple n=0, i=0 (SIC) or n=1, i=1 Immediate n=0, i=1 TA=Valus Indirect n=1, i=0 TA=(Operand) Base relative b=1, p=0 TA=(B)+disp 0 <= disp <= 4095 PC relative b=0, p=1 TA=(PC)+disp -2048 <= disp <= 2047
23
Addressing mode
b=0, p=0 TA=disp x=1 TAnew=TAold+(X) x=1, b=1, p=0 TA=(B)+disp+(X) x=1, b=0, p=1 TA=(PC)+disp+(X) x=1, b=0, p=0 e=1
24
Figure 1.1
Memory address
25
26
Instruction set
Format 1, 2, 3, or 4 Load and store registers (LDB, STB, etc.) Floating-point arithmetic operations (ADDF, SUBF, MULF, DIVF) Register-to-register arithmetic operations (ADDR, SUBR, MULR, DIVR) A special supervisor call instruction (SVC) is provided 1 byte at a time, TD, RD, and WD SIO, TIO, and HIO are used to start, test, and halt the operation of I/O channels.
27
I/O
five
28
29
30
31
String copy
32
33
34
35
36
37
38
complicated instruction set different instruction formats and lengths many different addressing modes e.g. VAX or PDP-11 from DEC e.g. Intel x86 family
39
RISC Machines
RISC system
instruction
standard, fixed instruction format single-cycle execution of most instructions memory access is available only for load and store instruction other instructions are register-to-register operations a small number of machine instructions, and instruction format
a large number of general-purpose registers a small number of addressing modes Three RISC machines