source: trunk/source/lisp-kernel/lisptypes.h @ 13206

Last change on this file since 13206 was 13206, checked in by rme, 10 years ago

Changes to allow the Dawrin/x86 lisp kernels to build with the 10.5 SDK.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/*
2   Copyright (C) 2009 Clozure Associates
3   Copyright (C) 1994-2001 Digitool, Inc
4   This file is part of Clozure CL. 
5
6   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7   License , known as the LLGPL and distributed with Clozure CL as the
8   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9   which is distributed with Clozure CL as the file "LGPL".  Where these
10   conflict, the preamble takes precedence. 
11
12   Clozure CL is referenced in the preamble as the "LIBRARY."
13
14   The LLGPL is also available online at
15   http://opensource.franz.com/preamble.html
16*/
17
18#ifndef __lisptypes__
19#define __lisptypes__
20
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>
35typedef long long s64_t;
36typedef unsigned long long u64_t;
37typedef signed long s32_t;
38typedef unsigned long u32_t;
39typedef signed short s16_t;
40typedef unsigned short u16_t;
41typedef signed char s8_t;
42typedef 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 */
49typedef int64_t s64_t;
50typedef uint64_t u64_t;
51typedef int32_t s32_t;
52typedef uint32_t u32_t;
53typedef int16_t s16_t;
54typedef uint16_t u16_t;
55typedef int8_t s8_t;
56typedef uint8_t u8_t;
57#else
58typedef int64_t s64_t;
59typedef u_int64_t u64_t;
60typedef int32_t s32_t;
61typedef u_int32_t u32_t;
62typedef int16_t s16_t;
63typedef u_int16_t u16_t;
64typedef int8_t s8_t;
65typedef u_int8_t u8_t;
66#endif
67#endif
68
69#if WORD_SIZE == 64
70typedef u64_t LispObj;
71typedef u64_t natural;
72typedef s64_t signed_natural;
73typedef u64_t unsigned_of_pointer_size;
74#else
75typedef u32_t LispObj;
76typedef u32_t natural;
77typedef s32_t signed_natural;
78typedef u32_t unsigned_of_pointer_size;
79#endif
80
81
82#ifdef DARWIN
83#include <sys/signal.h>
84#include <sys/ucontext.h>
85#include <AvailabilityMacros.h>
86
87#ifdef PPC
88#if WORD_SIZE == 64
89#ifdef _STRUCT_UCONTEXT64
90typedef _STRUCT_UCONTEXT64 ExceptionInformation;
91typedef _STRUCT_MCONTEXT64 *MCONTEXT_T;
92#else /* _STRUCT_UCONTEXT64 */
93typedef struct ucontext64 ExceptionInformation;
94typedef struct mcontext64 *MCONTEXT_T;
95#endif /* _STRUCT_UCONTEXT64 */
96#define UC_MCONTEXT(UC) UC->uc_mcontext64
97#else /* WORD_SIZE */
98#ifdef _STRUCT_UCONTEXT
99typedef _STRUCT_UCONTEXT ExceptionInformation;
100typedef _STRUCT_MCONTEXT *MCONTEXT_T;
101#else
102typedef struct ucontext ExceptionInformation;
103typedef struct mcontext *MCONTEXT_T;
104#endif
105#define UC_MCONTEXT(UC) UC->uc_mcontext
106#endif /* WORD_SIZE */
107
108
109
110#endif /* PPC */
111
112#ifdef X8664
113#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
114/* Broken <i386/ucontext.h> in Mac OS 10.4u SDK */
115struct mcontext64 {
116        x86_exception_state64_t __es;
117        x86_thread_state64_t    __ss;   
118        x86_float_state64_t     __fs;
119};
120
121typedef struct mcontext64 *MCONTEXT_T;
122typedef ucontext64_t ExceptionInformation;
123#define UC_MCONTEXT(UC) UC->uc_mcontext64
124#define __rax rax
125#define __fpu_mxcsr fpu_mxcsr
126#define __fpu_xmm0 fpu_xmm0
127#define __rsp rsp
128#define __trapno trapno
129#define __faultvaddr faultvaddr
130#define __err err
131#define __rip rip
132#define __rsi rsi
133#define __rdi rdi
134#define __rdx rdx
135#define __rcx rcx
136#define __r8 r8
137#define __rflags rflags
138#else /* post-10.4 */
139typedef mcontext_t MCONTEXT_T;
140typedef ucontext_t ExceptionInformation;
141#define UC_MCONTEXT(UC) UC->uc_mcontext
142#endif
143#endif
144
145#ifdef X8632
146/* Assume rational <i386/ucontext.h> */
147/* Sadly, we can't make that assumption, since Apple renamed things
148   for Leopard. Yow!  Are we standards-compliant yet ? */
149/* In the long term, we probably want to use the leopard-compliant
150   names (with leading __ prefixes).  In the shorter term, we want
151   kernels compiled on Leopard to run on Tiger (and not reference
152   foo$UNIX2003 and similar nonsense, and that means getting the old
153   names (without leading __ prefixes.)  Confused yet ? */
154
155#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
156#define __ss ss
157#define __ds ds
158#define __es es
159#define __cs cs
160#define __fs fs
161#define __gs gs
162#define __eax eax
163#define __esp esp
164#define __eip eip
165#define __eflags eflags
166#define __fpu_xmm0 fpu_xmm0
167#define __fpu_mxcsr fpu_mxcsr
168#define __fpu_stmm0 fpu_stmm0
169#define __trapno trapno
170#define __err err
171#define __faultvaddr faultvaddr
172#endif
173
174#define UC_MCONTEXT(UC) UC->uc_mcontext
175typedef mcontext_t MCONTEXT_T;
176typedef ucontext_t ExceptionInformation;
177#endif
178
179#endif /* #ifdef DARWIN */
180
181#ifdef LINUX
182typedef struct ucontext ExceptionInformation;
183#endif
184
185#ifdef FREEBSD
186typedef struct __ucontext ExceptionInformation;
187#endif
188
189#ifdef SOLARIS
190typedef struct ucontext ExceptionInformation;
191#endif
192
193#ifdef WINDOWS
194typedef CONTEXT ExceptionInformation;
195#endif
196
197typedef u32_t lisp_char_code;
198
199typedef int OSStatus, OSErr;
200#define noErr ((OSErr) 0)
201typedef int Boolean;
202typedef void *LogicalAddress;
203typedef char *Ptr, *BytePtr, *StringPtr;
204typedef unsigned int UInt32;
205
206
207
208#define true 1
209#define false 0
210
211#endif /*__lisptypes__ */
Note: See TracBrowser for help on using the repository browser.