Question

While studying for my Operating System Concepts final, I stumbled across

Compile time: If memory location knows, **absolute code** can be generated;
must recompile code if starting location changes

And the example gives for absolute code is the interrupt vector table. I was wondering what exactly that statement means and why is the interrupt vector table known at compile time?

Était-ce utile?

La solution

It means code that loads at a known, fixed memory address. Since that address is fixed, jumps can be compiled to point directly to their target memory addresses, with no need to use relative jump instructions or fixup anything at load time.

Autres conseils

The answer given is correct, but there is another case. In embedded systems, and when compiling for a ROM, it is usual that the final address for the code is a decision taken relatively early. For a small chip the designer decides where many parts of the code will be placed within the memory space of the chip, and there are often memory-mapped I/O locations as well. For a ROM the target address of the ROM will be known.

In this case there are still two possibilities. One is that the compiler can generate code that directly addresses these locations (and features like placement new in C++ help). The other is that the compiler generates a mix of absolute addressing and relocatable code. In each case a special linker with a 'locater' capability outputs the final code with absolute addressing. In each case the final addresses are absolute and need no runtime fixups.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top