Copyright (c) 2003 Bruce M Simpson <email@example.com> Copyright (c) 2014 The FreeBSD Foundation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and th...
NAMEpmap_enter - insert a virtual page into a physical map
SYNOPSISIn sys/param.h In vm/vm.h In vm/pmap.h Ft int Fo pmap_enter Fa pmap_t pmap vm_offset_t va vm_page_t m vm_prot_t prot Fa u_int flags int8_t psind Fc
DESCRIPTIONThe Fn pmap_enter function creates a mapping in the physical map Fa pmap from the virtual address Fa va to the physical page Fa m with the protection Fa prot . Any previous mapping at the virtual address Fa va is destroyed.
The Fa flags argument may have the following values:
- A read access to the given virtual address triggered the call.
- A write access to the given virtual address triggered the call.
- An execute access to the given virtual address triggered the call.
- The mapping should be marked as wired.
- This function may not sleep during creation of the mapping. If the mapping cannot be created without sleeping, an appropriate Mach VM error is returned.
If the PMAP_ENTER_NOSLEEP flag is not specified, this function must create the requested mapping before returning. It may not fail. In order to create the requested mapping, this function may destroy any non-wired mapping in any pmap.
The Fa psind parameter specifies the page size that should be used by the mapping. The supported page sizes are described by the global array pagesizes The desired page size is specified by passing the index of the array element that equals the desired page size.
When the Fn pmap_enter function destroys or updates a managed mapping, including an existing mapping at virtual address Fa va , it updates the Ft vm_page structure corresponding to the previously mapped physical page. If the physical page was accessed through the managed mapping, then the Ft vm_page structure's PGA_REFERENCED aflag is set. If the physical page was modified through the managed mapping, then the Fn vm_page_dirty function is called on the Ft vm_page structure.
The PGA_WRITEABLE aflag must be set for the page Fa m if the new mapping is managed and writeable. It is advised to clear PGA_WRITEABLE for destroyed mappings if the implementation can ensure that no other writeable managed mappings for the previously mapped pages exist.
If the page Fa m is managed, the page must be busied by the caller or the owning object must be locked. In the later case, the PMAP_ENTER_NOSLEEP must be specified by the caller.
The Fn pmap_enter function must handle the multiprocessor TLB consistency for the given address.