X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/eb6b6ca394357805f2bdba989abae309f718b4d8..f427ee49d309d8fc33ebf3042c3a775f2f530ded:/libsyscall/wrappers/mach_absolute_time.s diff --git a/libsyscall/wrappers/mach_absolute_time.s b/libsyscall/wrappers/mach_absolute_time.s index 5b3b36541..89c15592a 100644 --- a/libsyscall/wrappers/mach_absolute_time.s +++ b/libsyscall/wrappers/mach_absolute_time.s @@ -153,6 +153,7 @@ _mach_absolute_time: #elif defined(__arm__) #include +#include /* * If userspace access to the timebase is supported (indicated through the commpage), @@ -180,7 +181,7 @@ _mach_absolute_time: ldrb r0, [ip, #((_COMM_PAGE_USER_TIMEBASE) - (_COMM_PAGE_TIMEBASE_OFFSET))] 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 +#include /* * If userspace access to the timebase is supported (indicated through the commpage), @@ -244,11 +246,11 @@ _mach_absolute_time: ldrb w2, [x3, #((_COMM_PAGE_USER_TIMEBASE) - (_COMM_PAGE_TIMEBASE_OFFSET))] 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 @@ -261,7 +263,7 @@ L_mach_absolute_time_user: .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 @@ -269,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