12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PMAP (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> PMAP (9)The pmap_steal_memory() function is enabled by defining the C pre-processor macroPMAP_STEAL_MEMORY in 〈machine/pmap.h〉.vaddr_t pmap_growkernel(vaddr_t maxkvaddr)Management of the kernel virtual address space is complicated by the fact that it is notalways safe to wait for resources with which to map a kernel virtual address. However, it isnot always desirable to pre-allocate all resources necessary to map the entire kernel virtualaddress space.The pmap_growkernel() interface is designed to help alleviate this problem. The virtualmemory startup code may choose to allocate an initial set of mapping resources (e.g.,page tables) and set an internal variable indicating how much kernel virtual address spacecan be mapped using those initial resources. Then, when the virtual memory systemwishes to map something at an address beyond that initial limit, it callspmap_growkernel() to pre-allocate more sources with which to create the mapping.Note that once additional kernel virtual address space mapping resources have been allocated,they should not be freed; it is likely they will be needed again.The pmap_growkernel() function returns the new maximum kernel virtual address thatcan be mapped with the resources it has available. If new resources cannot be allocated,pmap_growkernel() must panic.The pmap_growkernel() function is enabled by defining the C pre-processor macroPMAP_GROWKERNEL in 〈machine/pmap.h〉.void pmap_fork(pmap_t src_map , pmap_t dst_map)Some pmap implementations may need to keep track of other information not directlyrelated to the virtual address space. For example, on the i386 port, the Local Descriptor Tablestate of a process is associated with the pmap (this is due to the fact that applicationsmanipulate the Local Descriptor Table directly expect it to be logically associated with thevirtual memory state of the process).The pmap_fork() function is provided as a way to associate information from src_mapwith dst_map when a vmspace is forked. pmap_fork() is called fromuvmspace_fork().The pmap_fork() function is enabled by defining the C pre-processor macroPMAP_FORK in 〈machine/pmap.h〉.vaddr_t PMAP_MAP_POOLPAGE(paddr_t pa)This function is used by the pool(9) memory pool manager. Pools allocate backing pagesone at a time. This is provided as a means to use hardware features such as a directmappedmemory segment to map the pages used by the pool(9) allocator. This can leadto better performance by e.g. reducing TLB contention.PMAP_MAP_POOLPAGE() returns the kernel-accessible address of the page being mapped.It must always succeed.The use of PMAP_MAP_POOLPAGE() is enabled by defining it as a C pre-processor macroin 〈machine/pmap.h〉. If PMAP_MAP_POOLPAGE() is defined,PMAP_UNMAP_POOLPAGE() must also be defined.The following is an example of how todefine PMAP_MAP_POOLPAGE():#define PMAP_MAP_POOLPAGE(pa)MIPS_PHYS_TO_KSEG0((pa))This takes the physical address of a page and returns the KSEG0 address of that page on aMIPS processor.<strong>NetBSD</strong> 3.0 December 25, 2007 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!