Mail Archives: djgpp/2001/05/25/11:43:09
Message-ID: | <001a01c0e530$e72a3db0$1400a8c0@alex2000>
|
From: | "Alex Oleynikov" <alex AT compuweigh DOT com>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | SRAM chip access problem
|
Date: | Fri, 25 May 2001 11:39:36 -0400
|
MIME-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook Express 5.50.4133.2400
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400
|
Reply-To: | djgpp AT delorie DOT com
|
This is a multi-part message in MIME format.
------=_NextPart_000_0017_01C0E50F.600AE210
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi everybody!
Can anyone give me a hint why my simple attempt to access an NVRAM chip =
(128K Dallas Semiconductor plugged into DiskOnChip socket) from within a =
DJGPP program crashes instantly (DOS v.7 (taken from Windows 98) + =
CWSDPMI v.r4 + DJGPP v.2.03)?
Here's portion of the code trying to peek at the data:
...
mapping.size=3D0x80000;
mapping.address=3D0xfff80000;
if(__dpmi_physical_address_mapping(&mapping))
{
printf("Error mapping memory\n\r");
return;
}
selector =3D __dpmi_allocate_ldt_descriptors(1);
__dpmi_set_segment_base_address(selector, mapping.address);
__dpmi_set_segment_limit(selector, mapping.size-1);
byte =3D _farpeekb(selector, 0);
...
Here's the result:
Exiting due to signal SIGSEGV
Page fault at eip=3D0000354a, error=3D0004
eax=3D000000c7 ebx=3D00001000 ecx=3D00000007 edx=3D00000000 =
esi=3D00000054 edi=3D000923c9
ebp=3D00092270 esp=3D00092270 program=3DC:\CD4000\PROBE.TC\SRAM.EXE
cs: sel=3D00a7 base=3D10000000 limit=3D0009ffff
ds: sel=3D00af base=3D10000000 limit=3D0009ffff
es: sel=3D00af base=3D10000000 limit=3D0009ffff
fs: sel=3D00c7 base=3Dfff80000 limit=3D0007ffff
gs: sel=3D00bf base=3D00000000 limit=3D0010ffff
ss: sel=3D00af base=3D10000000 limit=3D0009ffff
App stack: [000923f0..000123f0] Exceptn stack: [00012350..00010410]
Call frame traceback EIPs:
0x0000354a __farpeekb+10
0x000017a2 _main+478, line 93 of dj_sram.c
0x00002f02 ___crt1_startup+178
C:\CD4000\PROBE.TC>symify -o nvram.dmp sram.exe
Similar program written under Win2k/WinNT in Borland's compiler does the =
job fine.
Thank you.
Alex
------=_NextPart_000_0017_01C0E50F.600AE210
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3103.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everybody!</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone give me a hint why my simple =
attempt to=20
access an NVRAM chip (128K Dallas Semiconductor plugged into DiskOnChip =
socket)=20
from within a DJGPP program crashes instantly (DOS v.7 (taken from =
Windows 98) +=20
CWSDPMI v.r4 + DJGPP v.2.03)?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Here's portion of the code trying =
to peek at=20
the data:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> mapping.size=3D0x80000;<BR> mapping.address=3D0xfff80=
000;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> if(__dpmi_physical_address_mapping(&mapping))<BR> =
;{<BR> printf("Error=20
mapping memory\n\r");<BR> return;<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> selector =3D=20
__dpmi_allocate_ldt_descriptors(1);<BR> __dpmi_set_segment_base_addr=
ess(selector,=20
mapping.address);<BR> __dpmi_set_segment_limit(selector,=20
mapping.size-1);<BR> byte =3D _farpeekb(selector, 0);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Here's the result:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Exiting due to signal SIGSEGV<BR>Page =
fault at=20
eip=3D0000354a, error=3D0004<BR>eax=3D000000c7 ebx=3D00001000 =
ecx=3D00000007 edx=3D00000000=20
esi=3D00000054 edi=3D000923c9<BR>ebp=3D00092270 esp=3D00092270=20
program=3DC:\CD4000\PROBE.TC\SRAM.EXE<BR>cs: sel=3D00a7 =
base=3D10000000 =20
limit=3D0009ffff<BR>ds: sel=3D00af base=3D10000000 =
limit=3D0009ffff<BR>es:=20
sel=3D00af base=3D10000000 limit=3D0009ffff<BR>fs: =
sel=3D00c7 =20
base=3Dfff80000 limit=3D0007ffff<BR>gs: sel=3D00bf =
base=3D00000000 =20
limit=3D0010ffff<BR>ss: sel=3D00af base=3D10000000 =
limit=3D0009ffff<BR>App=20
stack: [000923f0..000123f0] Exceptn stack:=20
[00012350..00010410]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Call frame traceback EIPs:<BR> =
0x0000354a=20
__farpeekb+10<BR> 0x000017a2 _main+478, line 93 of =
dj_sram.c<BR> =20
0x00002f02 ___crt1_startup+178<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>C:\CD4000\PROBE.TC>symify -o =
nvram.dmp=20
sram.exe</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Similar program written under =
Win2k/WinNT in=20
Borland's compiler does the job fine.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Alex</DIV></FONT></BODY></HTML>
------=_NextPart_000_0017_01C0E50F.600AE210--
- Raw text -