]>
git.saurik.com Git - apple/xnu.git/blob - tests/vm/retired_pages.c
1 #include <sys/sysctl.h>
4 #include <darwintest.h>
7 * trying phys offsets from start of dram of:
13 #define USEBOOTARG "bad_ram_pages=536870912 bad_static_mfree=1"
15 #define USEBOOTARG "bad_ram_pages=3221225472 bad_static_mfree=1"
17 #define USEBOOTARG "bad_ram_pages=786432000 bad_static_mfree=1"
20 T_DECL(retired_pages_test
,
21 "Test retiring pages at boot",
22 T_META_NAMESPACE("xnu.vm"),
23 T_META_BOOTARGS_SET(USEBOOTARG
),
25 T_META_CHECK_LEAKS(false))
28 unsigned int count
= 0;
29 size_t s
= sizeof(count
);
31 #if !defined(__arm64__) || TARGET_OS_BRIDGE
32 T_SKIP("No page retirement on x86, arm32 or bridgeOS kernels");
35 * Get the number of pages retired from the kernel
37 err
= sysctlbyname("vm.retired_pages_count", &count
, &s
, NULL
, 0);
39 /* If the sysctl isn't supported, test succeeds */
41 T_SKIP("sysctl vm.retired_pages_count not found, skipping test");
43 T_ASSERT_POSIX_SUCCESS(err
, "sysctl vm.retired_pages_count");
45 T_ASSERT_GT_INT(count
, 0, "Expect retired pages");