]> git.saurik.com Git - apple/xnu.git/blobdiff - tests/sysctl_hw.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / sysctl_hw.c
index 823e1123ff5ca98ed4616bfc8ddd3a96da3ed753..de9329a37c63e6dab9a14af4e5e93de64a18ad46 100644 (file)
@@ -5,6 +5,8 @@ T_DECL(sysctl_hw_cpu, "ensure vital product and CPU-related sysctls exist")
 {
        char buffer[64] = "";
        size_t buffer_size = sizeof(buffer);
+       int v;
+       size_t v_size;
 
        int ret = sysctlbyname("hw.target", buffer,
            &buffer_size, NULL, 0);
@@ -25,4 +27,15 @@ T_DECL(sysctl_hw_cpu, "ensure vital product and CPU-related sysctls exist")
 
        T_ASSERT_POSIX_SUCCESS(ret, "machdep.cpu.brand_string sysctl");
        T_LOG("machdep.cpu.brand_string = %s", buffer);
+
+       v = 0;
+       v_size = sizeof(v);
+       ret = sysctlbyname("hw.cpu64bit_capable", &v, &v_size, NULL, 0);
+       T_ASSERT_POSIX_SUCCESS(ret, "hw.cpu64bit_capable");
+
+#if __arm__
+       T_EXPECT_EQ(v, 0, "cpu is not 64 bit capable");
+#else
+       T_EXPECT_EQ(v, 1, "cpu is 64 bit capable");
+#endif
 }