Mail Archives: djgpp/2000/05/14/20:42:59
From: | "Malcolm Herring" <malcolm DOT herring AT btinternet DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | DPMI GPF problem
|
Date: | Sun, 14 May 2000 14:37:47 -0700
|
Organization: | BT Internet
|
Lines: | 34
|
Message-ID: | <8fn6cd$p85$1@neptunium.btinternet.com>
|
NNTP-Posting-Host: | host5-99-55-145.btinternet.com
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I need to map to a physical address range to access a memory-mapped device.
The following code fragments is how I have tried to do it, but this results
in a GPF when 'movedatal' is called.
Help, anybody? - TIA
#include <dos.h>
#include <stdio.h>
#include <dpmi.h>
#include <sys/movedata.h>
...
__dpmi_meminfo mmem;
unsigned int sel;
unsigned long sram;
...
unsigned long prng, test;
...
mmem.size = 65536;
mmem.address = sram;
if (__dpmi_physical_address_mapping(&mmem) != 0) {
printf("Address mapping failed\n");
exit(-1);
}
sel = __dpmi_allocate_ldt_descriptors(1);
__dpmi_set_segment_base_address(sel, mmem.address);
__dpmi_set_segment_limit(sel, mmem.address + 65535);
__dpmi_set_descriptor_access_rights(sel,
__dpmi_get_descriptor_access_rights(_my_ds()));
...
_movedatal(_my_ds(), (int)&prng, sel, mmem.address, 1);
- Raw text -