delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/07/29/19:53:42

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:received:received:message-id:date:from:to
:subject:mime-version:content-type;
bh=JcMQU9Ay9Zdg7bbfCWYTaW/FTekEFY4ZDNH4XXz0iP4=;
b=fZuPFUQd7InExy5bbkDJx5G5cFOyCPSdvWyfviDPMugvi3IO/fqBveYxFHd8Sf7x1D
nJPEs1GWUAW8iIz4pSIcgHE7w29HywzqWj5JvZUu7ta1lHM+6u/CUJUxrjQzZphwHIpo
lc3JpR62zF2Q9BbqkmuCSssMiN3s3NweE8DOI=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=message-id:date:from:to:subject:mime-version:content-type;
b=I+oPSdTJYlvLvJFyDhW3RenOoKk7u9Y6r9WJyeKusj7w9rLri/N5Tmtb0OvGh8ImbU
BkHMlARCmK8NsZTSWHcOKSBXlUeWuxVRxwgZRwJGuzqz8jkTS2SitYYe7hxkfuxnZKUT
f7c7V1Ovdu7GbbaFxRsBCjQgDaXY/mPxyLJbc=
Message-ID: <89da6560807291624he0cb2d1u696542e552887e8d@mail.gmail.com>
Date: Tue, 29 Jul 2008 16:24:36 -0700
From: "Lael Jones" <lael DOT jones AT gmail DOT com>
To: djgpp AT delorie DOT com
Subject: djgpp v2 : Control register access segfaults
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

------=_Part_50578_25458136.1217373876965
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello,

I'm upgrading my application from djgpp v1 to djgpp v2 and am seeing a seg
fault in the debug build when the application tries to access (read or
write) control registers (specifically CR4).  The inline assembly I am using
is:

   // Enable SSE instructions via OSFXSR (bit 9 of CR4).
   __asm__ __volatile__
   (
      "
         movl %%cr4, %%eax
         orl  $0x00000200, %%eax
         movl %%eax, %%cr4
      "
      :  /* output */
      :  /* input */
      :  /* modified */
      "%eax"
   );

The seg fault always occurs on "movl %%cr4, %%eax".  The exact same code
executes without the seg fault in a release build ("-O2").  The relevant
source file is compiled with "-ggdb -O0", however due to the size of the
executable I have stripped the debug symbols using "strip -g".  All
libraries are statically linked.

Are there any known issues/changes to djgpp that would cause this?

I searched both google and mailing list archives and wasn't able to find any
reference to this issue.

Thanks

Lael

------=_Part_50578_25458136.1217373876965
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div dir="ltr"><div>Hello, </div>
<div>&nbsp;</div>
<div>I&#39;m upgrading my application from djgpp v1 to djgpp v2 and am seeing a seg fault in the debug build when the application tries to access (read or write) control registers (specifically CR4).&nbsp; The inline assembly I am using is:</div>

<div>&nbsp;</div>
<div>&nbsp;&nbsp; // Enable SSE instructions via OSFXSR (bit 9 of CR4).<br>&nbsp;&nbsp; __asm__ __volatile__<br>&nbsp;&nbsp; (<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; movl %%cr4, %%eax<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orl&nbsp; $0x00000200, %%eax<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; movl %%eax, %%cr4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp; /* output */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp; /* input */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp; /* modified */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;%eax&quot;<br>&nbsp;&nbsp; );</div>
<div>&nbsp;</div>
<div>The seg fault always occurs on &quot;movl %%cr4, %%eax&quot;.&nbsp; The exact same code executes without the seg fault in a release build (&quot;-O2&quot;).&nbsp; The relevant source file is compiled with &quot;-ggdb -O0&quot;, however due to the size of the executable I have stripped the debug symbols using &quot;strip -g&quot;.&nbsp; All libraries are statically linked.</div>

<div>&nbsp;</div>
<div>Are there any known issues/changes to djgpp that would cause this?&nbsp;</div>
<div>&nbsp;</div>
<div>I searched both google and mailing list archives and wasn&#39;t able to find any reference to this issue.</div>
<p>Thanks</p>
<div>&nbsp;</div>
<div>Lael</div>
<div><br></div></div>

------=_Part_50578_25458136.1217373876965--

- Raw text -


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