/*
- * 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 <ppc/asm.h>
#include <ppc/proc_reg.h>
; Force a line boundry here
.align 5
- .globl EXT(timer_event)
+ .globl EXT(thread_timer_event)
-LEXT(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,CURRENT_TIMER(r10)
+ lwz r11,THREAD_TIMER(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,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(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_STATE(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,CURRENT_STATE(r10)
+ stw r3,TIMER_TSTAMP(r5)
+ stw r4,TIMER_TSTAMP+4(r5)
blr
/* Set machine into idle power-saving mode.
mfsprg r3,1
blr
-
- .align 5
- .globl EXT(clock_get_uptime)
-LEXT(clock_get_uptime)
-1: mftbu r9
- mftb r0
- mftbu r11
- cmpw r11,r9
- bne-- 1b
- stw r0,4(r3)
- stw r9,0(r3)
- blr
-
.align 5
.globl EXT(mach_absolute_time)
andc r7,r7,r0 ; Pin time at 0 if under minimum
subfe r2,r2,r2 ; 0 if diff > 2**32, -1 otherwise
sub r7,r7,r10 ; Negative if duration is less than (max - min)
- or r2,r2,r0 ; If the duration is negative, it isn't too big
+ or r2,r2,r0 ; If the duration is negative, it is not too big
srawi r0,r7,31 ; -1 if duration is too small
and r7,r7,r2 ; Clear duration if high part too big
and r7,r7,r0 ; Clear duration if low part too big