Mail Archives: djgpp/1999/11/11/17:31:54
From: | Nate Eldredge <neldredge AT hmc DOT edu>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: EXTREMENLY IMPORTANT (To me...)
|
Date: | 11 Nov 1999 13:34:54 -0800
|
Organization: | InterWorld Communications
|
Lines: | 51
|
Message-ID: | <83puxgiuf5.fsf@mercury.st.hmc.edu>
|
References: | <80f0bb$q68$1 AT tron DOT sci DOT fi>
|
NNTP-Posting-Host: | mercury.st.hmc.edu
|
X-Trace: | nntp1.interworld.net 942356155 5773 134.173.45.219 (11 Nov 1999 21:35:55 GMT)
|
X-Complaints-To: | usenet AT nntp1 DOT interworld DOT net
|
NNTP-Posting-Date: | 11 Nov 1999 21:35:55 GMT
|
X-Newsreader: | Gnus v5.7/Emacs 20.4
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
"stefan fröberg" <traveler AT netti DOT fi> writes:
> Greetings to everyone !
>
> The following questions are maybe too trivial to some of you but for me they
> are unclear:
>
> - Is there no other way to call DOS/BIOS interrupt that requires a
> pointer to buffer,
> than using the "__tb" macro or allocating dos memory as explained by the
> FAQ 18.2 ?
No.
> - I know that the GCC uses the "Flat" memory mode but it's unclear to me
> which segments/selectors it uses by default. I presume that the GCC uses
> "CS" segment/selector for the code and "DS" segment/selector for the
> data but
> what about the "ES","FS" and "GS" segment/selectors ? Are they undefined
> ?
> Can I use them freely in my assembly subroutines and if so, do I have to
> save
> them at the start and restore them at the end of the routine ?
GCC uses CS, DS, ES, and SS, and expects them not to change behind its
back. If you use these, you must preserve them.
Various library functions modify GS, but you can use it in your own
code.
FS is available for your use. The _far* functions exist to make it
easier.
You can, however, use any of these in assembler if you save and
restore them.
> - Are there any important rules and guidelines for using
> segments/selectors in protected mode programming to prevent exceptions
> as "General Protection Fault" and other such things to happend ?
Ideally: Don't use them. If you're writing a sufficiently generic
program, they shouldn't be needed. But that's not always possible.
Otherwise: Think about what you load them with. In almost all cases
it must be either a selector you already had, or one returned by a
__dpmi function.
--
Nate Eldredge
neldredge AT hmc DOT edu
- Raw text -