"Wildman" <
best...@yahoo.com> wrote in message
news:nE18s.165$do6...@newsfe19.iad...
> On Sun, 23 Sep 2012 23:57:45 -0700, japheth wrote:
>
> >> <snip>
>
> After reading your reply, I believe my problem is related
> to the fact that the dos interrupt is expecting real mode
> addresses and it is getting PM addresses. Two possible
> fixes come to mind.....
>
> 1) I understand that a PM address can be calculated like
> this: real-mode-segment * 10h + offset.
>
That isn't the case.
That computes the physical address (upto 1MB+64KB-17B).
PM uses relative addressing as base+offset. The "address" when you're
looking at PM code is actually the "offset" from the segment's base address.
Each PM selector has a PM descriptor which has the base address of the
segment and the length of the segment, known as the limit. You'd have to
compute whether the physical address you have matches an address within the
PM segment. If the base address is zero and the limit is 4GB (entire
segment) and paging is disabled, that's easy. The addresses are equivalent.
If the limit is less than 4GB, you must check to see if the address is
within the segment's range. If the base is non-zero, you must compute where
the address is relative to the base address and check the range. If paging
is enabled, you'll want to physically map the memory region, if it's not
already. Typically, OSes and DPMI hosts physically map the first 1MB or so.
If paging is enabled and you can't physically map the memory region, I've
got no idea how to locate the compute the address, if it's even possible.
You'd probably be adding lots of values from the paging tables together ...
Rod Pemberton