Some questions about PM

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
AR

Re:Some questions about PM

Post by AR »

Okay, what's your concept for that mechanism then? Since you generate the segments, how does the code know which segment to far call?
DruG5t0r3

Re:Some questions about PM

Post by DruG5t0r3 »

AR :

In any case, for code execution, it always uses the cs segment register to far call.
AR

Re:Some questions about PM

Post by AR »

DruG5t0r3 wrote: AR :

In any case, for code execution, it always uses the cs segment register to far call.
And that is a revelation of what exactly? Of course the code segment register can only contain code segments, I was wondering about a mechanism for determining which code segment to use.

EDIT: After some thought and a random realisation, thunks seem to be the easiest way to implement this, the thunks form nice linkage targets so fullfills that compatiblity requirement but it isn't exactly the most efficient in terms of memory (a thunk "table" is needed as part of every process which would include sets of movs for loading DS/ES/FS/GS before far jumping, however you also benefit in that there will never be a case where you need 2 copies of the same library in memory at once merely because the second copy needed to relocated at a different base address but I doubt this would outweight the overall memory cost...), it is also prohibitive of lazy linking since the code section won't be writable after initalization.
Post Reply