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@
22 typedef unsigned char UInt8
;
23 typedef unsigned short UInt16
;
24 typedef unsigned long UInt32
;
27 /* Support firmware CallPseudoKernel architectural extension */
29 struct CallPseudoKernelDescriptor
{
32 UInt32 intControlAddr
;
37 UInt32 sysContextState
;
39 typedef struct CallPseudoKernelDescriptor CallPseudoKernelDescriptor
;
40 typedef CallPseudoKernelDescriptor
* CallPseudoKernelDescriptorPtr
;
41 typedef CallPseudoKernelDescriptor CPKD_t
;
45 /* Support firmware ExitPseudoKernel architectural extension */
47 struct ExitPseudoKernelDescriptor
{
53 UInt32 intControlAddr
;
58 UInt32 sysContextState
;
59 UInt32 intPendingMask
;
63 typedef struct ExitPseudoKernelDescriptor ExitPseudoKernelDescriptor
;
64 typedef ExitPseudoKernelDescriptor
* ExitPseudoKernelDescriptorPtr
;
65 typedef ExitPseudoKernelDescriptor EPKD_t
;
68 struct EmulatorDescriptor
{
69 UInt8 regMap
[16]; // table mapping 68K D0..D7, A0..A7 register to PowerPC registers
70 UInt32 bootstrapVersionOffset
; // offset within emulator data page of the bootstrap version string
71 UInt32 ecbOffset
; // offset within emulator data page of the ECB
72 UInt32 intModeLevelOffset
; // offset within emulator data page of the interrupt mode level
73 UInt32 entryAddress
; // offset within text of the emulator's main entry point
74 UInt32 kcallTrapTableOffset
; // offset within text of the nanokernel(!) call trap table
75 UInt32 postIntMask
; // post interrupt mask
76 UInt32 clearIntMask
; // clear interrupt mask
77 UInt32 testIntMask
; // test interrupt mask
78 UInt32 codeSize
; // total size of emulator object code (interpretive + DR)
79 UInt32 hashTableSize
; // size of DR emulator's hash table
80 UInt32 drCodeStartOffset
; // offset within text of the DR emulator's object code
81 UInt32 drInitOffset
; // offset within DR emulator of its initialization entry point
82 UInt32 drAllocateCache
; // offset within DR emulator of its cache allocation entry point
83 UInt32 dispatchTableOffset
; // offset within text of the encoded instruction dispatch table
85 typedef struct EmulatorDescriptor EmulatorDescriptor
;
86 typedef EmulatorDescriptor
*EmulatorDescriptorPtr
;
90 // The following define the UInt32 gInterruptState
91 kInUninitialized
= 0, // State not yet initialized
92 kInPseudoKernel
= 1, // Currently executing within pseudo kernel
93 kInSystemContext
= 2, // Currently executing within the system (emulator) context
94 kInAlternateContext
= 3, // Currently executing within an alternate (native) context
95 kInExceptionHandler
= 4, // Currently executing an exception handler
96 kOutsideMain
= 5, // Currently executing outside of the main thread
97 kNotifyPending
= 6, // Pending Notify Interrupt
99 kInterruptStateMask
= 0x000F0000, // Mask to extract interrupt state from gInterruptState
100 kInterruptStateShift
= 16, // Shift count to align interrupt state
102 kBackupCR2Mask
= 0x0000000F, // Mask to extract backup CR2 from gInterruptState
103 kCR2ToBackupShift
= 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState
105 kCR2Mask
= 0x00F00000 // Mask to extract CR2 from the PPC CR register
110 kcReturnFromException
= 0,
111 kcRunAlternateContext
= 1,
114 kcPrioritizeInterrupts
= 4,
117 kcGetAdapterProcPtrsPPC
= 12,
118 kcGetAdapterProcPtrs
= 13,
119 kcCallAdapterProc
= 14,