1/* 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28/* 29 * @OSF_COPYRIGHT@ 30 */ 31 32#ifndef _MACH_PPC_THREAD_STATUS_H_ 33#define _MACH_PPC_THREAD_STATUS_H_ 34 35#include <mach/ppc/_structs.h> 36#include <mach/message.h> 37 38/* 39 * ppc_thread_state is the structure that is exported to user threads for 40 * use in status/mutate calls. This structure should never change. 41 * 42 */ 43 44#define PPC_THREAD_STATE 1 45#define PPC_FLOAT_STATE 2 46#define PPC_EXCEPTION_STATE 3 47#define PPC_VECTOR_STATE 4 48#define PPC_THREAD_STATE64 5 49#define PPC_EXCEPTION_STATE64 6 50#define THREAD_STATE_NONE 7 51 52/* 53 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed 54 * an exception flavor will return whether that is a defined flavor for 55 * that platform. 56 * The macro must be manually updated to include all of the valid exception 57 * flavors as defined above. 58 */ 59#define VALID_THREAD_STATE_FLAVOR(x) \ 60 ((x == PPC_THREAD_STATE) || \ 61 (x == PPC_FLOAT_STATE) || \ 62 (x == PPC_EXCEPTION_STATE) || \ 63 (x == PPC_VECTOR_STATE) || \ 64 (x == PPC_THREAD_STATE64) || \ 65 (x == PPC_EXCEPTION_STATE64) || \ 66 (x == THREAD_STATE_NONE)) 67 68typedef _STRUCT_PPC_THREAD_STATE ppc_thread_state_t; 69#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 70typedef _STRUCT_PPC_THREAD_STATE64 ppc_thread_state64_t; 71#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 72typedef _STRUCT_PPC_FLOAT_STATE ppc_float_state_t; 73typedef _STRUCT_PPC_VECTOR_STATE ppc_vector_state_t; 74 75/* 76 * saved state structure 77 * 78 * This structure corresponds to the saved state. 79 * 80 */ 81 82#ifdef MACH__POSIX_C_SOURCE_PRIVATE 83 84#include <ppc/savearea.h> 85 86typedef struct savearea ppc_saved_state_t; 87 88#else /* MACH__POSIX_C_SOURCE_PRIVATE */ 89 90typedef struct ppc_thread_state ppc_saved_state_t; 91 92#endif /* MACH__POSIX_C_SOURCE_PRIVATE */ 93 94/* 95 * ppc_exception_state 96 * 97 * This structure corresponds to some additional state of the user 98 * registers as saved in the PCB upon kernel entry. They are only 99 * available if an exception is passed out of the kernel, and even 100 * then not all are guaranteed to be updated. 101 * 102 * Some padding is included in this structure which allows space for 103 * servers to store temporary values if need be, to maintain binary 104 * compatiblity. 105 */ 106 107/* Exception state for 32-bit thread (on 32-bit processor) */ 108/* Still available on 64-bit processors, but may fall short */ 109/* of covering the full potential state (hi half available). */ 110 111typedef _STRUCT_PPC_EXCEPTION_STATE ppc_exception_state_t; 112#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 113typedef _STRUCT_PPC_EXCEPTION_STATE64 ppc_exception_state64_t; 114#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 115 116/* 117 * Save State Flags 118 */ 119 120#define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ 121 (sizeof(ppc_thread_state_t) / sizeof(int))) 122 123#define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ 124 (sizeof(ppc_thread_state64_t) / sizeof(int))) 125 126#define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \ 127 (sizeof(ppc_exception_state_t) / sizeof(int))) 128 129#define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \ 130 (sizeof(ppc_exception_state64_t) / sizeof(int))) 131 132#define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \ 133 (sizeof(ppc_float_state_t) / sizeof(int))) 134 135#define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \ 136 (sizeof(ppc_vector_state_t) / sizeof(int))) 137 138/* 139 * Machine-independent way for servers and Mach's exception mechanism to 140 * choose the most efficient state flavor for exception RPC's: 141 */ 142#define MACHINE_THREAD_STATE PPC_THREAD_STATE 143#define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT 144 145/* 146 * Largest state on this machine: 147 */ 148#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX 149 150#endif /* _MACH_PPC_THREAD_STATUS_H_ */ 151