som v 2.3  reloc

object file from som v 2.3 has the address of DS shifted from 1000 to userDS and the globals shifted from 65 to GV.  The compiler som.obj consumes part of DS for compiling included: CS' CELL' etc. Because som.obj itself is executed in the same interp.c  "eval" that also executed the immediate lines of the file being compiled, som.obj uses a number of globals.  

When the compilation is finished and the object file is intended to be executed independently from the compiler, part of DS and globals that are used by the compiler are not necessary.  The object file should be relocated.  userDS should started at 1000 and globals started at 65.  In order to do this, the registers in the code must be renamed, the pointers must be relocated.

finding where userGV starts is easy.  It can be found in the object file in the global section.  To relocated the pointers, in the code section, the code "Ads" must be renamed, in the data, with the use of symbol table, all globals can be founded and their references relocated.  As CS' is relative, it is not necessary to relocate the static array of function pointer.

12 June 2006
 