The other day I set out to solve a seemingly simple problem: With a DOS extended application, lock down memory buffers using DPMI and use them for bus-mastering (BusLogic SCSI HBA, though the exact device model isn’t really relevant to the problem).
Now, DPMI does not allow querying the physical address of a memory region, although it does have provisions for mapping a given physical memory area. But that doesn’t help here–mapping physical memory is useful for framebuffers where a device memory needs to be mapped so that an application can access it. In my case, I needed the opposite, allowing a bus-mastering device to use already-allocated system memory.
I think I may have understood some of these words.
Imagine how much trouble we will all be in when people like this start to toddle off?
It reminds me of the NTP fiasco, I think at one stage that basically came down to one lonely protocol apparatchik sitting in a cupboard somewhere pressing a Return key! Well, even if it’s grossly exaggerated at least you get the spirit of the assertion!
The people doing this stuff are keeping obscure libraries, features, hardware or services running, many things that we may depend on in complete ignorance. You never know how it bites the modern world, usually until they retire and billion dollar systems built on the basics collapse in a puddle of disorganization.
We can joke about it but we shouldn’t, solve these sorts of problems Mr AI and you’ll become useful!
While there is lots of software that is maintained by 1-2 people and is critical to the world, DPMI is not one of them.
Basically, DMPI is the following:
– DOS runs in 16-bit mode and cannot access more than 1MB or main memory (640KB available for regular programs)
– But there are DOS extenders which set the processor in 32-bit protected mode (allowing for 32-bit code to run and allowing for more than 1MB of main memory) and doing some weird CPU reset voodoo to switch back to 16-bit mode (real mode) to use DOS services such as hardware access (any data that needs to be sent to the DOS services is copied to the 640KB block first)
– So how do we allow DOS extenders to co-exist with Windows which also runs in protected mode? Hence the whole idea of 16-32-bit frankenprograms was standardised as DPMI, which uses virtualization, and this is where my knowledge of IBM PC obscura fails.
No modern PC will ever use this, modern Windows doesn’t allow such 16-32 bit frankenprograms to run in the x86-64 versions of the OS anymore. To run DOS today you use a VM, and assuming an IBM PC compatible VM everything else is handled by the host OS. Or use DOS Box.
Yes, but I do wonder what legacy systems might depend on it to continue to run.
When I was young I thought all that was new is good, now I’m old I know that is both untrue and impossible. Being a victim of dependency on so many legacy systems has made me much wiser.
kurkosdr,
I’m not going to weigh in on whether there are any mission critical DPMI systems laying around, but I did want to point out that DPMI existed to overcome the 16bit/1MB limits, Back in the day 4MB / 8MB were typical.
http://www.edm2.com/index.php/DOS_Protected_Mode_Interface
That was only the case with the 286, IBM was forced to build an external circuit to reset the CPU since intel failed to include a switch back to real mode. However this was short lived, the 386 fixed this.
DPMI isn’t for 16bit franken programs. To me it really sounds like you are talking about EMS? That’s where they swapped memory into 16bit address space so that 16bit programs could access additional memory via a sort of extended memory aperture.
The fact that windows dropped support for old dos programs doesn’t really mean no modern PC will ever use this. Up until about last year, I was still doing maintenance on old DOS software that was being deployed for large HVAC systems. This system was never upgraded to windows in the first place. It needed a real DOS computer (freedos worked) and used EMS, and amazingly your run of the mill modern PC still fits the bill.
I guess the point is that just because DOS is obsolete, it doesn’t mean nobody uses it. You can make the same argument for mainframes and unix.
(I kid 🙂 )
In short:
DMA (Direct Memory Access) refers to an interaction where either you (writing) or the hardware (reading) writes bulk data to a pre-arranged place in memory and then pokes the recipient to prompt them to start reading it independently, so the sender and receiver can exchange data with minimal overhead.
In protected mode, the memory addresses seen by the program are virtual addresses. The OS (or the DPMI host in DOS) handles choosing how they map to real memory. (Including “not at all”, which is how on-disk swap works. The OS moves the memory pages to the disk and removes them from the mapping table so that, if the program tries to access them, the CPU will “fault” (basically, raise an exception at the hardware level) over to the kernel so it can reload the data, re-add the entries, and then resume execution.)
To engage in the software side of DMA, a protected-mode program needs to specifically request that it be given access to the specific block of real memory addresses that the hardware will be operating on.
Because DOS drivers historically ran in real-mode and it’s tricky to assign responsibility in the more complex setups, memory managers other than protected-mode Windows’s built-in one never bothered with making that work for memory outside the first 1088KB (1024KB + 64KB).
For whatever reason, the memory managers still report success but return garbage values rather than reprorting failure when you ask for memory outside that range using the correct API for it (VDS, sort for Virtual DMA Services).
I just remembered the hours I dealt with himem.sys and emm386.exe, trying different settings, tens of different mouse drivers etc… just to get 2 KB more memory below the 640K.
The times before the internet ruined our attention span were delightful.
[nostalgia overload upcoming]
memmaker, quemm, smartdrv, loadhigh, doublespace, drivespace, stacker, noumb, tsr, bootmenu’s for (not) loading cdrom/mouse/sound depending on the kind of program you were going to run and the power of just running “sys a:” to create a
bootable floppy drive
Oh gosh, and I thought I had already burned and then buried those memories for good. Need not to try hard though, or they can raise from their graves of ashes and try to eat what may be left from my brain.
I’m too old for this shit. But it was a good read