*
* @APPLE_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.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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. 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@
*/
ENTRY(atomic_switch_syscall, TAG_NO_FRAME_USED)
/*
- * Here's where we check for special Blue Box fast traps
- * If we don't recognize the syscall, we'll go back to regular processing
+ * Note: the BlueBox fast path system calls (-1 and -2) we handled as
+ * an ultra-fast trap in lowmem_vectors.
*/
- cmpwi r0,-1 ; Is it NKIsPreemptiveTask
- beq- isBBpretask ; It is a fast syscall...
- cmpwi r0,-2 ; Is it kcNKIsPreemptiveTaskEnv
- bne- nofastSC ; Not a fast syscall...
-
- ; kcNKIsPreemptiveTaskEnv return task.taskEnv in r0
-
- lwz r23, ACT_MACT_BTE(r13) ; Get the taskEnv
- stw r23, saver0(r4) ; Return the taskEnv in R0
-
-isBBpretask: ; answer the question is this a preemptive task ?
- rlwinm r6,r26,0,0,19 ; Start of page is bttd
- lwz r1,BTTD_INTERRUPT_VECTOR(r6) ; Get interrupt vector
- lwz r6, savecr(r4) ; Get the current CCRs
- cmpwi r1,0 ; Is this a preemptive thread ?
- rlwinm r6,r6,0,cr0_eq+1,cr0_eq-1 ; Clear CR0 EQ bit
- bne notpretask ; Only the cooperative thread has an interrupt vector
- oris r6,r6,(0x8000 >> cr0_eq) ; Set CR0[eq] if task is preemptive.
-notpretask:
- stw r6, savecr(r4) ; Save the new current CCRs
-
- b EXT(fastexit) ; Take the fast path exit...
-
-nofastSC:
li r5, BTTD_SYSCALL_VECTOR
b .L_CallPseudoKernel
li r5, BTTD_TRAP_VECTOR
+ cmplwi r24,0x3C ; (BRINGUP)
+ bne .L_CallPseudoKernel ; (BRINGUP)
+ nop ; (BRINGUP)
+
/******************************************************************************
* void CallPseudoKernel ( int vector, thread_act_t * act, BEDA_t * beda, savearea *sv )
*
.L_CallPseudoKernel:
+ mfsprg r2,0 ; Get the per_proc
rlwinm r6,r26,0,0,19 ; Start of page is bttd
lwz r7,ACT_MACT_SPF(r13) ; Get special flags
lwz r1,BTTD_INTERRUPT_VECTOR(r6) ; Get interrupt vector
lwz r8,BTTD_INTCONTROLWORD(r6) ; Get Interrupt Control Word
cmpwi r1,0 ; Is this a preemptive thread ?
stw r7,ACT_MACT_SPF(r13) ; Update special flags
+ stw r7,spcFlags(r2) ; Update per_proc version
beq .L_CallFromPreemptiveThread ; No int vector means preemptive thread
rlwinm r1,r8,0,INTSTATEMASK_B,INTSTATEMASK_E
.L_CallFromPreemptiveThread:
- lwz r1,savesrr0(r4) ; Get current PC
- lwz r2,saver1(r4) ; Get current R1
- lwz r3,savesrr1(r4) ; Get current MSR
+ lwz r1,savesrr0+4(r4) ; Get current PC
+ lwz r2,saver1+4(r4) ; Get current R1
+ lwz r3,savesrr1+4(r4) ; Get current MSR
stw r1,BEDA_SRR0(r26) ; Save current PC
rlwinm r3,r3,0,MSR_BE_BIT+1,MSR_SE_BIT-1
; Clear SE|BE bits in MSR
stw r2,BEDA_SPRG1(r26) ; Save current R1
- stw r3,savesrr1(r4) ; Load new MSR
+ stw r3,savesrr1+4(r4) ; Load new MSR
lwz r1,BEDA_SPRG0(r26) ; Get replacement R1
lwzx r2,r5,r6 ; Load vector address
stw r3,BEDA_SRR1(r26) ; Update saved MSR
- stw r1,saver1(r4) ; Load up new R1
- stw r2,savesrr0(r4) ; Save vector as PC
+ stw r1,saver1+4(r4) ; Load up new R1
+ stw r2,savesrr0+4(r4) ; Save vector as PC
b EXT(fastexit) ; Go back and take the fast path exit...
lwz r7,ACT_MACT_SPF(r13) ; Get special flags
lwz r2,BTTD_INTERRUPT_VECTOR(r6) ; Get the interrupt vector
lwz r1,BEDA_SPRG1(r26) ; Get saved CTR
- oris r7,r7,(0x8000 >> bbNoMachSCbit) ; Disable Mach SCs for Blue Box
+ ori r7,r7,(0x8000 >> (bbNoMachSCbit - 16)) ; Disable Mach SCs for Blue Box
cmpwi r2,0 ; Is this a preemptive thread
- stw r1,savectr(r4) ; Update CTR
+ stw r1,savectr+4(r4) ; Update CTR
beq .L_ExitFromPreemptiveThread
lwz r8,BTTD_INTCONTROLWORD(r6) ; Get ICW
beq cr1,.L_ExitToSystemContext ; We are in system context
beq .L_ExitUpdateRuptControlWord ; We do not have a pending interrupt
- lwz r2,saver1(r4) ; Get current R1
+ lwz r2,saver1+4(r4) ; Get current R1
lwz r1,BEDA_SPRG0(r26) ; Get replacement R1
stw r2,BEDA_SPRG1(r26) ; Save current R1
- stw r1,saver1(r4) ; Load up new R1
+ stw r1,saver1+4(r4) ; Load up new R1
lwz r3,BTTD_PENDINGINT_VECTOR(r6) ; Get pending interrupt PC
b .L_ExitAbortExit ; Abort and Exit
stw r1,savecr(r4) ; Update CR
.L_ExitFromPreemptiveThread:
- lwz r2,savesrr1(r4) ; Get current MSR
+ mfsprg r3,0 ; Get the per_proc
+ lwz r2,savesrr1+4(r4) ; Get current MSR
lwz r1,BEDA_SRR1(r26) ; Get new MSR
stw r7,ACT_MACT_SPF(r13) ; Update special flags
+ stw r7,spcFlags(r3) ; Update per_proc version
rlwimi r2,r1,0,MSR_FE0_BIT,MSR_FE1_BIT
; Insert FE0,FE1,SE,BE bits
lwz r3,BEDA_SRR0(r26) ; Get new PC
- stw r2,savesrr1(r4) ; Update MSR
+ stw r2,savesrr1+4(r4) ; Update MSR
.L_ExitAbortExit:
- stw r3,savesrr0(r4) ; Update PC
+ stw r3,savesrr0+4(r4) ; Update PC
b EXT(fastexit) ; Go back and take the fast path exit...