how to reserve a range of memory address

how to reserve a range of memory address

Post by Yao » Fri, 13 Nov 1998 04:00:00



Hi guys,

how to reserver a range of memory address (virtual address)
on a Solaris machine ?

Thanks

Yao

 
 
 

how to reserve a range of memory address

Post by Roger A. Faulkn » Tue, 24 Nov 1998 04:00:00



>Hi guys,

>how to reserver a range of memory address (virtual address)
>on a Solaris machine ?

In Solaris 2.6 and later, you can open() and mmap() /dev/null
to reserve address ranges.  Such address ranges are "reserved"
in the sense that the system will not map anything there when
mmap() is used with a NULL requested address (thereby asking the
system to pick an address for the mapping).  You can later use
mmap() with the reserved address specified to put something
real in that place.

This is how it is done:

        int fd = open("/dev/null", O_RDWR);
        void *reserved =
            mmap(NULL, 800 * 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
        close(fd);

The resulting program can be examined with /usr/proc/bin/pmap
with the -r flag to show the reserved mappings:

$ pmap -r 591
591:    ./foo
00010000      8K read/exec         /usr1/raf/foo
00020000      8K read/write/exec   /usr1/raf/foo
FF180000    800K -
FF280000    664K read/exec         /usr/lib/libc.so.1
FF334000     32K read/write/exec   /usr/lib/libc.so.1
FF33C000      8K read/write/exec     [ anon ]
FF380000     16K read/exec         /usr/platform/sun4u/lib/libc_psr.so.1
FF3A0000      8K read/exec         /usr/lib/libdl.so.1
FF3B0000    120K read/exec         /usr/lib/ld.so.1
FF3DC000     16K read/write/exec   /usr/lib/ld.so.1
FF3F0000   8192K read/write/exec     [ stack ]
 total     9872K

Roger Faulkner

 
 
 

how to reserve a range of memory address

Post by Ashish Goya » Wed, 25 Nov 1998 04:00:00


Hi!
Is there a range of virtual memory addresses that solaris 2.6 does not use at all ? Like there was
a range of addresses in solaris 2.3 0x20000000 to 0xE0000000 that were nevr used by solaris for
mapping anything - unless explicitly specified.
TIA,
Ashish


> >Hi guys,

> >how to reserver a range of memory address (virtual address)
> >on a Solaris machine ?

> In Solaris 2.6 and later, you can open() and mmap() /dev/null
> to reserve address ranges.  Such address ranges are "reserved"
> in the sense that the system will not map anything there when
> mmap() is used with a NULL requested address (thereby asking the
> system to pick an address for the mapping).  You can later use
> mmap() with the reserved address specified to put something
> real in that place.

> This is how it is done:

>         int fd = open("/dev/null", O_RDWR);
>         void *reserved =
>             mmap(NULL, 800 * 1024, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
>         close(fd);

> The resulting program can be examined with /usr/proc/bin/pmap
> with the -r flag to show the reserved mappings:

> $ pmap -r 591
> 591:    ./foo
> 00010000      8K read/exec         /usr1/raf/foo
> 00020000      8K read/write/exec   /usr1/raf/foo
> FF180000    800K -
> FF280000    664K read/exec         /usr/lib/libc.so.1
> FF334000     32K read/write/exec   /usr/lib/libc.so.1
> FF33C000      8K read/write/exec     [ anon ]
> FF380000     16K read/exec         /usr/platform/sun4u/lib/libc_psr.so.1
> FF3A0000      8K read/exec         /usr/lib/libdl.so.1
> FF3B0000    120K read/exec         /usr/lib/ld.so.1
> FF3DC000     16K read/write/exec   /usr/lib/ld.so.1
> FF3F0000   8192K read/write/exec     [ stack ]
>  total     9872K

> Roger Faulkner

 
 
 

how to reserve a range of memory address

Post by Roger A. Faulkn » Mon, 30 Nov 1998 04:00:00



>Hi!
>Is there a range of virtual memory addresses that solaris 2.6 does not use at all ? Like there was
>a range of addresses in solaris 2.3 0x20000000 to 0xE0000000 that were nevr used by solaris for
>mapping anything - unless explicitly specified.
>TIA,
>Ashish

There never was a range of addresses that Solaris (the OS) reserved.
However, there is a hole in the memory management unit of sun4c machines
such that the hardware cannot map a range of addresses somewhere in the
middle of the 32-bit address range (I think you got the range right above).

Also, addresses above 0xf0000000 (0xe0000000 on sun4d and x86 machines)
contain the operating system (inaccessible to user-level, but mapped
nevertheless for the convenience of the kernel) (except sun4u, see below).

sun4m and sun4d machines have no hole in the 32-bit address space.
sun4u (UltraSparc) in Solaris 7 has no hole in the 32-bit address
space and doesn't even reserve the space above 0xf0000000 (the top
page or two is reserved to guarantee at least one invalid address).

However, there is a hole in the sun4u memory management unit for
64-bit address spaces (you will never encounter it since the 64-bit
address space is so large but the hardware manuals specify it.

Roger Faulkner

 
 
 

1. How to Reserve Specific Memory Range In Driver?

Hello --

I'm developing a character device for Linux (Intel) that needs
to read and write to a specific range of RAM addresses in order to
communicate with a memory-mapped device (that does NOT use DMA).
Unfortunately, I cannot seem to find a kernel call that would allow me
to reserve the particular range of memory that I need, either be
reading the Kernel Hacker's Guide or by scanning over other drivers'
code.  Could anyone direct me to such a function?  Simply writing over
the data that is already in this memory range doesn't work very well.
=)

Any insight you might have on whether or not a device that needs access to
a certain memory range could still work as a dynamically loadable module
would also be great.  What are the chances, for example, that if my
device is loaded as a module an hour after system start-up, that the desired
bit of memory could still be moved out of the way so that the module
could claim it?

Thanks!

-Chris

2. FreeBSD, IPSec Tunnel, ICMP Redirect error

3. Reserving virtual memory addresses

4. edquota and vi on RH5.2

5. Reserved Memory Addresses

6. Adaptec 1542 options

7. How to disclaim the content of a memory address range?????????

8. term server hardware: cyclades etc?

9. writing I/O to memory address range

10. memory range - IO range

11. How is shared memory address range determined

12. reserving an adress range for later mmap-ing

13. small memory machine, large reserved memory