]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/ppc/thread_status.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / mach / ppc / thread_status.h
index c19acd8c01cc60dab03ae610d87d57f35849a8e7..53abeecdde43b90032a65d9b46d949fbf4c858c9 100644 (file)
@@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 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. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * 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
@@ -20,7 +23,7 @@
  * Please see the License for the specific language governing rights and
  * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
 #ifndef        _MACH_PPC_THREAD_STATUS_H_
 #define _MACH_PPC_THREAD_STATUS_H_
 
-#include <sys/appleapiopts.h>
+#include <mach/ppc/_types.h>
+#include <mach/message.h>
 
-#ifdef MACH_KERNEL_PRIVATE
-#include <ppc/savearea.h>
-#endif
 /*
  * ppc_thread_state is the structure that is exported to user threads for 
  * use in status/mutate calls.  This structure should never change.
          (x == PPC_EXCEPTION_STATE64)   || \
          (x == THREAD_STATE_NONE))
 
-typedef struct ppc_thread_state {
-       unsigned int srr0;      /* Instruction address register (PC) */
-       unsigned int srr1;      /* Machine state register (supervisor) */
-       unsigned int r0;
-       unsigned int r1;
-       unsigned int r2;
-       unsigned int r3;
-       unsigned int r4;
-       unsigned int r5;
-       unsigned int r6;
-       unsigned int r7;
-       unsigned int r8;
-       unsigned int r9;
-       unsigned int r10;
-       unsigned int r11;
-       unsigned int r12;
-       unsigned int r13;
-       unsigned int r14;
-       unsigned int r15;
-       unsigned int r16;
-       unsigned int r17;
-       unsigned int r18;
-       unsigned int r19;
-       unsigned int r20;
-       unsigned int r21;
-       unsigned int r22;
-       unsigned int r23;
-       unsigned int r24;
-       unsigned int r25;
-       unsigned int r26;
-       unsigned int r27;
-       unsigned int r28;
-       unsigned int r29;
-       unsigned int r30;
-       unsigned int r31;
-
-       unsigned int cr;        /* Condition register */
-       unsigned int xer;       /* User's integer exception register */
-       unsigned int lr;        /* Link register */
-       unsigned int ctr;       /* Count register */
-       unsigned int mq;        /* MQ register (601 only) */
-
-       unsigned int vrsave;    /* Vector Save Register */
-} ppc_thread_state_t;
-
-#pragma pack(4)                                                        /* Make sure the structure stays as we defined it */
-typedef struct ppc_thread_state64 {
-       unsigned long long srr0;        /* Instruction address register (PC) */
-       unsigned long long srr1;        /* Machine state register (supervisor) */
-       unsigned long long r0;
-       unsigned long long r1;
-       unsigned long long r2;
-       unsigned long long r3;
-       unsigned long long r4;
-       unsigned long long r5;
-       unsigned long long r6;
-       unsigned long long r7;
-       unsigned long long r8;
-       unsigned long long r9;
-       unsigned long long r10;
-       unsigned long long r11;
-       unsigned long long r12;
-       unsigned long long r13;
-       unsigned long long r14;
-       unsigned long long r15;
-       unsigned long long r16;
-       unsigned long long r17;
-       unsigned long long r18;
-       unsigned long long r19;
-       unsigned long long r20;
-       unsigned long long r21;
-       unsigned long long r22;
-       unsigned long long r23;
-       unsigned long long r24;
-       unsigned long long r25;
-       unsigned long long r26;
-       unsigned long long r27;
-       unsigned long long r28;
-       unsigned long long r29;
-       unsigned long long r30;
-       unsigned long long r31;
-
-       unsigned int cr;                        /* Condition register */
-       unsigned long long xer;         /* User's integer exception register */
-       unsigned long long lr;          /* Link register */
-       unsigned long long ctr;         /* Count register */
-
-       unsigned int vrsave;            /* Vector Save Register */
-} ppc_thread_state64_t;
-#pragma pack()
-
-/* This structure should be double-word aligned for performance */
-
-typedef struct ppc_float_state {
-       double  fpregs[32];
-
-       unsigned int fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */
-       unsigned int fpscr;     /* floating point status register */
-} ppc_float_state_t;
-
-typedef struct ppc_vector_state {
-       unsigned long   save_vr[32][4];
-       unsigned long   save_vscr[4];
-       unsigned int    save_pad5[4];
-       unsigned int    save_vrvalid;                   /* VRs that have been saved */
-       unsigned int    save_pad6[7];
-} ppc_vector_state_t;
+#ifndef _POSIX_C_SOURCE
+typedef struct ppc_thread_state                        ppc_thread_state_t;
+#else /* _POSIX_C_SOURCE */
+typedef struct __darwin_ppc_thread_state       ppc_thread_state_t;
+#endif /* _POSIX_C_SOURCE */
+
+#ifndef _POSIX_C_SOURCE
+typedef struct ppc_thread_state64              ppc_thread_state64_t;
+#endif /* _POSIX_C_SOURCE */
+
+#ifndef _POSIX_C_SOURCE
+typedef struct ppc_float_state                 ppc_float_state_t;
+#else /* _POSIX_C_SOURCE */
+typedef struct __darwin_ppc_float_state                ppc_float_state_t;
+#endif /* _POSIX_C_SOURCE */
+
+#ifndef _POSIX_C_SOURCE
+typedef struct ppc_vector_state                        ppc_vector_state_t;
+#else /* _POSIX_C_SOURCE */
+typedef struct __darwin_ppc_vector_state       ppc_vector_state_t;
+#endif /* _POSIX_C_SOURCE */
 
 /*
  * saved state structure
@@ -179,11 +94,17 @@ typedef struct ppc_vector_state {
  *
  */
 
-#if defined(__APPLE_API_PRIVATE) && defined(MACH_KERNEL_PRIVATE)
-typedef struct savearea ppc_saved_state_t;
-#else
-typedef struct ppc_thread_state ppc_saved_state_t;
-#endif /* __APPLE_API_PRIVATE && MACH_KERNEL_PRIVATE */
+#ifdef MACH__POSIX_C_SOURCE_PRIVATE
+
+#include <ppc/savearea.h>
+
+typedef struct savearea                                ppc_saved_state_t;
+
+#else  /* MACH__POSIX_C_SOURCE_PRIVATE */
+
+typedef struct ppc_thread_state                        ppc_saved_state_t;
+
+#endif /* MACH__POSIX_C_SOURCE_PRIVATE */
 
 /*
  * ppc_exception_state
@@ -198,46 +119,38 @@ typedef struct ppc_thread_state ppc_saved_state_t;
  * compatiblity.
  */
 
-typedef struct ppc_exception_state {
-       unsigned long dar;                      /* Fault registers for coredump */
-       unsigned long dsisr;
-       unsigned long exception;        /* number of powerpc exception taken */
-       unsigned long pad0;                     /* align to 16 bytes */
-
-       unsigned long pad1[4];          /* space in PCB "just in case" */
-} ppc_exception_state_t;
-
-#pragma pack(4)                                        /* Make sure the structure stays as we defined it */
-typedef struct ppc_exception_state64 {
-       unsigned long long dar;         /* Fault registers for coredump */
-       unsigned long dsisr;
-       unsigned long exception;        /* number of powerpc exception taken */
+/* Exception state for 32-bit thread (on 32-bit processor) */
+/* Still available on 64-bit processors, but may fall short */
+/* of covering the full potential state (hi half available). */
 
-       unsigned long pad1[4];          /* space in PCB "just in case" */
-} ppc_exception_state64_t;
-#pragma pack()
+#ifndef _POSIX_C_SOURCE
+typedef struct ppc_exception_state             ppc_exception_state_t;
+typedef struct ppc_exception_state64           ppc_exception_state64_t;
+#else /* _POSIX_C_SOURCE */
+typedef struct __darwin_ppc_exception_state    ppc_exception_state_t;
+#endif /* _POSIX_C_SOURCE */
 
 /*
  * Save State Flags
  */
 
-#define PPC_THREAD_STATE_COUNT \
-   (sizeof(struct ppc_thread_state) / sizeof(int))
+#define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_thread_state_t) / sizeof(int)))
 
-#define PPC_THREAD_STATE64_COUNT \
-   (sizeof(struct ppc_thread_state64) / sizeof(int))
+#define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_thread_state64_t) / sizeof(int)))
 
-#define PPC_EXCEPTION_STATE_COUNT \
-   (sizeof(struct ppc_exception_state) / sizeof(int))
+#define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_exception_state_t) / sizeof(int)))
 
-#define PPC_EXCEPTION_STATE64_COUNT \
-   (sizeof(struct ppc_exception_state64) / sizeof(int))
+#define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_exception_state64_t) / sizeof(int)))
 
-#define PPC_FLOAT_STATE_COUNT \
-   (sizeof(struct ppc_float_state) / sizeof(int))
+#define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_float_state_t) / sizeof(int)))
 
-#define PPC_VECTOR_STATE_COUNT \
-   (sizeof(struct ppc_vector_state) / sizeof(int))
+#define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
+   (sizeof(ppc_vector_state_t) / sizeof(int)))
 
 /*
  * Machine-independent way for servers and Mach's exception mechanism to
@@ -249,6 +162,6 @@ typedef struct ppc_exception_state64 {
 /*
  * Largest state on this machine:
  */
-#define THREAD_MACHINE_STATE_MAX       PPC_VECTOR_STATE_COUNT
+#define THREAD_MACHINE_STATE_MAX       THREAD_STATE_MAX
 
 #endif /* _MACH_PPC_THREAD_STATUS_H_ */