]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/chud/chud_memory.c
9eeabb69e2346f12918744b5754297e569016a07
2 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #include <mach/vm_param.h>
24 #include <chud/chud_xnu.h>
25 #include <machine/machine_routines.h>
27 extern unsigned int IODefaultCacheBits(addr64_t pa
);
28 extern unsigned int vm_page_free_count
;
31 uint64_t chudxnu_avail_memory_size(void)
37 uint64_t chudxnu_phys_memory_size(void)
43 * This function is not intended to be valid for any amount of time,
44 * it is just an instantaneous snapshot of the current free memory size.
47 uint64_t chudxnu_free_memory_size(void)
49 return (uint64_t)vm_page_free_count
* (uint64_t)page_size
;
53 vm_offset_t
chudxnu_io_map(uint64_t phys_addr
, vm_size_t size
)
55 return ml_io_map(phys_addr
, size
); // XXXXX limited to first 2GB XXXXX
59 uint32_t chudxnu_phys_addr_wimg(uint64_t phys_addr
)
61 return IODefaultCacheBits(phys_addr
);