On 12/4/24 14:19, Mike Katz via cctalk wrote:
I'm sorry but you don't need segment registers
for
position independent code at all.
Address all data off of the index registers or off the PC
and all branches are relative.
The PDP-11 had short relative jumps, etc. that were +/- 128
words, so subroutines with small loops, etc. could run
anywhere in memory without rerunning the compiler/assembler.
The IBM 360 had a base register that was used in all memory
references, so the entire object deck (program section, data
section, constants) could be loaded anywhere in memory, then
the base register was set to the beginning of the partition,
and it was all relocatable. However, if the code stored a
physical address at any time (really common in 360 code)
then the program could NOT be moved after it started running.
Jon