]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/wrappers/__get_cpu_capabilities.s
xnu-6153.81.5.tar.gz
[apple/xnu.git] / libsyscall / wrappers / __get_cpu_capabilities.s
index 12e9c76523b6e4c942ff72db0e09d2659e078ad4..86b0ee2a7f885d8e39e4a6bb6d92f11c8375de68 100644 (file)
@@ -33,8 +33,8 @@
        .align 2, 0x90
        .globl __get_cpu_capabilities
 __get_cpu_capabilities:
-       movq    $(_COMM_PAGE_CPU_CAPABILITIES), %rax
-       movl    (%rax), %eax
+       movq    $(_COMM_PAGE_CPU_CAPABILITIES64), %rax
+       movq    (%rax), %rax
        ret
 
 #elif defined(__i386__)
@@ -43,7 +43,35 @@ __get_cpu_capabilities:
        .align 2, 0x90
        .globl __get_cpu_capabilities
 __get_cpu_capabilities:
-       movl    _COMM_PAGE_CPU_CAPABILITIES, %eax
+       movl    _COMM_PAGE_CPU_CAPABILITIES64, %eax
+       movl    _COMM_PAGE_CPU_CAPABILITIES64+4, %edx
        ret
 
+#elif defined(__arm__)
+
+       .text
+       .align 2
+       .globl __get_cpu_capabilities
+__get_cpu_capabilities:
+       mov     r0, #(_COMM_PAGE_CPU_CAPABILITIES & 0x000000ff)
+       orr     r0, r0, #(_COMM_PAGE_CPU_CAPABILITIES & 0x0000ff00)
+       orr     r0, r0, #(_COMM_PAGE_CPU_CAPABILITIES & 0x00ff0000)
+       orr     r0, r0, #(_COMM_PAGE_CPU_CAPABILITIES & 0xff000000)
+       ldr     r0, [r0]
+       bx      lr
+
+#elif defined(__arm64__)
+
+       .text
+       .align 2
+       .globl __get_cpu_capabilities
+__get_cpu_capabilities:
+       ldr x0, Lcommpage_cc_addr
+       ldr     w0, [x0]
+       ret
+Lcommpage_cc_addr:
+.quad _COMM_PAGE_CPU_CAPABILITIES
+
+#else
+#error Unsupported architecture
 #endif