DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? (Developers)
I tried to midify code for single mapping and then varied size of constant
BIOS_IMAGE_SIZE2 0x10000000
If it was less or equal 0x10000000 it works if greater then it crashed. I have installed 2GB RAM. I don't know how it will behave on 4GB sysatem wher ACPI SDT base will be higher close to 0xFFFFFFFF, probably it will crash with much smaller size when roll over...
//***************** copy SDT table from physical address to local buffer, parse header and calc checksum
long copy_sdt(Byte *p_buffer, DWord phys_ptr) // returns SDT length, 0 if bad checksum, negative if read error
{
ACPI_SDT_HEADER sdt_header; // temporarly stored SDT header to obtain full SDT size
__dpmi_meminfo meminfo; // DPMI meminfo structure for physical memory mapping
int sdt_selector; // selector of segment descriptor of mapped SDT
#define BIOS_IMAGE_SIZE2 0x10000000
meminfo.address=phys_ptr; // mapped physical address
meminfo.size=BIOS_IMAGE_SIZE2; // mapped physical area size (128kB) large enough for SDT (possibly may roll-over 32bit range but will not be accessed)
if (__dpmi_physical_address_mapping(&meminfo)!=0) // map physical memory area to linear
return(-2); // if failed return -2
if ((sdt_selector=__dpmi_allocate_ldt_descriptors(1))<0) // allocate 1 descriptor (desribing our new segment) in LDT and return it's selector
return(-1); // if failed return -1
__dpmi_set_segment_base_address(sdt_selector, meminfo.address); // set segment base to linear ptr
__dpmi_set_segment_limit(sdt_selector, BIOS_IMAGE_SIZE2-1); // set segment limit to 128kB-1
movedata(sdt_selector, 0, _my_ds(), (unsigned)&sdt_header, sizeof(ACPI_SDT_HEADER)); // copy SDT header from physical memory to temp buffer
if (sdt_header.length<sizeof(ACPI_SDT_HEADER)) // check SDT lenght
{ // if less than header size=invalid
__dpmi_free_ldt_descriptor(sdt_selector); // free temporary allocated LDT descriptor
return(0); // return 0
}
movedata(sdt_selector, 0, _my_ds(), (unsigned)p_buffer, sdt_header.length); // copy full SDT from physical memory to target buffer
__dpmi_free_ldt_descriptor(sdt_selector); // free temporary allocated LDT descriptor
if (calc_checksum(p_buffer, sdt_header.length)==0) // calculate checksum
return(sdt_header.length); // if match return full SDT lenght
else // data_length=full_length-header_length
return(0); // else return 0
}
---
DOS gives me freedom to unlimited HW access.
Complete thread:
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 13.07.2011, 14:58 (Developers)
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Japheth, 14.07.2011, 09:15
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 14.07.2011, 15:09
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Laaca, 15.07.2011, 12:47
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 17.07.2011, 02:06
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 17.07.2011, 14:47
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 02.08.2011, 13:08
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Rugxulo, 05.08.2011, 22:25
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 06.08.2011, 11:56
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Rugxulo, 05.08.2011, 22:25
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 02.08.2011, 13:08
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 17.07.2011, 14:47
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 17.07.2011, 02:06
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Laaca, 15.07.2011, 12:47
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - RayeR, 14.07.2011, 15:09
- DJGPP - Mapping small blocks of physmem beyond 1MB - __dpmi? - Japheth, 14.07.2011, 09:15