]>
Commit | Line | Data |
---|---|---|
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 Classic environment's PseudoKernel | |
26 | ||
27 | Copyright: (c) 2000 Apple Computer, Inc. All rights reserved. | |
28 | */ | |
29 | ||
30 | #include <libkern/OSTypes.h> | |
31 | ||
32 | #include <ppc/exception.h> | |
33 | ||
34 | /* Support firmware PseudoKernel FastTrap architectural extension */ | |
35 | ||
36 | #define bbMaxTrap (16 * sizeof(long)) | |
37 | #define bbRFITrap bbMaxTrap | |
38 | ||
39 | extern int bb_enable_bluebox(struct savearea *); | |
40 | extern int bb_disable_bluebox(struct savearea *); | |
41 | extern int bb_settaskenv(struct savearea *); | |
42 | ||
43 | struct BlueExceptionDataArea { | |
44 | UInt32 srr0; // OUT PC at time of exception, IN return address | |
45 | UInt32 srr1; // OUT/IN msr FE0, BE, SE and FE1 bits to restore on exit | |
46 | UInt32 sprg0; // OUT R1 set to this value | |
47 | UInt32 sprg1; // OUT/IN R1 restored to this value | |
48 | }; | |
49 | typedef struct BlueExceptionDataArea * BlueExceptionDataAreaPtr; | |
50 | typedef struct BlueExceptionDataArea BEDA_t; | |
51 | ||
52 | /* | |
53 | The Blue Thread, which is running MacOS, needs to be able to handle Traps, SCs and interrupts. | |
54 | */ | |
55 | struct BlueThreadTrapDescriptor { | |
56 | UInt32 TrapVector; // 0=Trap | |
57 | UInt32 SysCallVector; // 1=SysCall | |
58 | UInt32 InterruptVector; // 2=Interrupt | |
59 | UInt32 PendingIntVector; // 3=Pending interrupt | |
60 | BEDA_t exceptionInfo; // Save registers at time of exception (trap/syscall) | |
61 | UInt32 InterruptControlWord; // Holds context state and backup CR2 bits | |
62 | UInt32 NewExitState; // New run state when exiting PseudoKernel | |
63 | UInt32 testIntMask; // Mask for a pending alternate context interrupt in backup CR2 | |
64 | UInt32 postIntMask; // Mask to post an interrupt | |
65 | }; | |
66 | typedef struct BlueThreadTrapDescriptor * BlueThreadTrapDescriptorPtr; | |
67 | typedef struct BlueThreadTrapDescriptor BTTD_t; | |
68 | ||
69 | enum { | |
70 | // The following define the UInt32 gInterruptState | |
71 | kInUninitialized = 0, // State not yet initialized | |
72 | kInPseudoKernel = 1, // Currently executing within pseudo kernel | |
73 | kInSystemContext = 2, // Currently executing within the system (emulator) context | |
74 | kInAlternateContext = 3, // Currently executing within an alternate (native) context | |
75 | kInExceptionHandler = 4, // Currently executing an exception handler | |
76 | kOutsideBlue = 5, // Currently executing outside of the Blue thread | |
77 | kNotifyPending = 6, // Pending Notify Interrupt | |
78 | ||
79 | kInterruptStateMask = 0x000F0000, // Mask to extract interrupt state from gInterruptState | |
80 | kInterruptStateShift = 16, // Shift count to align interrupt state | |
81 | ||
82 | kBackupCR2Mask = 0x0000000F, // Mask to extract backup CR2 from gInterruptState | |
83 | kCR2ToBackupShift = 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState | |
84 | // (and vice versa) | |
85 | kCR2Mask = 0x00F00000 // Mask to extract CR2 from the PPC CR register | |
86 | }; | |
87 | ||
88 | struct bbRupt { | |
89 | struct ReturnHandler rh; /* Return handler address */ | |
90 | }; | |
91 | typedef struct bbRupt bbRupt; |