delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2014/04/10/21:15:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <dont_use_email AT xnothavet DOT cqm>
Newsgroups: comp.os.msdos.djgpp
Subject: Is this a bug in crt1.c?
Date: Thu, 10 Apr 2014 21:01:57 -0400
Organization: Aioe.org NNTP Server
Lines: 21
Message-ID: <op.xd4ntjft6zenlw@localhost>
NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
Mime-Version: 1.0
X-Complaints-To: abuse AT aioe DOT org
User-Agent: Opera Mail/12.16 (Linux)
X-Notice: Filtered by postfilter v. 0.8.2
Bytes: 1677
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

The following two lines are in crt1.c (in libc and pmode directories).

   movedata(_stubinfo->psp_selector, 0x2c, ds, (int)&env_selector, 2);
   movedata(env_selector, 0, ds, (int)dos_environ, _stubinfo->env_size);

To me, this appears to be an error.  But, I'm assuming that I'm missing
something since DJGPP works.  But, I haven't determined why this works.

In the first line, env_selector appears to be copied from the DOS PSP
where it's supposedly a real-mode segment.  Then, env_selector is used
immediately in the second line where it's used as a protected-mode  
selector.

Is there a hidden conversion from RM segment to PM selector somewhere?
Is there code somewhere else which convert the value within the PSP to
a selector?  Or, does movedata() convert segments to selectors?  AIUI,
movedata() only works with selectors.  What have I missed here?


Rod Pemberton

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019