Message-ID: <001a01c0e530$e72a3db0$1400a8c0@alex2000> From: "Alex Oleynikov" To: Subject: SRAM chip access problem Date: Fri, 25 May 2001 11:39:36 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0017_01C0E50F.600AE210" 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
Hi everybody!
 
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)?
Here's portion of the code trying = to peek at=20 the data:
 
...
 mapping.size=3D0x80000;
 mapping.address=3D0xfff80= 000;
 
 if(__dpmi_physical_address_mapping(&mapping))
 = ;{
  printf("Error=20 mapping memory\n\r");
  return;
 }
 
 selector =3D=20 __dpmi_allocate_ldt_descriptors(1);
 __dpmi_set_segment_base_addr= ess(selector,=20 mapping.address);
 __dpmi_set_segment_limit(selector,=20 mapping.size-1);
 byte =3D _farpeekb(selector, 0);
...
 
Here's the result:
 
Exiting due to signal SIGSEGV
Page = fault at=20 eip=3D0000354a, error=3D0004
eax=3D000000c7 ebx=3D00001000 = ecx=3D00000007 edx=3D00000000=20 esi=3D00000054 edi=3D000923c9
ebp=3D00092270 esp=3D00092270=20 program=3DC:\CD4000\PROBE.TC\SRAM.EXE
cs: sel=3D00a7  = base=3D10000000 =20 limit=3D0009ffff
ds: sel=3D00af  base=3D10000000  = limit=3D0009ffff
es:=20 sel=3D00af  base=3D10000000  limit=3D0009ffff
fs: = sel=3D00c7 =20 base=3Dfff80000  limit=3D0007ffff
gs: sel=3D00bf  = base=3D00000000 =20 limit=3D0010ffff
ss: sel=3D00af  base=3D10000000  = limit=3D0009ffff
App=20 stack: [000923f0..000123f0]  Exceptn stack:=20 [00012350..00010410]
 
Call frame traceback EIPs:
  = 0x0000354a=20 __farpeekb+10
  0x000017a2 _main+478, line 93 of = dj_sram.c
 =20 0x00002f02 ___crt1_startup+178
C:\CD4000\PROBE.TC>symify -o = nvram.dmp=20 sram.exe
 
Similar program written under = Win2k/WinNT in=20 Borland's compiler does the job fine.
 
Thank you.
 
Alex
------=_NextPart_000_0017_01C0E50F.600AE210--