X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/c0fea4742e91338fffdcf79f86a7c1d5e2b97eb1..d1ecb069dfe24481e4a83f44cb5217a2b06746d7:/osfmk/ppc/machine_routines_asm.s diff --git a/osfmk/ppc/machine_routines_asm.s b/osfmk/ppc/machine_routines_asm.s index e7c5916ba..45bfb5b5e 100644 --- a/osfmk/ppc/machine_routines_asm.s +++ b/osfmk/ppc/machine_routines_asm.s @@ -1,23 +1,29 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #include #include @@ -756,34 +762,72 @@ LEXT(timer_grab) ; Force a line boundry here .align 5 - .globl EXT(timer_event) + .globl EXT(thread_timer_event) + +LEXT(thread_timer_event) + mfsprg r10,1 ; Get the current activation + lwz r10,ACT_PER_PROC(r10) ; Get the per_proc block + addi r10,r10,PP_PROCESSOR + lwz r11,THREAD_TIMER(r10) + + lwz r9,TIMER_LOW(r11) + lwz r7,TIMER_TSTAMP(r11) + lwz r8,TIMER_TSTAMP+4(r11) + subfc r8,r8,r4 + subfe r7,r7,r3 + addc r8,r8,r9 + addze. r7,r7 + beq++ 0f + + lwz r6,TIMER_HIGH(r11) + add r7,r7,r6 + stw r7,TIMER_HIGHCHK(r11) + eieio + stw r8,TIMER_LOW(r11) + eieio + stw r7,TIMER_HIGH(r11) + b 1f + +0: stw r8,TIMER_LOW(r11) + +1: stw r5,THREAD_TIMER(r10) + stw r3,TIMER_TSTAMP(r5) + stw r4,TIMER_TSTAMP+4(r5) + blr + +; Force a line boundry here + .align 5 + .globl EXT(state_event) -LEXT(timer_event) +LEXT(state_event) mfsprg r10,1 ; Get the current activation lwz r10,ACT_PER_PROC(r10) ; Get the per_proc block addi r10,r10,PP_PROCESSOR - lwz r11,CURRENT_TIMER(r10) + lwz r11,CURRENT_STATE(r10) lwz r9,TIMER_LOW(r11) - lwz r2,TIMER_TSTAMP(r11) - add r0,r9,r3 - subf r5,r2,r0 - cmplw r5,r9 - bge++ 0f + lwz r7,TIMER_TSTAMP(r11) + lwz r8,TIMER_TSTAMP+4(r11) + subfc r8,r8,r4 + subfe r7,r7,r3 + addc r8,r8,r9 + addze. r7,r7 + beq++ 0f lwz r6,TIMER_HIGH(r11) - addi r6,r6,1 - stw r6,TIMER_HIGHCHK(r11) + add r7,r7,r6 + stw r7,TIMER_HIGHCHK(r11) eieio - stw r5,TIMER_LOW(r11) + stw r8,TIMER_LOW(r11) eieio - stw r6,TIMER_HIGH(r11) + stw r7,TIMER_HIGH(r11) b 1f -0: stw r5,TIMER_LOW(r11) +0: stw r8,TIMER_LOW(r11) -1: stw r4,CURRENT_TIMER(r10) - stw r3,TIMER_TSTAMP(r4) +1: stw r5,CURRENT_STATE(r10) + stw r3,TIMER_TSTAMP(r5) + stw r4,TIMER_TSTAMP+4(r5) blr /* Set machine into idle power-saving mode.