]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. | |
7 | * | |
8 | * This file contains Original Code and/or Modifications of Original Code | |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
22 | * | |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | typedef unsigned char UInt8; | |
26 | typedef unsigned short UInt16; | |
27 | typedef unsigned long UInt32; | |
28 | ||
29 | ||
30 | /* Support firmware CallPseudoKernel architectural extension */ | |
31 | ||
32 | struct CallPseudoKernelDescriptor { | |
33 | UInt32 pc; | |
34 | UInt32 gpr0; | |
35 | UInt32 intControlAddr; | |
36 | UInt32 newState; | |
37 | UInt32 intStateMask; | |
38 | UInt32 intCR2Mask; | |
39 | UInt32 intCR2Shift; | |
40 | UInt32 sysContextState; | |
41 | }; | |
42 | typedef struct CallPseudoKernelDescriptor CallPseudoKernelDescriptor; | |
43 | typedef CallPseudoKernelDescriptor * CallPseudoKernelDescriptorPtr; | |
44 | typedef CallPseudoKernelDescriptor CPKD_t; | |
45 | ||
46 | ||
47 | ||
48 | /* Support firmware ExitPseudoKernel architectural extension */ | |
49 | ||
50 | struct ExitPseudoKernelDescriptor { | |
51 | UInt32 pc; | |
52 | UInt32 sp; | |
53 | UInt32 gpr0; | |
54 | UInt32 gpr3; | |
55 | UInt32 cr; | |
56 | UInt32 intControlAddr; | |
57 | UInt32 newState; | |
58 | UInt32 intStateMask; | |
59 | UInt32 intCR2Mask; | |
60 | UInt32 intCR2Shift; | |
61 | UInt32 sysContextState; | |
62 | UInt32 intPendingMask; | |
63 | UInt32 intPendingPC; | |
64 | UInt32 msrUpdate; | |
65 | }; | |
66 | typedef struct ExitPseudoKernelDescriptor ExitPseudoKernelDescriptor; | |
67 | typedef ExitPseudoKernelDescriptor * ExitPseudoKernelDescriptorPtr; | |
68 | typedef ExitPseudoKernelDescriptor EPKD_t; | |
69 | ||
70 | ||
71 | struct EmulatorDescriptor { | |
72 | UInt8 regMap[16]; // table mapping 68K D0..D7, A0..A7 register to PowerPC registers | |
73 | UInt32 bootstrapVersionOffset; // offset within emulator data page of the bootstrap version string | |
74 | UInt32 ecbOffset; // offset within emulator data page of the ECB | |
75 | UInt32 intModeLevelOffset; // offset within emulator data page of the interrupt mode level | |
76 | UInt32 entryAddress; // offset within text of the emulator's main entry point | |
77 | UInt32 kcallTrapTableOffset; // offset within text of the nanokernel(!) call trap table | |
78 | UInt32 postIntMask; // post interrupt mask | |
79 | UInt32 clearIntMask; // clear interrupt mask | |
80 | UInt32 testIntMask; // test interrupt mask | |
81 | UInt32 codeSize; // total size of emulator object code (interpretive + DR) | |
82 | UInt32 hashTableSize; // size of DR emulator's hash table | |
83 | UInt32 drCodeStartOffset; // offset within text of the DR emulator's object code | |
84 | UInt32 drInitOffset; // offset within DR emulator of its initialization entry point | |
85 | UInt32 drAllocateCache; // offset within DR emulator of its cache allocation entry point | |
86 | UInt32 dispatchTableOffset; // offset within text of the encoded instruction dispatch table | |
87 | }; | |
88 | typedef struct EmulatorDescriptor EmulatorDescriptor; | |
89 | typedef EmulatorDescriptor *EmulatorDescriptorPtr; | |
90 | ||
91 | ||
92 | enum { | |
93 | // The following define the UInt32 gInterruptState | |
94 | kInUninitialized = 0, // State not yet initialized | |
95 | kInPseudoKernel = 1, // Currently executing within pseudo kernel | |
96 | kInSystemContext = 2, // Currently executing within the system (emulator) context | |
97 | kInAlternateContext = 3, // Currently executing within an alternate (native) context | |
98 | kInExceptionHandler = 4, // Currently executing an exception handler | |
99 | kOutsideMain = 5, // Currently executing outside of the main thread | |
100 | kNotifyPending = 6, // Pending Notify Interrupt | |
101 | ||
102 | kInterruptStateMask = 0x000F0000, // Mask to extract interrupt state from gInterruptState | |
103 | kInterruptStateShift = 16, // Shift count to align interrupt state | |
104 | ||
105 | kBackupCR2Mask = 0x0000000F, // Mask to extract backup CR2 from gInterruptState | |
106 | kCR2ToBackupShift = 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState | |
107 | // (and vice versa) | |
108 | kCR2Mask = 0x00F00000 // Mask to extract CR2 from the PPC CR register | |
109 | }; | |
110 | ||
111 | ||
112 | enum { | |
113 | kcReturnFromException = 0, | |
114 | kcRunAlternateContext = 1, | |
115 | kcResetSystem = 2, | |
116 | kcVMDispatch = 3, | |
117 | kcPrioritizeInterrupts = 4, | |
118 | kcPowerDispatch = 5, | |
119 | kcRTASDispatch = 6, | |
120 | kcGetAdapterProcPtrsPPC = 12, | |
121 | kcGetAdapterProcPtrs = 13, | |
122 | kcCallAdapterProc = 14, | |
123 | kcSystemCrash = 15 | |
124 | }; | |
125 | ||
126 | #define bbMaxCode 16 | |
127 |