Mail Archives: djgpp/2003/02/18/08:15:18
From: | "Ben Peddell" <lightspeed85 AT hotmail DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <3E51709E DOT DE111E40 AT worldnet DOT att DOT net>
|
Subject: | Re: Passing pointers to dpmi_int
|
Lines: | 44
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2615.200
|
X-MIMEOLE: | Produced By Microsoft MimeOLE V5.00.2615.200
|
Message-ID: | <Prp4a.50430$jM5.125811@newsfeeds.bigpond.com>
|
Date: | Tue, 18 Feb 2003 22:25:36 +1000
|
NNTP-Posting-Host: | 144.134.89.150
|
X-Trace: | newsfeeds.bigpond.com 1045570415 144.134.89.150 (Tue, 18 Feb 2003 23:13:35 EST)
|
NNTP-Posting-Date: | Tue, 18 Feb 2003 23:13:35 EST
|
Organization: | Telstra BigPond Internet Services (http://www.bigpond.com)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
The dds_local structure must be copied to conventional memory, as the ES:DI
is a real-mode pointer.
Try:
if ((retseg = __dpmi_allocate_dos_memory ((sizeof(dds_local) >>
4)+1,&retsel)) < 0){
printf ("Error allocating DOS memory\n");
/*
* No use trying to continue, as we don't have any DOS memory to use
*/
return -1;
}
movedata (_my_ds(), &dds_local, retsel, 0, sizeof(dds_local));
dr.w.dx = 0;
dr.w.ax = 0x8103;
dr.w.es = retseg;
dr.w.di = 0;
if (__dpmi_int (0x4B,&dr)) printf ("Error locking DMA Region\n");
movedata (retsel, 0, _my_ds(), &dds_local, sizeof(dds_local));
if (__dpmi_free_dos_memory (retsel)) printf ("Error freeing DOS
memory\n");
Paul Cousoulis <paulcsouls AT worldnet DOT att DOT net> wrote in message
news:3E51709E DOT DE111E40 AT worldnet DOT att DOT net...
>
> I'm trying to implement the Virtual DMA Service. In order to lock DMA
> memory I need to pass the address of a structure to int 4b in es:di. The
> physical address should be returned in dds_local, but I keep getting
> zero even though the function seems to otherwise return successfully.
> The code I'm using is:
> >
> > dr.x.dx = 0;
> > dr.x.ax = 0x8103;
> > temp = (int)(&dds_local);
> > dr.x.es = (unsigned short)(temp>>16);
> > dr.x.di = (unsigned short)(temp & 0xffff);
> > if(__dpmi_int(0x4b,&dr)) printf("error\n");
> >
> Thanks
> Paul
- Raw text -