delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/04/20:33:56

From: Piotr Wawrzyniec Kwapien <pkwapien AT elektron DOT elka DOT pw DOT edu DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem: access to mem over 1MB
Date: 1 May 1997 19:48:16 GMT
Organization: ICM
Message-ID: <5kas20$lc2$1@sunsite.icm.edu.pl>
NNTP-Posting-Host: elektron.elka.pw.edu.pl
Lines: 72
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

	I have the following problem with accessing an AVER2000
	frame grabber's memory which maps at location 0xe00000
	(the 16-th megabyte) under DJGPP (see attached code below).
	(I'm using DJGPP v2.0 , an 8MB internal RAM computer (so it doesn't
	conflict with the frame grabber's memory and CWSDPMI.
	Under a BORLAND C compiler, in real mode, I access
	the card's memory by using BIOS's INT 0x15 (function 0x87),
	and it works)
	After the initialization of the card, which is successful,
	I followed the steps listed in the FAQ (p. 18.7)
	(for accessing memory over the 1MB border), but:
		- function __dpmi_lock_linear_region() always returns an 
		  error.
		- when I comment it out, the program breaks on the farpoke
			(Page Fault, error 0006)
		- I've also experimented with DJGPP v2.1 on a 20MB machine and 
		  tried accessing different locations above the 1MB RAM border, 
		  always with the same error result. 
		  Under DJGPPv.2.1 the selector registers
		  are shown, and the %fs register (which holds the farpoke
		  selector) shows the correct base and limit.
	The selector is allocated, (specifically its value is 0xc7).
	After __dpmi_physical_mapping the linear address returned in
	info.address is the same as the physical address passed to the function.
	I'd be greatful if anyone could explain
	why __dpmi_lock_linear_region returns an error, and why
	the program breaks on the farpoke (and farpeek as well)!?

	(PS. I've tried byte and word access (farpoke/peekb and w)
		 with same result).

	Here's the code:

	int             descr_nr;
	__dpmi_meminfo  info;

	if((descr_nr=__dpmi_allocate_ldt_descriptors((int)1))<0) {
		printf("Error allocating ldt descriptor\n");
		return(0);
	}

	info.address=(unsigned long)0xe00000L;
	info.size=0xfffffL;

	if(__dpmi_physical_address_mapping(&info)<0) {
		printf("physical address mapping error\n");
		return(0);
	}

	if(__dpmi_lock_linear_region(&info)<0) {
		printf("lock linear error\n");
		return(0);
	}

	if(__dpmi_set_segment_base_address(descr_nr,info.address)<0) {
		printf("error with base\n");
		return(0);
	}
	if(__dpmi_set_segment_limit(descr_nr,info.size)<0) {
		printf("error with limit\n");
		return(0);
	}
	_farpokew(descr_nr,0x100,0x0041);
	printf("Peekvalue: %x\n",_farpeekw(descr_nr,0x100));

	Thanks for any feedback.
	
	Piotr Kwapien
	-----------------------
	pkwapien AT neutron DOT elka DOT pw DOT edu DOT pl
	_______________________

- Raw text -


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