|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: File: PseudoKernelPriv.h
24:
25: Contains: Interfaces for the TruBlue environment's PseudoKernel
26:
27: Copyright: ) 1996-1997 by Apple Computer, Inc., all rights reserved.
28:
29: */
30:
31: #define bbMaxTrap 16
32: #define bbExitTrap 14
33:
34: /* Support firmware PseudoKernel FastTrap architectural extension */
35:
36: #define bbPKTDShift 2 // 4 * ( 1 << shift ) = sizeof(PKTD_t)
37:
38: struct PseudoKernelTrapDescriptor {
39: UInt32 pc; // address of where we want to return to
40: UInt32 reg; // place to save(GPR2) or restore(LR) registers
41: UInt32 msr; // msr FE0, BE, SE and FE1 bits to restore on exit
42: UInt32 newState; // context state when we return
43: };
44: typedef struct PseudoKernelTrapDescriptor PseudoKernelTrapDescriptor;
45: typedef PseudoKernelTrapDescriptor * PseudoKernelTrapDescriptorPtr;
46: typedef PseudoKernelTrapDescriptor PKTD_t;
47:
48: struct BlueBoxData {
49: PKTD_t PKTD[bbMaxTrap];
50: UInt32 InterruptControlWord; // holds context state and backup CR2 bits
51: UInt32 InterruptPendingPC; // PC of where to handle interruptions */
52: UInt32 ihs_pc; // Interrupt Hold State
53: UInt32 ihs_gpr2; // Interrupt Hold State
54: UInt32 testIntMask; // Mask to check for a pending interrupt
55: UInt32 postIntMask; // Mask to post an interrupt
56: };
57: typedef struct BlueBoxData BlueBoxData;
58: typedef BlueBoxData BDA_t;
59:
60: enum {
61: // The following define the UInt32 gInterruptState
62: kInUninitialized = 0, // State not yet initialized
63: kInPseudoKernel = 1, // Currently executing within pseudo kernel
64: kInSystemContext = 2, // Currently executing within the system (emulator) context
65: kInAlternateContext = 3, // Currently executing within an alternate (native) context
66: kInExceptionHandler = 4, // Currently executing an exception handler
67: kOutsideBlue = 5, // Currently executing outside of the Blue thread
68: kNotifyPending = 6, // Pending Notify Interrupt
69:
70: kInterruptStateMask = 0x000F0000, // Mask to extract interrupt state from gInterruptState
71: kInterruptStateShift = 16, // Shift count to align interrupt state
72:
73: kBackupCR2Mask = 0x0000000F, // Mask to extract backup CR2 from gInterruptState
74: kCR2ToBackupShift = 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState
75: // (and vice versa)
76: kCR2Mask = 0x00F00000 // Mask to extract CR2 from the PPC CR register
77: };
78:
79: struct bbRupt {
80: struct ReturnHandler rh; /* Return handler address */
81: unsigned long ruptRtn; /* Interrupt PC */
82: };
83: typedef struct bbRupt bbRupt;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.