0% found this document useful (0 votes)
4 views7 pages

Understanding Program Relocation in SIC/XE

The document discusses program relocation in the context of multiprogramming on SIC/XE systems, highlighting the need for programs to be loaded into memory without prior knowledge of their execution order. It explains the concept of relocatable programs, which contain information for modifying addresses at load time, and details how assemblers generate object code to facilitate this process. The document also outlines the role of loaders in adjusting addresses during program loading.

Uploaded by

anony24mous135
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Understanding Program Relocation in SIC/XE

The document discusses program relocation in the context of multiprogramming on SIC/XE systems, highlighting the need for programs to be loaded into memory without prior knowledge of their execution order. It explains the concept of relocatable programs, which contain information for modifying addresses at load time, and details how assemblers generate object code to facilitate this process. The document also outlines the role of loaders in adjusting addresses during program loading.

Uploaded by

anony24mous135
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program Relocation

Prepared By: Dr. D. P. Singh


Overview
• Due to the larger main memory of SIC/XE, several programs
can be loaded and run at the same time.
• This kind of sharing machine among programs is known as
multiprogramming.
• It results in more productive use of hardware.
• If we knew in advance exactly which programs were to be
executed concurrently, we could assign the addresses when
the programs were assembled so that they would fit
together without overlap or wasted space.
• However it is not practical most of time
Overview cntd…
• We usually do not know exactly when jobs will be submitted,
how long they will run etc.

• Because of this, it is desirable to be able to load a program


into memory wherever there is a room for it.

• In this situation the actual starting address of the program is


not known until the load time.
Absolute Program or Absolute Assembly
PROG START 1000 Since assembler does not know the actual
1000 LDA FIVE 00100F location where the program will be loaded, it
1003 STA ALPHA 0C100C cannot make the necessary changes in the
addresses used by the program, however, the
1006 LDCH CHARZ 501012
assembler can identify for the loader those
1009 STCH C1 541013
parts of the object program that needs
100C ALPHA RESW 1 modification.
100F FIVE WORD 5 000005 An object program that contains the
1012 CHARZ BYTE C’Z’ 5A information necessary to perform this kind of
1013 C1 RESB 1
modification is called a relocatable program.
END Loaded
Loaded
at 1000 at 2000
1000 1001 1002 1003 1004 1005 2000 2001 2002 2003 2004 2005
00 10 0F 0C 10 0C 00 10 0F 0C 10 0C
1006 1007 1008 1009 100A 100B 2006 2007 2008 2009 200A 200B
50 10 12 54 10 13 50 10 12 54 10 13
100C 100D 100E 100F 1010 1011 200C 200D 200E 200F 2010 2011
ALPHA 00 00 05 ALPHA 00 00 05
1012 1013 2012 2013
5A C1 5A C1
Program Relocation (SIC/XE Program)
COPY START 0
0000 FIRST STL(14) RETADR 17202D 0
Loaded at 5000
. 5000
0000 17202D (STL RETADR)
. .
0006 CLOOP +JSUB(48) RDREC 4B101036 5006
0006 4B101036 (+JSUB RDREC)
Note that no matter where
000A LDA(00) LENGTH 032026 500A
000A 032026 (LDA LENGTH) the program is loaded,
. . RDREC is always 1036 bytes
0030 RETADR RESW 1 past the starting address of
5030
0030 RETADR the program.
0033 LENGTH RESW 1 5033
0033  LENGTH
. .
. 6036
1036 B410 (CLEAR X)
1036 RDREC CLEAR(B4) X B410  RDREC
. .

TA=01036
TA=(PC)+disp
0001 01 1011
0100 10 11 11 0100
0 0 010001
1 00000
0000 0010
0001 00001101
0000 0011 0110 =0003+02D=0030
It is not
(RDREC)
equal to
(RETADR)
RDREC
Solution of Relocation Problem
• When the assembler generates the object code for the JSUB
instruction which is considered, it will insert the address of
RDREC relative to the start of the program.(this is reason,
LOCCTR is initialized 0 for the assembly)
• The assembler will also produce a command for the loader,
instructing it to add the beginning address of the program to
the address field in the JSUB instruction at load time.
• Command for loader is part of the object program (written in
modification record)
Thank You

You might also like