/* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* File: PseudoKernelPriv.h Contains: Interfaces for Classic environment's PseudoKernel Copyright: (c) 2000 Apple Computer, Inc. All rights reserved. */ #include #include /* Support firmware PseudoKernel FastTrap architectural extension */ #define bbMaxTrap (16 * sizeof(long)) #define bbRFITrap bbMaxTrap extern int bb_enable_bluebox(struct savearea *); extern int bb_disable_bluebox(struct savearea *); extern int bb_settaskenv(struct savearea *); kern_return_t syscall_notify_interrupt(void); struct BlueExceptionDataArea { UInt32 srr0; // OUT PC at time of exception, IN return address UInt32 srr1; // OUT/IN msr FE0, BE, SE and FE1 bits to restore on exit UInt32 sprg0; // OUT R1 set to this value UInt32 sprg1; // OUT/IN R1 restored to this value }; typedef struct BlueExceptionDataArea * BlueExceptionDataAreaPtr; typedef struct BlueExceptionDataArea BEDA_t; /* The Blue Thread, which is running MacOS, needs to be able to handle Traps, SCs and interrupts. */ struct BlueThreadTrapDescriptor { UInt32 TrapVector; // 0=Trap UInt32 SysCallVector; // 1=SysCall UInt32 InterruptVector; // 2=Interrupt UInt32 PendingIntVector; // 3=Pending interrupt BEDA_t exceptionInfo; // Save registers at time of exception (trap/syscall) UInt32 InterruptControlWord; // Holds context state and backup CR2 bits UInt32 NewExitState; // New run state when exiting PseudoKernel UInt32 testIntMask; // Mask for a pending alternate context interrupt in backup CR2 UInt32 postIntMask; // Mask to post an interrupt }; typedef struct BlueThreadTrapDescriptor * BlueThreadTrapDescriptorPtr; typedef struct BlueThreadTrapDescriptor BTTD_t; enum { // The following define the UInt32 gInterruptState kInUninitialized = 0, // State not yet initialized kInPseudoKernel = 1, // Currently executing within pseudo kernel kInSystemContext = 2, // Currently executing within the system (emulator) context kInAlternateContext = 3, // Currently executing within an alternate (native) context kInExceptionHandler = 4, // Currently executing an exception handler kOutsideBlue = 5, // Currently executing outside of the Blue thread kNotifyPending = 6, // Pending Notify Interrupt kInterruptStateMask = 0x000F0000, // Mask to extract interrupt state from gInterruptState kInterruptStateShift = 16, // Shift count to align interrupt state kBackupCR2Mask = 0x0000000F, // Mask to extract backup CR2 from gInterruptState kCR2ToBackupShift = 31-11, // Shift count to align CR2 into the backup CR2 of gInterruptState // (and vice versa) kCR2Mask = 0x00F00000 // Mask to extract CR2 from the PPC CR register }; struct bbRupt { struct ReturnHandler rh; /* Return handler address */ }; typedef struct bbRupt bbRupt;