delorie.com/archives/browse.cgi | search |
> One (non-GNU) third-party app in particular won't port to DJGPP > because it needs mmap(), which I think I was told is default in a > newer POSIX version. Checking the newsgroup archives here shows that > DPMI 1.0 could maybe support such emulation, but nobody has bothered > (for the big obvious reason, it's not common) When I ported nVClock to DOS I made this function to replace mmap stuff (it's needed to access MMIO registers of GPU placed in address space beyond 1st meg) //***************** call DPMI physical memory mapping and allocate LDT descriptor for the memory block void *map_physical_memory(uint32_t phys_base, uint32_t size) // phys_base must be page aligned { // size will be aligned automatically void *p; if (size == 0) // if zero block size, do nothing return(NULL); if ((size & 0x0FFF) != 0) // if size is not page-aligned size = (size + 4096) & (~0x0FFF); // make it page-aligned if ((p = valloc(size)) == NULL) // allocate page-aligned memory (__djgpp_map_physical_memory required this) { // allocation failed printf("ERROR: cannot allocate %lu bytes for memory mapped device \n",size); exit(-1); // exit program } if (__djgpp_map_physical_memory(p,size,phys_base)) { // failed to map physmem printf("ERROR: failed to map physical memory range: 0x%08lX - 0x %08lX\nDPMI 1.0 server or support of DPMI function 0508h is needed. \nIt doesn't work under Windows, use win32 version instead. \n",phys_base,phys_base+size-1); exit(-1); // exit program } return(p); // return pointer to memory block aliasing physical memory area }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |