Changeset 13599


Ignore:
Timestamp:
Apr 11, 2010, 9:20:24 AM (9 years ago)
Author:
gb
Message:

Move platform-specific definitions to platform-specific header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/lisptypes.h

    r13207 r13599  
    1919#define __lisptypes__
    2020
    21 #include <sys/types.h>
    22 #define WORD_SIZE 32
    23 #ifdef PPC64
    24 #undef WORD_SIZE
    25 #define WORD_SIZE 64
    26 #endif
    27 #ifdef X8664
    28 #undef WORD_SIZE
    29 #define WORD_SIZE 64
    30 #endif
    31 
    32 
    33 #ifdef WINDOWS
    34 #include <windows.h>
    35 typedef long long s64_t;
    36 typedef unsigned long long u64_t;
    37 typedef signed long s32_t;
    38 typedef unsigned long u32_t;
    39 typedef signed short s16_t;
    40 typedef unsigned short u16_t;
    41 typedef signed char s8_t;
    42 typedef unsigned char u8_t;
    43 #else
    44 
    45 #include <stdint.h>
    46 
    47 #ifdef SOLARIS
    48 /* Solaris doesn't laugh and play like the other children */
    49 typedef int64_t s64_t;
    50 typedef uint64_t u64_t;
    51 typedef int32_t s32_t;
    52 typedef uint32_t u32_t;
    53 typedef int16_t s16_t;
    54 typedef uint16_t u16_t;
    55 typedef int8_t s8_t;
    56 typedef uint8_t u8_t;
    57 #else
    58 typedef int64_t s64_t;
    59 typedef u_int64_t u64_t;
    60 typedef int32_t s32_t;
    61 typedef u_int32_t u32_t;
    62 typedef int16_t s16_t;
    63 typedef u_int16_t u16_t;
    64 typedef int8_t s8_t;
    65 typedef u_int8_t u8_t;
    66 #endif
    67 #endif
    6821
    6922#if WORD_SIZE == 64
     
    7932#endif
    8033
    81 
    82 #ifdef DARWIN
    83 #include <sys/signal.h>
    84 #include <sys/ucontext.h>
    85 #include <AvailabilityMacros.h>
    86 
    87 #ifdef PPC
    88 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
    89 #define __ss ss
    90 #define __es es
    91 #define __fs fs
    92 
    93 #define __srr0 srr0
    94 #define __srr1 srr1
    95 #define __r0 r0
    96 #define __r1 r1
    97 #define __r3 r3
    98 #define __r4 r4
    99 #define __r5 r5
    100 #define __r6 r6
    101 #define __r13 r13
    102 #define __cr cr
    103 #define __xer xer
    104 #define __lr lr
    105 #define __ctr ctr
    106 
    107 #define __dar dar
    108 #define __dsisr dsisr
    109 #define __exception exception
    110 
    111 #define __fpregs fpregs
    112 #define __fpscr fpscr
    113 #endif
    114 
    115 #if WORD_SIZE == 64
    116 #ifdef _STRUCT_UCONTEXT64
    117 typedef _STRUCT_UCONTEXT64 ExceptionInformation;
    118 typedef _STRUCT_MCONTEXT64 *MCONTEXT_T;
    119 #else /* _STRUCT_UCONTEXT64 */
    120 typedef struct ucontext64 ExceptionInformation;
    121 typedef struct mcontext64 *MCONTEXT_T;
    122 #endif /* _STRUCT_UCONTEXT64 */
    123 #define UC_MCONTEXT(UC) UC->uc_mcontext64
    124 #else /* WORD_SIZE */
    125 #ifdef _STRUCT_UCONTEXT
    126 typedef _STRUCT_UCONTEXT ExceptionInformation;
    127 typedef _STRUCT_MCONTEXT *MCONTEXT_T;
    128 #else
    129 typedef struct ucontext ExceptionInformation;
    130 typedef struct mcontext *MCONTEXT_T;
    131 #endif
    132 #define UC_MCONTEXT(UC) UC->uc_mcontext
    133 #endif /* WORD_SIZE */
    134 
    135 
    136 
    137 #endif /* PPC */
    138 
    139 #ifdef X8664
    140 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
    141 /* Broken <i386/ucontext.h> in Mac OS 10.4u SDK */
    142 struct mcontext64 {
    143         x86_exception_state64_t __es;
    144         x86_thread_state64_t    __ss;   
    145         x86_float_state64_t     __fs;
    146 };
    147 
    148 typedef struct mcontext64 *MCONTEXT_T;
    149 typedef ucontext64_t ExceptionInformation;
    150 #define UC_MCONTEXT(UC) UC->uc_mcontext64
    151 #define __rax rax
    152 #define __fpu_mxcsr fpu_mxcsr
    153 #define __fpu_xmm0 fpu_xmm0
    154 #define __rsp rsp
    155 #define __trapno trapno
    156 #define __faultvaddr faultvaddr
    157 #define __err err
    158 #define __rip rip
    159 #define __rsi rsi
    160 #define __rdi rdi
    161 #define __rdx rdx
    162 #define __rcx rcx
    163 #define __r8 r8
    164 #define __rflags rflags
    165 #else /* post-10.4 */
    166 typedef mcontext_t MCONTEXT_T;
    167 typedef ucontext_t ExceptionInformation;
    168 #define UC_MCONTEXT(UC) UC->uc_mcontext
    169 #endif
    170 #endif
    171 
    172 #ifdef X8632
    173 /* Assume rational <i386/ucontext.h> */
    174 /* Sadly, we can't make that assumption, since Apple renamed things
    175    for Leopard. Yow!  Are we standards-compliant yet ? */
    176 /* In the long term, we probably want to use the leopard-compliant
    177    names (with leading __ prefixes).  In the shorter term, we want
    178    kernels compiled on Leopard to run on Tiger (and not reference
    179    foo$UNIX2003 and similar nonsense, and that means getting the old
    180    names (without leading __ prefixes.)  Confused yet ? */
    181 
    182 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
    183 #define __ss ss
    184 #define __ds ds
    185 #define __es es
    186 #define __cs cs
    187 #define __fs fs
    188 #define __gs gs
    189 #define __eax eax
    190 #define __esp esp
    191 #define __eip eip
    192 #define __eflags eflags
    193 #define __fpu_xmm0 fpu_xmm0
    194 #define __fpu_mxcsr fpu_mxcsr
    195 #define __fpu_stmm0 fpu_stmm0
    196 #define __trapno trapno
    197 #define __err err
    198 #define __faultvaddr faultvaddr
    199 #endif
    200 
    201 #define UC_MCONTEXT(UC) UC->uc_mcontext
    202 typedef mcontext_t MCONTEXT_T;
    203 typedef ucontext_t ExceptionInformation;
    204 #endif
    205 
    206 #endif /* #ifdef DARWIN */
    207 
    208 #ifdef LINUX
    209 typedef struct ucontext ExceptionInformation;
    210 #endif
    211 
    212 #ifdef FREEBSD
    213 typedef struct __ucontext ExceptionInformation;
    214 #endif
    215 
    216 #ifdef SOLARIS
    217 typedef struct ucontext ExceptionInformation;
    218 #endif
    219 
    220 #ifdef WINDOWS
    221 typedef CONTEXT ExceptionInformation;
    222 #endif
    22334
    22435typedef u32_t lisp_char_code;
Note: See TracChangeset for help on using the changeset viewer.