X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/316670eb35587141e969394ae8537d66b9211e80..15129b1c8dbb3650c63b70adb1cad9af601c6c17:/osfmk/vm/pmap.h diff --git a/osfmk/vm/pmap.h b/osfmk/vm/pmap.h index 26c26d6c0..2e228d6d2 100644 --- a/osfmk/vm/pmap.h +++ b/osfmk/vm/pmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2012 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -141,7 +141,7 @@ extern void pmap_startup( * use remaining physical pages * to allocate page frames. */ -extern void pmap_init(void) __attribute__((section("__TEXT, initcode"))); +extern void pmap_init(void); /* Initialization, * after kernel runs * in virtual memory. @@ -189,11 +189,7 @@ extern void pmap_virtual_space( extern pmap_t pmap_create( /* Create a pmap_t. */ ledger_t ledger, vm_map_size_t size, -#ifdef __i386__ - boolean_t is_64bit); -#else __unused boolean_t is_64bit); -#endif extern pmap_t (pmap_kernel)(void); /* Return the kernel's pmap */ extern void pmap_reference(pmap_t pmap); /* Gain a reference. */ extern void pmap_destroy(pmap_t pmap); /* Release a reference. */ @@ -217,7 +213,8 @@ extern kern_return_t pmap_enter_options( vm_prot_t fault_type, unsigned int flags, boolean_t wired, - unsigned int options); + unsigned int options, + void *arg); extern void pmap_remove_some_phys( pmap_t pmap, @@ -232,6 +229,12 @@ extern void pmap_page_protect( /* Restrict access to page. */ ppnum_t phys, vm_prot_t prot); +extern void pmap_page_protect_options( /* Restrict access to page. */ + ppnum_t phys, + vm_prot_t prot, + unsigned int options, + void *arg); + extern void (pmap_zero_page)( ppnum_t pn); @@ -266,6 +269,11 @@ extern void (pmap_copy_part_rpage)( extern unsigned int (pmap_disconnect)( /* disconnect mappings and return reference and change */ ppnum_t phys); +extern unsigned int (pmap_disconnect_options)( /* disconnect mappings and return reference and change */ + ppnum_t phys, + unsigned int options, + void *arg); + extern kern_return_t (pmap_attribute_cache_sync)( /* Flush appropriate * cache based on * page number sent */ @@ -381,34 +389,51 @@ extern kern_return_t (pmap_attribute)( /* Get/Set special memory MACRO_BEGIN \ pmap_t __pmap = (pmap); \ vm_page_t __page = (page); \ + int __options = 0; \ \ PMAP_ENTER_CHECK(__pmap, __page) \ - pmap_enter(__pmap, \ - (virtual_address), \ - __page->phys_page, \ - (protection), \ - (fault_type), \ - (flags), \ - (wired)); \ + if (__page->object->internal) { \ + __options |= PMAP_OPTIONS_INTERNAL; \ + } \ + if (__page->reusable || __page->object->all_reusable) { \ + __options |= PMAP_OPTIONS_REUSABLE; \ + } \ + (void) pmap_enter_options(__pmap, \ + (virtual_address), \ + __page->phys_page, \ + (protection), \ + (fault_type), \ + (flags), \ + (wired), \ + __options, \ + NULL); \ MACRO_END #endif /* !PMAP_ENTER */ #ifndef PMAP_ENTER_OPTIONS -#define PMAP_ENTER_OPTIONS(pmap, virtual_address, page, protection, fault_type, \ - flags, wired, options, result) \ +#define PMAP_ENTER_OPTIONS(pmap, virtual_address, page, protection, \ + fault_type, flags, wired, options, result) \ MACRO_BEGIN \ pmap_t __pmap = (pmap); \ vm_page_t __page = (page); \ + int __extra_options = 0; \ \ PMAP_ENTER_CHECK(__pmap, __page) \ + if (__page->object->internal) { \ + __extra_options |= PMAP_OPTIONS_INTERNAL; \ + } \ + if (__page->reusable || __page->object->all_reusable) { \ + __extra_options |= PMAP_OPTIONS_REUSABLE; \ + } \ result = pmap_enter_options(__pmap, \ - (virtual_address), \ - __page->phys_page, \ - (protection), \ - (fault_type), \ - (flags), \ - (wired), \ - options); \ + (virtual_address), \ + __page->phys_page, \ + (protection), \ + (fault_type), \ + (flags), \ + (wired), \ + (options) | __extra_options, \ + NULL); \ MACRO_END #endif /* !PMAP_ENTER_OPTIONS */ @@ -455,6 +480,13 @@ extern kern_return_t (pmap_attribute)( /* Get/Set special memory * physical addresses, simulating them if not provided * by the hardware. */ +struct pfc { + long pfc_cpus; + long pfc_invalid_global; +}; + +typedef struct pfc pmap_flush_context; + /* Clear reference bit */ extern void pmap_clear_reference(ppnum_t pn); /* Return reference bit */ @@ -471,6 +503,11 @@ extern unsigned int pmap_get_refmod(ppnum_t pn); extern void pmap_clear_refmod(ppnum_t pn, unsigned int mask); #define VM_MEM_MODIFIED 0x01 /* Modified bit */ #define VM_MEM_REFERENCED 0x02 /* Referenced bit */ +extern void pmap_clear_refmod_options(ppnum_t pn, unsigned int mask, unsigned int options, void *); + + +extern void pmap_flush_context_init(pmap_flush_context *); +extern void pmap_flush(pmap_flush_context *); /* * Routines that operate on ranges of virtual addresses. @@ -481,6 +518,14 @@ extern void pmap_protect( /* Change protections. */ vm_map_offset_t e, vm_prot_t prot); +extern void pmap_protect_options( /* Change protections. */ + pmap_t map, + vm_map_offset_t s, + vm_map_offset_t e, + vm_prot_t prot, + unsigned int options, + void *arg); + extern void (pmap_pageable)( pmap_t pmap, vm_map_offset_t start, @@ -534,6 +579,13 @@ extern pmap_t kernel_pmap; /* The kernel's map */ #define PMAP_OPTIONS_NOENTER 0x2 /* expand pmap if needed * but don't enter mapping */ +#define PMAP_OPTIONS_COMPRESSOR 0x4 /* credit the compressor for + * this operation */ +#define PMAP_OPTIONS_INTERNAL 0x8 /* page from internal object */ +#define PMAP_OPTIONS_REUSABLE 0x10 /* page is "reusable" */ +#define PMAP_OPTIONS_NOFLUSH 0x20 /* delay flushing of pmap */ +#define PMAP_OPTIONS_NOREFMOD 0x40 /* don't need ref/mod on disconnect */ +#define PMAP_OPTIONS_REMOVE 0x100 /* removing a mapping */ #if !defined(__LP64__) extern vm_offset_t pmap_extract(pmap_t pmap, @@ -550,6 +602,18 @@ extern void pmap_remove( /* Remove mappings. */ vm_map_offset_t s, vm_map_offset_t e); +extern void pmap_remove_options( /* Remove mappings. */ + pmap_t map, + vm_map_offset_t s, + vm_map_offset_t e, + int options); + +extern void pmap_reusable( + pmap_t map, + vm_map_offset_t s, + vm_map_offset_t e, + boolean_t reusable); + extern void fillPage(ppnum_t pa, unsigned int fill); extern void pmap_map_sharedpage(task_t task, pmap_t pmap); @@ -559,6 +623,10 @@ extern void pmap_unmap_sharedpage(pmap_t pmap); void pmap_pre_expand(pmap_t pmap, vm_map_offset_t vaddr); #endif +unsigned int pmap_query_resident(pmap_t pmap, + vm_map_offset_t s, + vm_map_offset_t e); + #endif /* KERNEL_PRIVATE */ #endif /* _VM_PMAP_H_ */