Mail Archives: djgpp/1998/11/22/09:27:22
On Sat, 21 Nov 1998, KECSKEMÉTI BALÁZS wrote:
> - what kind of selectors do segment registers contain under
> DJGPP?
DS, SS, and ES are set to the data segment;
CS is set to the code segment;
GS is used by library functions to access conventional memory;
FS is unused and is free to be used by you.
> eg. ES contained a selector with base 0 and 4GB limit, FS pointed
> to the video memory (A000h) with 64K limit etc. Does DJGPP offer
> such things?
It does, but you have to set the selectors yourself. See section
18.4 of the DJGPP FAQ list (v2/faq211b.zip from the same place you get
DJGPP).
> - Let's say that i set up a selector in FS (in an external assembly
> function), which points to A0000h, and has 64K limit. Then, can i
> use FS in other assemby functions? Later, will it contain what i
> have put in it, or some other functions ( like printf ) may change
> FS (or ES/GS)?
FS is not used by any library functions except _farpeekX, _farsetsel
and _farpokeX. But if you use third-party packages, they could change
FS.
> And if i change FS in my function, will other functions crash?
FS is free to change, but please note that code emitted by GCC assumes
DS=SS=ES, and will crash otherwise. So if you change one of these
three, be sure to save and restore them before you return. See also
section 17.4 of the FAQ.
- Raw text -