home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / MachineExceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  4.0 KB  |  176 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MachineExceptions.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __MACHINEEXCEPTIONS__
  18. #define __MACHINEEXCEPTIONS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. #if GENERATINGPOWERPC
  31. #pragma options align=power
  32. #endif
  33.  
  34. #ifdef __CFM68K__
  35. #pragma lib_export on
  36. #endif
  37.  
  38. typedef KernelID AreaID;
  39.  
  40. /* Machine Dependent types for PowerPC: */
  41. struct MachineInformationPowerPC {
  42.     UnsignedWide                    CTR;
  43.     UnsignedWide                    LR;
  44.     UnsignedWide                    PC;
  45.     unsigned long                    CR;
  46.     unsigned long                    XER;
  47.     unsigned long                    MSR;
  48. };
  49. typedef struct MachineInformationPowerPC MachineInformationPowerPC;
  50.  
  51. struct RegisterInformationPowerPC {
  52.     UnsignedWide                    R0;
  53.     UnsignedWide                    R1;
  54.     UnsignedWide                    R2;
  55.     UnsignedWide                    R3;
  56.     UnsignedWide                    R4;
  57.     UnsignedWide                    R5;
  58.     UnsignedWide                    R6;
  59.     UnsignedWide                    R7;
  60.     UnsignedWide                    R8;
  61.     UnsignedWide                    R9;
  62.     UnsignedWide                    R10;
  63.     UnsignedWide                    R11;
  64.     UnsignedWide                    R12;
  65.     UnsignedWide                    R13;
  66.     UnsignedWide                    R14;
  67.     UnsignedWide                    R15;
  68.     UnsignedWide                    R16;
  69.     UnsignedWide                    R17;
  70.     UnsignedWide                    R18;
  71.     UnsignedWide                    R19;
  72.     UnsignedWide                    R20;
  73.     UnsignedWide                    R21;
  74.     UnsignedWide                    R22;
  75.     UnsignedWide                    R23;
  76.     UnsignedWide                    R24;
  77.     UnsignedWide                    R25;
  78.     UnsignedWide                    R26;
  79.     UnsignedWide                    R27;
  80.     UnsignedWide                    R28;
  81.     UnsignedWide                    R29;
  82.     UnsignedWide                    R30;
  83.     UnsignedWide                    R31;
  84. };
  85. typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
  86.  
  87. struct FPUInformationPowerPC {
  88.     UnsignedWide                    Registers[32];
  89.     unsigned long                    FPSCR;
  90.     unsigned long                    Reserved;
  91. };
  92. typedef struct FPUInformationPowerPC FPUInformationPowerPC;
  93.  
  94.  
  95. enum {
  96.     writeReference                = 0,
  97.     readReference                = 1,
  98.     fetchReference                = 2
  99. };
  100.  
  101. typedef unsigned long MemoryReferenceKind;
  102.  
  103. struct MemoryExceptionInformation {
  104.     AreaID                            theArea;
  105.     LogicalAddress                    theAddress;
  106.     OSStatus                        theError;
  107.     MemoryReferenceKind                theReference;
  108. };
  109. typedef struct MemoryExceptionInformation MemoryExceptionInformation;
  110.  
  111.  
  112. enum {
  113.     unknownException            = 0,
  114.     illegalInstructionException    = 1,
  115.     trapException                = 2,
  116.     accessException                = 3,
  117.     unmappedMemoryException        = 4,
  118.     excludedMemoryException        = 5,
  119.     readOnlyMemoryException        = 6,
  120.     unresolvablePageFaultException = 7,
  121.     privilegeViolationException    = 8,
  122.     traceException                = 9,
  123.     instructionBreakpointException = 10,
  124.     dataBreakpointException        = 11,
  125.     integerException            = 12,
  126.     floatingPointException        = 13,
  127.     stackOverflowException        = 14,
  128.     terminationException        = 15
  129. };
  130.  
  131. typedef unsigned long ExceptionKind;
  132.  
  133. union ExceptionInfo {
  134.     MemoryExceptionInformation        *memoryInfo;
  135. };
  136. typedef union ExceptionInfo ExceptionInfo;
  137.  
  138. struct ExceptionInformationPowerPC {
  139.     ExceptionKind                    theKind;
  140.     MachineInformationPowerPC        *machineState;
  141.     RegisterInformationPowerPC        *registerImage;
  142.     FPUInformationPowerPC            *FPUImage;
  143.     ExceptionInfo                    info;
  144. };
  145. typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
  146.  
  147. #if GENERATINGPOWERPC
  148. typedef ExceptionInformationPowerPC ExceptionInformation;
  149.  
  150. typedef MachineInformationPowerPC MachineInformation;
  151.  
  152. typedef RegisterInformationPowerPC RegisterInformation;
  153.  
  154. typedef FPUInformationPowerPC FPUInformation;
  155.  
  156. #endif
  157. /* Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  158.             It must be a native function pointer with NO routine descriptor. */
  159. typedef OSStatus (*ExceptionHandler)(ExceptionInformationPowerPC *theException);
  160. /* Routine for installing per-process exception handlers */
  161. extern pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler);
  162.  
  163. #ifdef __CFM68K__
  164. #pragma lib_export off
  165. #endif
  166.  
  167. #if GENERATINGPOWERPC
  168. #pragma options align=reset
  169. #endif
  170.  
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175. #endif /* __MACHINEEXCEPTIONS__ */
  176.