]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/wrappers/mach_absolute_time.s
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / libsyscall / wrappers / mach_absolute_time.s
index 2c637bfc933740fb4174eaf6dbe650de6741a5bd..89c15592ad4a38ccac26f3332e7cce355cc77e3c 100644 (file)
@@ -153,6 +153,7 @@ _mach_absolute_time:
 #elif defined(__arm__)
 
 #include <mach/arm/syscall_sw.h>
+#include <mach/arm/traps.h>
 
 /*
  * If userspace access to the timebase is supported (indicated through the commpage),
@@ -178,9 +179,9 @@ _mach_absolute_time:
        movw    ip, #((_COMM_PAGE_TIMEBASE_OFFSET) & 0x0000FFFF)
        movt    ip, #(((_COMM_PAGE_TIMEBASE_OFFSET) >> 16) & 0x0000FFFF)
        ldrb    r0, [ip, #((_COMM_PAGE_USER_TIMEBASE) - (_COMM_PAGE_TIMEBASE_OFFSET))]
-       cmp     r0, #0                          // Are userspace reads supported?
+       cmp     r0, #USER_TIMEBASE_NONE         // Are userspace reads supported?
        beq     _mach_absolute_time_kernel      // If not, go to the kernel
-       isb                                     // Prevent speculation on CNTPCT across calls
+       isb                                     // Prevent speculation on CNTVCT across calls
                                                // (see ARMV7C.b section B8.1.2, ARMv8 section D6.1.2)
        push    {r4, r5, r7, lr}                // Push a frame
        add     r7, sp, #8
@@ -206,7 +207,7 @@ L_mach_absolute_time_user:
        .align 2
        .globl _mach_absolute_time_kernel
 _mach_absolute_time_kernel:
-       mov     r12, #-3                        // Load the magic MAT number
+       mov     r12, #MACH_ARM_TRAP_ABSTIME     // Load the magic MAT number
        swi     #SWI_SYSCALL
        bx      lr
 
@@ -214,13 +215,14 @@ _mach_absolute_time_kernel:
        .align 2
        .globl _mach_continuous_time_kernel
 _mach_continuous_time_kernel:
-       mov     r12, #-4                        // Load the magic MCT number
+       mov     r12, #MACH_ARM_TRAP_CONTTIME    // Load the magic MCT number
        swi     #SWI_SYSCALL
        bx      lr
 
 #elif defined(__arm64__)
 
 #include <mach/arm/syscall_sw.h>
+#include <mach/arm/traps.h>
 
 /*
  * If userspace access to the timebase is supported (indicated through the commpage),
@@ -242,24 +244,26 @@ _mach_absolute_time:
        movk    x3, #(((_COMM_PAGE_TIMEBASE_OFFSET) >> 16) & 0x000000000000FFFF), lsl #16
        movk    x3, #((_COMM_PAGE_TIMEBASE_OFFSET) & 0x000000000000FFFF)
        ldrb    w2, [x3, #((_COMM_PAGE_USER_TIMEBASE) - (_COMM_PAGE_TIMEBASE_OFFSET))]
-       cmp     x2, #0                          // Are userspace reads supported?
+       cmp     x2, #USER_TIMEBASE_NONE         // Are userspace reads supported?
        b.eq    _mach_absolute_time_kernel      // If not, go to the kernel
-       isb                                     // Prevent speculation on CNTPCT across calls
+       isb                                     // Prevent speculation on CNTVCT across calls
                                                // (see ARMV7C.b section B8.1.2, ARMv8 section D6.1.2)
 L_mach_absolute_time_user:
        ldr     x1, [x3]                        // Load the offset
-       mrs     x0, CNTPCT_EL0                  // Read the timebase
+       mrs     x0, CNTVCT_EL0                  // Read the timebase
        ldr     x2, [x3]                        // Load the offset
        cmp     x1, x2                          // Compare our offset values...
        b.ne    L_mach_absolute_time_user       // If they changed, try again
        add     x0, x0, x1                      // Construct mach_absolute_time
-       ret     
+       ret
+
+
 
        .text
        .align 2
        .globl _mach_absolute_time_kernel
 _mach_absolute_time_kernel:
-       mov     w16, #-3                        // Load the magic MAT number
+       mov     w16, #MACH_ARM_TRAP_ABSTIME     // Load the magic MAT number
        svc     #SWI_SYSCALL
        ret
 
@@ -267,7 +271,7 @@ _mach_absolute_time_kernel:
        .align 2
        .globl _mach_continuous_time_kernel
 _mach_continuous_time_kernel:
-       mov     w16, #-4                        // Load the magic MCT number
+       mov     w16, #MACH_ARM_TRAP_CONTTIME    // Load the magic MCT number
        svc     #SWI_SYSCALL
        ret