Relocation (computing): Difference between revisions

Content deleted Content added
Further reading: improved refs
improved refs
Line 60:
{{Reflist|refs=
<ref name="Intel_iRMX">{{cite book |title=iRMX 86 Application Loader Reference Manual |publisher=[[Intel]] |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/intel/iRMX/iRMX_86_Rev_6_Mar_1984/146196_Burst/iRMX_86_Application_Loader_Reference_Manual.pdf |access-date=2020-01-11 |url-status=live |archive-url=https://web.archive.org/web/20200111215002/http://bitsavers.informatik.uni-stuttgart.de/pdf/intel/iRMX/iRMX_86_Rev_6_Mar_1984/146196_Burst/iRMX_86_Application_Loader_Reference_Manual.pdf |archive-date=2020-01-11 |chapter=Types of Object Code |pages=((1{{hyphen}}2, 1{{hyphen}}3)) |quote=[…] ''Absolute code'', and an absolute object module, is code that has been processed by LOC86 to run only at a specific ___location in memory. The [[Loader (computing)|Loader]] loads an absolute object module only into the specific ___location the module must occupy. ''[[Position-independent code]]'' (commonly referred to as PIC) differs from absolute code in that PIC can be loaded into any memory ___location. The advantage of PIC over absolute code is that PIC does not require you to reserve a specific block of memory. When the Loader loads PIC, it obtains [[iRMX&nbsp;86]] memory segments from the pool of the calling task's job and loads the PIC into the segments. A restriction concerning PIC is that, as in the [[PL/M-86]] COMPACT model of segmentation […], it can have only one code segment and one data segment, rather than letting the base addresses of these segments, and therefore the segments themselves, vary dynamically. This means that PIC programs are necessarily less than 64K bytes in length. PIC code can be produced by means of the BIND control of LINK86. ''Load-time locatable code'' (commonly referred to as LTL code) is the third form of object code. LTL code is similar to PIC in that LTL code can be loaded anywhere in memory. However, when loading LTL code, the Loader changes the base portion of pointers so that the pointers are independent of the initial contents of the registers in the microprocessor. Because of this fixup (adjustment of base addresses), LTL code can be used by tasks having more than one code segment or more than one data segment. This means that LTL programs may be more than 64K bytes in length. [[FORTRAN 86]] and [[Pascal 86]] automatically produce LTL code, even for short programs. LTL code can be produced by means of the BIND control of LINK86. […]}}</ref>
<ref name="Levine_1999_CH1_CH3">{{cite book |author-last=Levine |author-first=John R. |author-link=John R. Levine |title=Linkers and Loaders |date=2000 |orig-yeardate=October 1999 |edition=1 |publisher=[[Morgan Kaufmann]] |series=The Morgan Kaufmann Series in Software Engineering and Programming |___location=San Francisco, USA |isbn=1-55860-496-0 |oclc=42413382 |chapter=Chapter 1: Linking and Loading & Chapter 3: Object Files |pages=5<!-- , --> |url=https://www.iecc.com/linker/ |access-date=2020-01-12 |url-status=live |archive-url=https://archive.today/20121205032107/http://www.iecc.com/linker/ |archive-date=2012-12-05}} Code: [https://archive.today/20200114225034/https://linker.iecc.com/code.html][ftp://ftp.iecc.com/pub/linker/] Errata: [https://linker.iecc.com/<!-- https://archive.today/20200114224817/https://linker.iecc.com/ 2020-01-14 -->]</ref>
<ref name="Borland_2007">{{cite web |author=Borland |author-link=Borland |title=Borland article #15961: Coping with 'Fixup Overflow' messages. |orig-yeardate=1998-07-02 |date=1999-09-01 |series=Technical Information Database - Product: Borland C++ 3.1 |work=community.borland.com |id=TI961C.txt #15961 |url=http://vmlinux.org/~jakov/community.borland.com/15961.html |access-date=2007-01-15 |url-status=live |archive-url=https://web.archive.org/web/20080707030831/http://vmlinux.org/~jakov/community.borland.com/15961.html |archive-date=2008-07-07}}</ref>
<ref name="ELF">{{cite web |title=Executable and Linkable Format (ELF) |series=Tool Interface Standards (TIS) Portable Formats Specification, Version 1.1 |website=skyfree.org |url=http://www.skyfree.org/linux/references/ELF_Format.pdf |access-date=2018-10-01 |url-status=live |archive-url=https://web.archive.org/web/20191224125108/http://www.skyfree.org/linux/references/ELF_Format.pdf |archive-date=2019-12-24}}</ref>
}}
 
== Further reading ==
* {{citation |title=11/34 Memory Management Basic Logic test |author-first=Glenn |author-last=Johnson |publisher=[[Digital Equipment Corporation]] (DEC) |date=1975-12-21 |orig-yeardate=1975-11-13 |id=MAINDEC-11-DFKTA-A-D |url=https://archive.org/stream/bitsavers_decpdp11xxAINDEC11DFKTAAD1134MEMORYMANAGEMENTBASIC_2477046/MAINDEC-11-DFKTA-A-D_1134_MEMORY_MANAGEMENT_BASIC_LOGIC_Dec75 |access-date=2017-08-19}}
* {{cite journal |author-first=Gary Arlen |author-last=Kildall |author-link=Gary Arlen Kildall |title=A simple technique for static relocation of absolute machine code |journal=[[Dr. Dobb's Journal of Computer Calisthenics & Orthodontia]] |publisher=[[People's Computer Company]] |id=#22 |volume=3 |number=2 |date=February 1978 |pages=10–13<!-- in the issue --> (66–69<!-- in the volume -->) |isbn=0-8104-5490-4<!-- of the volume --> |url=https://groups.google.com/d/msg/comp.os.cpm/TLHgIi16yTo/gupNB1ai8UQJ |access-date=2017-08-19 |url-status=live |archive-url=https://archive.today/20170909091943/https://groups.google.com/forum/%23!msg/comp.os.cpm/TLHgIi16yTo/gupNB1ai8UQJ#!topic/comp.os.cpm/TLHgIi16yTo<!-- https://archive.today/20170909091943/https://groups.google.com/forum/%23!msg/comp.os.cpm/TLHgIi16yTo/gupNB1ai8UQJ --> |archive-date=2017-09-09}} [https://archive.org/stream/dr_dobbs_journal_vol_03/dr_dobbs_journal_vol_03_djvu.txt] [https://web.archive.org/web/20170819141800/http://www.retrotechnology.com/dri/d_dri_refs.html] [https://web.archive.org/web/20170819173516/http://archive.computerhistory.org/resources/access/text/2016/12/102762506-05-01-acc.pdf] (This "resize" method, named ''page boundary relocation'', could be applied statically to a [[CP/M-80]] disk image using {{ill|MOVCPM|pl|MOVCPM (CP/M)}} in order to maximize the [[Transient Program Area|TPA]] for programs to run. It was also utilized dynamically by the CP/M debugger [[Dynamic Debugging Tool]] (DDT) to [[self-relocation|relocate itself]] into higher memory. The same approach was independently developed by [[Bruce Van Natta (IMSAI)|Bruce Van Natta]] of [[IMS Associates]] to produce relocatable [[PL/M]] code. As ''paragraph boundary relocation'', [[Self-relocation#Ref-Paul-2002-Drivers|another variant]] of this method was later utilized by dynamically [[high memory area|HMA]] self-relocating [[Terminate-and-Stay-Resident|TSR]]s like [[KEYB (DOS command)|KEYB]], [[SHARE (DOS command)|SHARE]], and [[NLSFUNC (DOS command)|NLSFUNC]] under [[DR DOS&nbsp;6.0]] and higher. A much more sophisticated and [[byte alignment|byte-level granular]] method based on a somewhat similar approach was independently conceived and implemented by Matthias R. Paul and Axel C. Frinke for their [[dynamic dead-code elimination]] to dynamically minimize the runtime footprint of resident drivers and TSRs (like FreeKEYB).)
* {{cite web |title=Legacy of Gary Kildall: The CP/M IEEE Milestone Dedication |author-first1=Robert |author-last1=Huitt |author-first2=Gordon |author-last2=Eubanks |author-link2=Gordon Eubanks |author-first3=Thomas "Tom" Alan |author-last3=Rolander |author-link3=Thomas Alan Rolander |author-first4=David |author-last4=Laws |author-first5=Howard E. |author-last5=Michel |author-first6=Brian |author-last6=Halla |author-first7=John Harrison |author-last7=Wharton |author-link7=John Harrison Wharton |author-first8=Brian |author-last8=Berg |author-first9=Weilian |author-last9=Su |author-first10=Scott |author-last10=Kildall |author-link10=Scott Kildall |author-first11=Bill |author-last11=Kampe |editor-first=David |editor-last=Laws |date=2014-04-25 |___location=Pacific Grove, California, USA |type=video transscription |id=CHM Reference number: X7170.2014 |publisher=[[Computer History Museum]] |url=https://archive.computerhistory.org/resources/access/text/2014/06/102746909-05-01-acc.pdf |access-date=2020-01-19 |url-status=live |archive-url=https://web.archive.org/web/20141227142045/http://archive.computerhistory.org/resources/access/text/2014/06/102746909-05-01-acc.pdf |archive-date=2014-12-27 |quote=[…] Laws: […] "dynamic relocation" of the OS. Can you tell us what that is and why it was important? […] [[Gordon Eubanks|Eubanks]]: […] what [[Gary Arlen Kildall|Gary]] did […] was […] mind boggling. […] I remember the day at the [[Naval Postgraduate School|school]] he came bouncing into the lab and he said, I have figured out how to relocate. He took advantage of the fact that the only byte was always going to be the [[high order byte]]. And so he created a [[bitmap]]. […] it didn't matter how much memory the computer had, the operating system could always be moved into the high memory. Therefore, you could commercialize this […] on machines of different amounts of memory. […] you couldn't be selling a 64K [[CP/M]] and a 47K CP/M. It'd just be ridiculous to have a hard compile in the addresses. So Gary figured this out one night, probably in the middle of the night thinking about some coding thing, and this really made CP/M possible to commercialize. I really think that without that relocation it would have been a very tough problem. To get people to buy it, it'd seem complicated to them, and if you added more memory you'd have to go get a different operating system. […] [[Intel]] […] had the [[little-endian|bytes reversed]], right, for the memory addresses. But they were always in the same place, so you could relocate it on a [[256 byte boundary]], to be precise. You could therefore always relocate it with just a bitmap of where those […] Laws: Certainly the most eloquent explanation I've ever had of dynamic relocation […]}} [https://ethw.org/Milestones:The_CP/M_Microcomputer_Operating_System,_1974][https://www.youtube.com/watch?v=HO6IPpL0y8g] (33 pages)
Line 73:
* {{cite web |title=Re: How does MOVCPM.COM work? |author-first=Charles "Chuck" P. |author-last=Guzis |date=2015-07-29 |work=Vintage Computer Forum |series=Genre: CP/M and MP/M |url=http://www.vcfed.org/forum/showthread.php?48532-How-does-MOVCPM-COM-work&p=376438#post376438 |access-date=2020-02-01 |url-status=live |archive-url=https://web.archive.org/web/20200201053054/http://www.vcfed.org/forum/showthread.php?48532-How-does-MOVCPM-COM-work=&p=376438 |archive-date=2020-02-01 |quote=[…] {{ill|MOVCPM|pl|MOVCPM (CP/M)}} uses an early type of PRL format. Basically, [[CP/M]] is assembled twice; the second time is 100H bytes offset. The two binaries are compared and a [[bitmap]] constructed. A set bit implies that the [[high-order byte]] of an address is to be adjusted. Low order address bytes are not affected; hence, "Page relocatble file". Each byte in the bitmap corresponds to 8 bytes in the binary data. […] So everything to be moved in MOVCPM is part of the image and its relocation bitmap. […]}}
* {{cite web |title=Re: Is it safe to use RST 28h in CP/M assembly programs? |author-first=Charles "Chuck" P. |author-last=Guzis |date=2016-11-08 |work=Vintage Computer Forum |series=Genre: CP/M and MP/M |url=http://www.vcfed.org/forum/showthread.php?54822-Is-it-safe-to-use-RST-28h-in-CP-M-assembly-programs&p=434954#post434954 |access-date=2020-02-01 |url-status=live |archive-url=https://web.archive.org/web/20200201053327/http://www.vcfed.org/forum/showthread.php?54822-Is-it-safe-to-use-RST-28h-in-CP-M-assembly-programs&p=434954 |archive-date=2020-02-01 |quote=[…] I've referenced PRL files and how they originally got their start with {{ill|MOVCPM|pl|MOVCPM (CP/M)}}, but became an integral part of [[MP/M]] and [[CP/M 3.0]]. But PRL files use a [[bitmap|bit map]] in which every bit corresponds to a memory ___location; one bits indicate that a page relocation offset should be added to the corresponding memory ___location. If you have very few absolute memory references (as opposed to relative ones) you may want to employ a pointer list (2 bytes per reference) rather than a bitmap. This is unlikely in [[8080]] code which doesn't have relative jumps, but may be a consideration for [[Z80]] code. The trick to quickly find this out is to assemble your program twice; the second time offset by 100H, then compare the two binaries. The advantage of [[runtime (program lifecycle phase)|run-time]] relocation is that you don't have to incur a penalty for code that attempts to get around the relocation issue--no "tricks"; just write straight code. […]}}
* {{cite journal |author-first=Richard L. |author-last=Roth |title=Relocation Is Not Just Moving Programs |___location=Ridgefield, CA, USA |journal=[[Dr. Dobb's Journal of Computer Calisthenics & Orthodontia]] |publisher=[[People's Computer Company]] |id=#22 |volume=3 |number=2 |date=February 1978 |orig-yeardate=1977 |pages=14–20<!-- in the issue --> (70–76<!-- in the volume -->) |isbn=0-8104-5490-4<!-- of the volume --> |url=https://archive.org/stream/dr_dobbs_journal_vol_03/dr_dobbs_journal_vol_03_djvu.txt |access-date=2019-04-19 |url-status=live |archive-url=https://web.archive.org/web/20190420010941/https://archive.org/stream/dr_dobbs_journal_vol_03/dr_dobbs_journal_vol_03_djvu.txt |archive-date=2019-04-20}}
* {{cite book |title=Assemblers, Compilers, and Program Translation |chapter=8.2.2 Relocating Loader |pages=[https://archive.org/details/assemblerscompil00cali/page/237 237]–241 |author-first=Peter |author-last=Calingaert |editor-first=Ellis |editor-last=Horowitz |editor-link=Ellis Horowitz |date=1979 |orig-yeardate=1978-11-05 |series=Computer software engineering series |publisher=[[Computer Science Press, Inc.]] |publication-place=Potomac, Maryland, USA |___location=[[University of North Carolina at Chapel Hill]] |edition=1st printing, 1st |isbn=0-914894-23-4 |issn=0888-2088 |lccn=78-21905 |url=https://archive.org/details/assemblerscompil00cali |url-access=registration |access-date=2020-03-20 }} (2+xiv+270+6 pages)
* {{cite book |title=The Microsoft OBJ File Format |publisher=[[Microsoft]], Product Support Services |id=Application Note SS0288 |url=https://www.fileformat.info/format/ms-obj/corion.htm |access-date=2017-08-21 |url-status=live |archive-url=https://archive.today/20170909092856/http://www.fileformat.info/format/ms-obj/corion.htm |archive-date=2017-09-09}}
* {{cite book |author-first1=Andrew Stuart |author-last1=Tanenbaum |author-link1=Andrew Stuart Tanenbaum |author-first2=Herbert |author-last2=Bos |title=Modern Operating Systems |edition=4 |date=2015 |publisher=[[Pearson Education Inc.]] |isbn=978-0-13359162-0}}
* {{cite web |author-first=John C. |author-last=Elliott |title=PRL file format |date=2012-06-05 |orig-yeardate=2000-01-02 |website=seasip.info |url=https://www.seasip.info/Cpm/prl.html |access-date=2020-01-26 |url-status=live |archive-url=https://web.archive.org/web/20200126182027/https://www.seasip.info/Cpm/prl.html |archive-date=2020-01-26 |quote=[…] A PRL file is a relocatable binary file, used by [[MP/M]] and [[CP/M Plus]] for various modules other than [[.COM file]]s. The file format is also used for FID files on the [[Amstrad PCW]]. There are several file formats which use versions of PRL: SPR (System PRL), RSP (Resident System Process). LINK-80 can also produce OVL (overlay) files, which have a PRL header but are not relocatable. [[Graphics System Extension|GSX]] drivers are in PRL format; so are [[Resident System Extension]]s (.RSX). […]}} [https://www.seasip.info/Cpm/amsfid.html#PRL%20file%20format]
* {{cite web |author-first=John C. |author-last=Elliott |title=Microsoft REL format |date=2012-06-05 |orig-yeardate=2000-01-02 |website=seasip.info |url=https://www.seasip.info/Cpm/rel.html |access-date=2020-01-26 |url-status=live |archive-url=https://web.archive.org/web/20200126181737/https://www.seasip.info/Cpm/rel.html |archive-date=2020-01-26 |quote=[…] The REL format is generated by [[Microsoft]]'s M80 and [[Digital Research]]'s RMAC. […]}}
* {{cite web |title=Support for PRL, page relocatable executable for MP/M |date=2018-09-05 |orig-yeardate=2018-09-02 |author=feilipu |work=z88dk |url=https://github.com/z88dk/z88dk/issues/935 |access-date=2020-01-26 |url-status=live |archive-url=https://web.archive.org/web/20200201053652/https://github.com/z88dk/z88dk/issues/935 |archive-date=2020-02-01 |quote=[…] Out of the assembled [[Microsoft]] .REL files the linker has to generate a .PRL format executable for [[MP/M]]. The .PRL format is essentially a [[.COM file]] with some additional information to enable the program and its data to be relocated onto any page. What does a .PRL file look like? The first bytes are size of the program, followed by the program origin at 0x0100. Following the program, there is a bit-for-byte mask appended to allow the MP/M system to know which bytes in the program need to be changed when the program is relocated. How does the linker do that without disassembling the whole application? In advance the program is linked for two different origins 0x0100 and 0x0200, from the .REL objects. The linker trick is simply recognising which bytes in the two versions of the executable differ. These bytes are then recorded in the bit mask stored following the executable, and the final .PRL program is designed to run from 0x0100 plus its page offset. The same trick is done for the .RSP and .SPR executable files, except that both these formats forego the offset, and run from 0x0000 plus their page offset. […]}}
* {{cite journal |title=Understanding Relocatable Code |series=The Next Step |author-first=Hardin |author-last=Brothers |journal=[[80 Micro]] |publisher=[[1001001, Inc.]] |issn=0744-7868 |date=April 1983 |issue=39 |pages=[https://archive.org/details/80-microcomputing-magazine-1983-04/page/n37 38], 40, 42, 45 |url=https://archive.org/details/80-microcomputing-magazine-1983-04 |access-date=2020-02-06}} [https://archive.org/stream/80-microcomputing-magazine-1983-04/80Microcomputing_0483_djvu.txt][https://archive.org/download/80-microcomputing-magazine-1983-04/80Microcomputing_0483_text.pdf]
* {{cite journal |title=Relocatable Programs: Microcomputing's Hoboes |series=The Next Step |author-first=Hardin |author-last=Brothers |journal=[[80 Micro]] |publisher=[[CW Communications/Peterborough, Inc.]] |issn=0744-7868 |date=April 1985 |issue=63 <!-- |contribution=illustration |contributor-first=Peter |contributor-last=Bono --> |pages=[https://archive.org/details/80-microcomputing-magazine-1985-04/page/n99 98], 100, 102–103 |url=https://archive.org/details/80-microcomputing-magazine-1985-04 |access-date=2020-02-06 }} [https://archive.org/stream/80-microcomputing-magazine-1985-04/80Microcomputing_0485_djvu.txt][https://archive.org/download/80-microcomputing-magazine-1985-04/80Microcomputing_0485_text.pdf]
<!-- * Jesse Bob Overholt column: The Alternate Source Journal #16 James Farvour Microsoft BASIC Decoded And Other Mysteries POP HL, JP (HL) E1h E9h at offset 000Bh (+11) -->
* {{cite journal |title=ZCPR 3.4 - Type-4 Programs |series=ZCPR3 Corner |author-first=Jay |author-last=Sage |journal=[[The Computer Journal (US journal)<!-- to be distinguished from the identically named UK journal -->|The Computer Journal]] (TCJ) - Programming, User Support, Applications |issn=0748-9331 |editor-first=Art |editor-last=Carlson |date=May–June 1988 |___location=Columbia Falls, Montana, USA |issue=32 |pages=[https://archive.org/details/the-computer-journal-32/page/n10/mode/1up 10]–17 [<nowiki/>[https://archive.org/details/the-computer-journal-32/page/n15/mode/1up 15]–16] |id=ark:/13960/t1wd4v943 |url=https://archive.org/details/the-computer-journal-32 |access-date=2021-11-29}} [https://archive.org/stream/the-computer-journal-32/tcj_32_May-June_1988_djvu.txt][https://archive.org/download/the-computer-journal-32/tcj_32_May-June_1988_text.pdf]