/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _VM_PMAP_H_
#define _VM_PMAP_H_
+#include <sys/appleapiopts.h>
+
+#ifdef __APPLE_API_PRIVATE
+
#include <mach/kern_return.h>
#include <mach/vm_param.h>
#include <mach/vm_types.h>
* many address spaces.
*/
-#ifndef MACH_KERNEL_PRIVATE
+/* Copy between a physical page and a virtual address */
+extern kern_return_t copypv(
+ addr64_t source,
+ addr64_t sink,
+ unsigned int size,
+ int which);
+#define cppvPsnk 1
+#define cppvPsrc 2
+#define cppvFsnk 4
+#define cppvFsrc 8
+#define cppvNoModSnk 16
+#define cppvNoRefSrc 32
+#define cppvKmap 64 /* User the kernel's vm_map */
+
+#if !defined(MACH_KERNEL_PRIVATE)
typedef void *pmap_t;
* However, for best performance pmap_free_pages should be accurate.
*/
-extern boolean_t pmap_next_page(vm_offset_t *paddr);
+extern boolean_t pmap_next_page(ppnum_t *pnum);
/* During VM initialization,
* return the next unused
* physical page.
extern void pmap_enter( /* Enter a mapping */
pmap_t pmap,
vm_offset_t v,
- vm_offset_t pa,
+ ppnum_t pn,
vm_prot_t prot,
+ unsigned int flags,
boolean_t wired);
+extern void pmap_remove_some_phys(
+ pmap_t pmap,
+ ppnum_t pn);
+
/*
* Routines that operate on physical addresses.
*/
+
extern void pmap_page_protect( /* Restrict access to page. */
- vm_offset_t phys,
+ ppnum_t phys,
vm_prot_t prot);
extern void (pmap_zero_page)(
- vm_offset_t phys);
+ ppnum_t pn);
extern void (pmap_zero_part_page)(
- vm_offset_t p,
+ ppnum_t pn,
vm_offset_t offset,
vm_size_t len);
extern void (pmap_copy_page)(
- vm_offset_t src,
- vm_offset_t dest);
+ ppnum_t src,
+ ppnum_t dest);
extern void (pmap_copy_part_page)(
- vm_offset_t src,
+ ppnum_t src,
vm_offset_t src_offset,
- vm_offset_t dst,
+ ppnum_t dst,
vm_offset_t dst_offset,
vm_size_t len);
extern void (pmap_copy_part_lpage)(
vm_offset_t src,
- vm_offset_t dst,
+ ppnum_t dst,
vm_offset_t dst_offset,
vm_size_t len);
extern void (pmap_copy_part_rpage)(
- vm_offset_t src,
+ ppnum_t src,
vm_offset_t src_offset,
vm_offset_t dst,
vm_size_t len);
* debug/assertions. pmap_verify_free returns true iff
* the given physical page is mapped into no pmap.
*/
-extern boolean_t pmap_verify_free(vm_offset_t paddr);
+extern boolean_t pmap_verify_free(ppnum_t pn);
/*
* Statistics routines
vm_machine_attribute_t attribute,
vm_machine_attribute_val_t* value);
+extern kern_return_t (pmap_attribute_cache_sync)( /* Flush appropriate
+ * cache based on
+ * page number sent */
+ ppnum_t pn,
+ vm_size_t size,
+ vm_machine_attribute_t attribute,
+ vm_machine_attribute_val_t* value);
+
/*
* Routines defined as macros.
*/
/*
* Macro to be used in place of pmap_enter()
*/
-#define PMAP_ENTER(pmap, virtual_address, page, protection, wired) \
+#define PMAP_ENTER(pmap, virtual_address, page, protection, flags, wired) \
MACRO_BEGIN \
pmap_enter( \
(pmap), \
(virtual_address), \
- (page)->phys_addr, \
+ (page)->phys_page, \
(protection) & ~(page)->page_lock, \
+ flags, \
(wired) \
); \
MACRO_END
#endif /* !PMAP_ENTER */
-#endif /* MACH_KERNEL_PRIVATE */
-
-/*
- * JMM - This portion is exported to other kernel components right now,
- * but will be pulled back in the future when the needed functionality
- * is provided in a cleaner manner.
- */
-
-#define PMAP_NULL ((pmap_t) 0)
-
-extern pmap_t kernel_pmap; /* The kernel's map */
-#define pmap_kernel() (kernel_pmap)
-
/*
* Routines to manage reference/modify bits based on
* physical addresses, simulating them if not provided
* by the hardware.
*/
/* Clear reference bit */
-extern void pmap_clear_reference(vm_offset_t paddr);
+extern void pmap_clear_reference(ppnum_t pn);
/* Return reference bit */
-extern boolean_t (pmap_is_referenced)(vm_offset_t paddr);
+extern boolean_t (pmap_is_referenced)(ppnum_t pn);
/* Set modify bit */
-extern void pmap_set_modify(vm_offset_t paddr);
+extern void pmap_set_modify(ppnum_t pn);
/* Clear modify bit */
-extern void pmap_clear_modify(vm_offset_t paddr);
+extern void pmap_clear_modify(ppnum_t pn);
/* Return modify bit */
-extern boolean_t pmap_is_modified(vm_offset_t paddr);
+extern boolean_t pmap_is_modified(ppnum_t pn);
/*
* Routines that operate on ranges of virtual addresses.
*/
-extern void pmap_remove( /* Remove mappings. */
- pmap_t map,
- vm_offset_t s,
- vm_offset_t e);
-
extern void pmap_protect( /* Change protections. */
pmap_t map,
vm_offset_t s,
vm_offset_t end,
boolean_t pageable);
+#endif /* MACH_KERNEL_PRIVATE */
+
+/*
+ * JMM - This portion is exported to other kernel components right now,
+ * but will be pulled back in the future when the needed functionality
+ * is provided in a cleaner manner.
+ */
+
+#define PMAP_NULL ((pmap_t) 0)
+
+extern pmap_t kernel_pmap; /* The kernel's map */
+#define pmap_kernel() (kernel_pmap)
+
+/* machine independent WIMG bits */
+
+#define VM_MEM_GUARDED 0x1
+#define VM_MEM_COHERENT 0x2
+#define VM_MEM_NOT_CACHEABLE 0x4
+#define VM_MEM_WRITE_THROUGH 0x8
+
+#define VM_WIMG_MASK 0xFF
+#define VM_WIMG_USE_DEFAULT 0x80000000
+
extern void pmap_modify_pages( /* Set modify bit for pages */
pmap_t map,
vm_offset_t s,
pmap_t pmap,
vm_offset_t va,
boolean_t wired);
+
+extern void pmap_remove( /* Remove mappings. */
+ pmap_t map,
+ addr64_t s,
+ addr64_t e);
+
+
+#endif /* __APPLE_API_PRIVATE */
+
#endif /* _VM_PMAP_H_ */