3 ms·
Please elaborate?
by sova 8y ago
Please elaborate?
- ajross 8y agoIt's in the article. Windows could unload code segments that weren't running to free space for other purposes. But those functions might be on a process call stack. So it used the otherwise irrelevant low bit of the BP register to store whether a frame was a near or far call, thus allowing the unload code to fix up the return address to allow for reloading on demand.
- sova 8y agoSo if I get this right: the stack is limited in size, and certain "frequent use" routines were labeled as "near" while others with less frequent use were labeled as "far" and there was a dynamic way to keep frequent ones in memory?
- ajross 8y agoIt's a 16 bit architecture. Any code that doesn't fit in 64k needs to be in a separate segment. In practice, the way typical C compilers managed this (there were a bunch of code generation options) was to put all the code in a single C/obj file into a separate segment. Calls within the segment were "near" and used the simple CALL/RET variants which took and pushed a 16 bit address. Others were "far" and called/returned to a tuple of an address and a segment descriptor.
- deleted 8y ago[deleted]