POV-Ray : Newsgroups : povray.off-topic : Dynamic loading : Re: Dynamic loading Server Time
29 Jul 2024 20:13:28 EDT (-0400)
  Re: Dynamic loading  
From: clipka
Date: 19 May 2011 12:49:43
Message: <4dd54a27$1@news.povray.org>
Am 19.05.2011 17:55, schrieb Invisible:

> One thing about loading data from file is that you usually don't get to
> decide where it gets loaded. Is that a problem for x86? Is it hard to
> write relocatable machine code or something?

Not really. For jumping around or calling subroutines in your own code 
there are CALL and JMP instructions available that take a relative 
address as operand; and with rather simple code you can auto-detect the 
load address from within your code, so you can also compute absolute 
addresses e.g. to access constants, pass callback function pointers to 
some API, or use some portion of the code as a global variables space.

For the sake of run-time performance it is faster though to hard-code 
such absolute addresses, and have the respective code locations adjusted 
accordingly upon loading of the code. AFAIK that's the basic principle 
most executable file formats work.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.