X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/c910b4d9d2451126ae3917b931cd4390c11e1d52..7ddcb079202367355dddccdfa4318e57d50318be:/osfmk/i386/machine_routines_asm.s diff --git a/osfmk/i386/machine_routines_asm.s b/osfmk/i386/machine_routines_asm.s index bb4095af3..0e3d9fb68 100644 --- a/osfmk/i386/machine_routines_asm.s +++ b/osfmk/i386/machine_routines_asm.s @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2010 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -27,12 +27,11 @@ */ #include -#include -#include +#include #include - +#include #include -#include +#include #include /* @@ -135,43 +134,30 @@ LEXT(tmrCvt) ret // Leave... - .globl EXT(_rtc_nanotime_store) - .align FALIGN - -LEXT(_rtc_nanotime_store) - push %ebp - movl %esp,%ebp - push %esi - mov 32(%ebp),%edx /* get ptr to rtc_nanotime_info */ - - movl RNT_GENERATION(%edx),%esi /* get current generation */ - movl $0,RNT_GENERATION(%edx) /* flag data as being updated */ +/* void _rtc_nanotime_adjust( + uint64_t tsc_base_delta, + rtc_nanotime_t *dst); +*/ + .globl EXT(_rtc_nanotime_adjust) + .align FALIGN - mov 8(%ebp),%eax - mov %eax,RNT_TSC_BASE(%edx) - mov 12(%ebp),%eax - mov %eax,RNT_TSC_BASE+4(%edx) +LEXT(_rtc_nanotime_adjust) + mov 12(%esp),%edx /* ptr to rtc_nanotime_info */ + + movl RNT_GENERATION(%edx),%ecx /* get current generation */ + movl $0,RNT_GENERATION(%edx) /* flag data as being updated */ - mov 24(%ebp),%eax - mov %eax,RNT_SCALE(%edx) + movl 4(%esp),%eax /* get lower 32-bits of delta */ + addl %eax,RNT_TSC_BASE(%edx) + adcl $0,RNT_TSC_BASE+4(%edx) /* propagate carry */ - mov 28(%ebp),%eax - mov %eax,RNT_SHIFT(%edx) + incl %ecx /* next generation */ + jnz 1f + incl %ecx /* skip 0, which is a flag */ +1: movl %ecx,RNT_GENERATION(%edx) /* update generation and make usable */ - mov 16(%ebp),%eax - mov %eax,RNT_NS_BASE(%edx) - mov 20(%ebp),%eax - mov %eax,RNT_NS_BASE+4(%edx) - - incl %esi /* next generation */ - jnz 1f - incl %esi /* skip 0, which is a flag */ -1: movl %esi,RNT_GENERATION(%edx) /* update generation and make usable */ - - pop %esi - pop %ebp - ret + ret /* unint64_t _rtc_nanotime_read( rtc_nanotime_t *rntp, int slow ); @@ -220,7 +206,7 @@ LEXT(_rtc_nanotime_read) jnz Lslow /* Processor whose TSC frequency is faster than SLOW_TSC_THRESHOLD */ - RTC_NANOTIME_READ_FAST() + PAL_RTC_NANOTIME_READ_FAST() popl %ebx popl %edi @@ -284,3 +270,42 @@ Lslow: pop %ebp ret /* result in edx:eax */ + + +/* + * Timing routines. + */ +Entry(timer_update) + movl 4(%esp),%ecx + movl 8(%esp),%eax + movl 12(%esp),%edx + movl %eax,TIMER_HIGHCHK(%ecx) + movl %edx,TIMER_LOW(%ecx) + movl %eax,TIMER_HIGH(%ecx) + ret + +Entry(timer_grab) + movl 4(%esp),%ecx +0: movl TIMER_HIGH(%ecx),%edx + movl TIMER_LOW(%ecx),%eax + cmpl TIMER_HIGHCHK(%ecx),%edx + jne 0b + ret + + +Entry(call_continuation) + movl S_ARG0,%eax /* get continuation */ + movl S_ARG1,%edx /* continuation param */ + movl S_ARG2,%ecx /* wait result */ + movl %gs:CPU_KERNEL_STACK,%esp /* pop the stack */ + xorl %ebp,%ebp /* zero frame pointer */ + subl $8,%esp /* align the stack */ + pushl %ecx + pushl %edx + call *%eax /* call continuation */ + addl $16,%esp + movl %gs:CPU_ACTIVE_THREAD,%eax + pushl %eax + call EXT(thread_terminate) + +