delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/11/01:32:10

From: Frederico Jeronimo <fjds AT rnl DOT ist DOT utl DOT pt>
Newsgroups: comp.os.msdos.djgpp
Subject: Map physical memory.
Date: Fri, 10 Dec 1999 16:06:56 +0000
Organization: Universidade Tecnica de Lisboa
Lines: 68
Message-ID: <Pine.GSO.4.10.9912101602570.5274-100000@camoes>
NNTP-Posting-Host: camoes.rnl.ist.utl.pt
Mime-Version: 1.0
X-Trace: utl2.reitoria.utl.pt 944842288 32510 193.136.164.11 (10 Dec 1999 16:11:28 GMT)
X-Complaints-To: usenet AT utl2 DOT reitoria DOT utl DOT pt
NNTP-Posting-Date: 10 Dec 1999 16:11:28 GMT
X-Sender: fjds AT camoes
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all,

	I'm having a little problem and I was wondering if you could help
me  out. I'm
trying to map a range of physical memory over a set of addresses using 
'__djgpp_map_physical_memory()'. For this I need a page-aligned linear
buffer,  I think.  However, when I call '__dpmi_allocate_linear_memory()'
the function returns -1. I tried  other DPMI functions present in Djgpp
and found  out that all DPMI 0.9 functions work  whereas most DPMI 1.0
functions don't and I really can't figure out why... I'm running  Djggp
v.201 in a windows DOS prompt and I have CWSDPMI.exe in the 'djgpp/bin' dir 
(although the result is the same if I run the program in "pure" dos). I  
searched the info docs, the net, the faq and nothing seemed to help.

	Here's a testing code fragment. Perhaps I'm doing something wrong...

#include <stdio.h>
#include <dos.h>
#include <go32.h>
#include <dpmi.h>
#include <sys/farptr.h>
#include <sys/movedata.h>
#include <sys/nearptr.h>
#include <crt0.h>

int main()
{
    __dpmi_meminfo r;
    __dpmi_memory_info p;
    short my_sel = 0;
    unsigned long addr = 0;
    extern unsigned short __dpmi_error;

    [...]

    /* test values */
    r.address=0x00;
    r.size=16;  
    
    /* If I use uncommited pages, the result is the same.
         Error code in my system is 1291(0x50b) (what does it 
         mean?) */
    if(__dpmi_allocate_linear_memory(&r,1) == -1)
    {
         printf("\nError code is %ld",__dpmi_error);	
         abort();
    }
    
    /* If I replace the previous function with this one the result is 
        the same. Error code changes to 1284 (0x504). Again,
        no clue to its meaning...*/
    //__dpmi_get_memory_information(&p);
    
    /* The next two functions work just fine, after I create a selector
         of course... */
   // __dpmi_get_coprocessor_status();
   //__dpmi_get_segment_base_address(my_sel,&addr);
    
   [...]
} 
    
	Please go easy on me. I'm new to DPMI programming. Thanks 
in advance for all the help,

						Frederico Jeronimo

	Ps: How can I check what DPMI host I'm using?

- Raw text -


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