DOS/16M

Tenberry Home

Consulting Services

DOS/16M FAQ

Release Notes

DPMI Spec

* * *

DOS/4GW

DOS/4G

DOS/16M FAQ:
Memory Management


[Previous Section] * [Index of FAQ] * [Next Section]
  1. How do I address super-VGA video memory?
  2. Can I move a segment at runtime that was loaded into extended memory at load time?
  3. Does d16ReallocSeg() physically copy everything in the segment?
  4. Can I pass a pointer in the middle of the segment to d16ReallocSeg() and get the whole segment?
  5. Why can't I access all 128MB of physical memory available on my machine?
  6. How can I allocate a block of memory in protected mode that doesn't cross a page boundary?

1. How do I address super-VGA video memory?

Just as in a real-mode DOS program:

Base the addressing at 0xA000 << 4 rather than 0xB800 << 4.


2. Can I move a segment at runtime that was loaded into extended memory at load time?

Yes, use the d16ReallocSeg() API.


3. Does d16ReallocSeg() physically copy everything in the segment?

Yes.


4. Can I pass a pointer in the middle of the segment to d16ReallocSeg() and get the whole segment?

Yes. Pass any function name; the whole segment goes.


5. Why can't I access all 128MB of physical memory available on my machine?

DOS/16M is currently limited to 64MB of physical memory. We expect to be updating the DOS extender to use the extended XMS and VCPI calls that allow access to greater than 64MB but currently, you must use virtual memory if you need access to more than 64MB of memory.


6. How can I allocate a block of memory in protected mode that doesn't cross a page boundary?

If you want to access full pages on page boundaries, you can try: typedef unsigned long ulong;
int *bufp;
int *blockp:
#define BLOCKSIZE_I_WANT 8092 /* or whatever */
#define PAGESIZE 4096 /* must be power of 2 */
#define PSM1 (PAGESIZE - 1)
bufp = malloc(BLOCKSIZE_I_WANT + PSM1);
blockp = (int *) (((ulong) bufp + PSM1) & ~PSM1);

Then blockp will point to a page aligned buffer. When you are through with the block, be sure to free(bufp);, rather than blockp, since bufp is what malloc returned.


[Previous Section] * [Index of FAQ] * [Next Section]
Last modified 2003.02.07. Your questions, comments, and feedback are welcome.