2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 File: PseudoKernelPriv.h
25 Contains: Interfaces for Classic environment's PseudoKernel
27 Copyright: (c) 2000 Apple Computer, Inc. All rights reserved.
30 #include <ppc/exception.h>
32 /* Support firmware PseudoKernel FastTrap architectural extension */
34 #define bbMaxTrap (16 * sizeof(long))
35 #define bbRFITrap bbMaxTrap
37 extern int bb_enable_bluebox(struct savearea
*);
38 extern int bb_disable_bluebox(struct savearea
*);
39 extern int bb_settaskenv(struct savearea
*);
41 struct BlueExceptionDataArea
{
42 UInt32 srr0
; // OUT PC at time of exception, IN return address
43 UInt32 srr1
; // OUT/IN msr FE0, BE, SE and FE1 bits to restore on exit
44 UInt32 sprg0
; // OUT R1 set to this value
45 UInt32 sprg1
; // OUT/IN R1 restored to this value
47 typedef struct BlueExceptionDataArea
* BlueExceptionDataAreaPtr
;
48 typedef struct BlueExceptionDataArea BEDA_t
;
51 The Blue Thread, which is running MacOS, needs to be able to handle Traps, SCs and interrupts.
53 struct BlueThreadTrapDescriptor
{
54 UInt32 TrapVector
; // 0=Trap
55 UInt32 SysCallVector
; // 1=SysCall
56 UInt32 InterruptVector
; // 2=Interrupt
57 UInt32 PendingIntVector
; // 3=Pending interrupt
58 BEDA_t exceptionInfo
; // Save registers at time of exception (trap/syscall)
59 UInt32 InterruptControlWord
; // Holds context state and backup CR2 bits
60 UInt32 NewExitState
; // New run state when exiting PseudoKernel
61 UInt32 testIntMask
; // Mask for a pending alternate context interrupt in backup CR2
62 UInt32 postIntMask
; // Mask to post an interrupt
64 typedef struct BlueThreadTrapDescriptor
* BlueThreadTrapDescriptorPtr
;
65 typedef struct BlueThreadTrapDescriptor BTTD_t
;
68 // The following define the UInt32 gInterruptState
69 kInUninitialized
= 0, // State not yet initialized
70 kInPseudoKernel
= 1, // Currently executing within pseudo kernel
71 kInSystemContext
= 2, // Currently executing within the system (emulator) context
72 kInAlternateContext
= 3, // Currently executing within an alternate (native) context
73 kInExceptionHandler
= 4, // Currently executing an exception handler
74 kOutsideBlue
= 5, // Currently executing outside of the Blue thread
75 kNotifyPending
= 6, // Pending Notify Interrupt
77 kInterruptStateMask
= 0x000F0000, // Mask to extract interrupt state from gInterruptState
78 kInterruptStateShift
= 16, // Shift count to align interrupt state
80 kBackupCR2Mask
= 0x0000000F, // Mask to extract backup CR2 from gInterruptState
81 kCR2ToBackupShift
= 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState
83 kCR2Mask
= 0x00F00000 // Mask to extract CR2 from the PPC CR register
87 struct ReturnHandler rh
; /* Return handler address */
89 typedef struct bbRupt bbRupt
;