delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/16/17:55:27

From: wanis AT my-deja DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: GPF due to _farpokel
Date: Fri, 16 Jul 1999 21:08:15 GMT
Organization: Deja.com - Share what you know. Learn what you don't.
Lines: 68
Message-ID: <7mo6vl$r5e$1@nnrp1.deja.com>
NNTP-Posting-Host: 206.19.99.105
X-Article-Creation-Date: Fri Jul 16 20:45:25 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
X-Http-Proxy: 1.1 x42.deja.com:80 (Squid/1.1.22) for client 206.19.99.105
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to POKE some memory on a PCI card, and
the program keeps crashing with SIGSEGV
indicating a general protection fault.  Here's
what I do (in a sort of pseudocode)...

cardbasemem = PCIbios_getbasemem();
void writetocardmem ( unsigned long address,
unsigned long data )
{
   _farpokel ( _dos_ds, cardbasemem + address,
data );
}
/* 'address' is usually 0x00400004 */

This crashed inside the _farpokel().  The card's
base memory address turned out to be 0xFF000000,
which is an awfully large offset.  Because of the
large offset, I next tried to create a descriptor
for this memory address (that's right, I actually
read the FAQ!).  So, now I had the following
code...

cardbasemem = PCIbios_getbasemem();
...Get create LDT for cardbasemem,
   Memory size is 0x00800000
   get selector for LDT
   This code comes straight from the FAQ...
cardbasemem = mi.baseaddress;
/* cardbasemem still turns out to be 0xFF000000 */

void writetocardmem ( unsigned long address,
unsigned long data )
{
   _farpokel ( selector, cardbasemem + address,
data );
}

Same problem.  The really strange part is that
this same piece of code works fine on another
computer with a different type of PCI card.
However, that other computer and card return a
memory base address of 0x00A00000, so I'm
suspecting a problem with the memory addr.

The results of SYMIFY tell me...
1)  The GPF is occurring inside _farpokel()
(besides which, when I run the code with
everything but that _farpokel() in there, it
works just fine...)
2)  The stack values seem to be sane (although
ESP and EBP always have the precise same value)...
3)  The callback buffer is only about 5 deep
(i.e. it doesn't look like I've blown the stack)
4)  My descriptor was created properly and in the
FS register at the time of the GPF
I also know that...
5)  The base address I'm reading is correct
(other PCI config programs are returning the same
result)

Can anybody tell me what's going wrong???

-- Paul



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

- Raw text -


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