Mail Archives: djgpp/2008/07/30/11:47:16
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | Rugxulo <rugxulo AT gmail DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: djgpp v2 : Control register access segfaults
|
Date: | Wed, 30 Jul 2008 08:43:27 -0700 (PDT)
|
Organization: | http://groups.google.com
|
Lines: | 62
|
Message-ID: | <2871684c-e3f9-4336-b2d7-e1bb294e93ae@26g2000hsk.googlegroups.com>
|
References: | <89da6560807291624he0cb2d1u696542e552887e8d AT mail DOT gmail DOT com>
|
NNTP-Posting-Host: | 65.13.115.246
|
Mime-Version: | 1.0
|
X-Trace: | posting.google.com 1217432608 21767 127.0.0.1 (30 Jul 2008 15:43:28 GMT)
|
X-Complaints-To: | groups-abuse AT google DOT com
|
NNTP-Posting-Date: | Wed, 30 Jul 2008 15:43:28 +0000 (UTC)
|
Complaints-To: | groups-abuse AT google DOT com
|
Injection-Info: | 26g2000hsk.googlegroups.com; posting-host=65.13.115.246;
|
| posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
|
User-Agent: | G2/1.0
|
X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1)
|
| Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id m6UFj6RW009942
|
Reply-To: | djgpp AT delorie DOT com
|
On Jul 29, 6:24 pm, "Lael Jones" <lael DOT jo DOT DOT DOT AT gmail DOT com> wrote:
>
> I'm upgrading my application from djgpp v1 to djgpp v2
Whew, took you long enough! ;-) j/k
> and am seeing a seg fault in the debug build when the application tries to access (read or
> write) control registers (specifically CR4).
What OS? For instance, in my (limited) testing, WinXP etc. don't allow
you to read or write to CR4 (although WinME and older do, IIRC). And
your DOS DPMI host and/or EMM386 may have to have special handling of
such things. Usually I think you have to be in ring 0 (e.g. use
CWSDPR0). You can also use the HDPMI32.EXE TSR instead (which turns it
on for you), but both of those situations lack virtual memory support.
http://www.japheth.de/HX.html
> The inline assembly I am using is:
>
> // Enable SSE instructions via OSFXSR (bit 9 of CR4).
> __asm__ __volatile__
>
> 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"
I don't know exactly what the issue is, but I have gotten SSE2 to work
in DOS. But you have to check for CPUID availability (bit 21 of
EFLAGS), run CPUID, see if it supports SSE (EDX=bit 25) or SSE2
(EDX=bit 26) or SSE3 (ECX=bit 0) or ... I dunno about detecting others
(SSE4.1, SSE4a), my cpu doesn't support 'em. ;-) Oh, and BTW,
the CR4 register is a Pentium thing, so don't try that on older
hardware. (OSFXSR, aka bit 9 of CR4, must then be turned on, if not
already, before using SSE else you get a segfault. And this is even if
you don't need FXSAVE/FXRSTOR.)
Here's my (very wimpy) hack/port/patch to PAQ8o8 (which I call
paq8o8z) that runs in pure DOS (w/ full srcs, GPL) using SSE2 if
available:
http://rugxulo.googlepages.com/paq8o8z-jul17.zip (URL may
change when I update it, see base site)
I ended up (for now) dual compiling via DJGPP (fastest, D3X ring 0
DPMI host bound to .EXE) and OpenWatcom (Causeway, not as fast, no
LFNs but supports swapping).
Note that most OSes turn on SSE for you (e.g. WinNT 4.0? w/ patches,
Win98SE, Linux 2.2). A few other DOS extenders do too (Causeway, DOS/
32A), but those are Watcom/LE only (so not applicable here).
> I searched both google and mailing list archives and wasn't able to find any
> reference to this issue.
Yeah, not a lot of SSE support in DOS (so far). *However*, CWSDPMI r6
*may* have an update pretty soon to auto-turn it on for
us! :-)) Keep your fingers crossed.
- Raw text -