source: branches/working-0711/ccl/lisp-kernel/lisptypes.h @ 7656

Last change on this file since 7656 was 7656, checked in by gb, 13 years ago

Conditionalize use of "new" (Leopard) register names etc. on whether
DARWIN_UNIX03 is defined and non-zero.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/*
2   Copyright (C) 1994-2001 Digitool, Inc
3   This file is part of OpenMCL. 
4
5   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with OpenMCL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with OpenMCL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   OpenMCL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17#ifndef __lisptypes__
18#define __lisptypes__
19
20#include <sys/types.h>
21#define WORD_SIZE 32
22#ifdef PPC64
23#undef WORD_SIZE
24#define WORD_SIZE 64
25#endif
26#ifdef X8664
27#undef WORD_SIZE
28#define WORD_SIZE 64
29#endif
30
31
32#ifdef SOLARIS
33/* Solaris doesn't laugh and play like the other children */
34typedef int64_t s64_t;
35typedef uint64_t u64_t;
36typedef int32_t s32_t;
37typedef uint32_t u32_t;
38typedef int16_t s16_t;
39typedef uint16_t u16_t;
40typedef int8_t s8_t;
41typedef uint8_t u8_t;
42#else
43typedef int64_t s64_t;
44typedef u_int64_t u64_t;
45typedef int32_t s32_t;
46typedef u_int32_t u32_t;
47typedef int16_t s16_t;
48typedef u_int16_t u16_t;
49typedef int8_t s8_t;
50typedef u_int8_t u8_t;
51#endif
52
53#if WORD_SIZE == 64
54typedef u64_t LispObj;
55typedef u64_t natural;
56typedef s64_t signed_natural;
57typedef u64_t unsigned_of_pointer_size;
58#else
59typedef u32_t LispObj;
60typedef u32_t natural;
61typedef s32_t signed_natural;
62typedef u32_t unsigned_of_pointer_size;
63#endif
64
65
66#ifdef DARWIN
67#include <sys/signal.h>
68#include <sys/ucontext.h>
69
70#ifdef PPC
71#if WORD_SIZE == 64
72#ifdef _STRUCT_UCONTEXT64
73typedef _STRUCT_UCONTEXT64 ExceptionInformation;
74typedef _STRUCT_MCONTEXT64 *MCONTEXT_T;
75#else /* _STRUCT_UCONTEXT64 */
76typedef struct ucontext64 ExceptionInformation;
77typedef struct mcontext64 *MCONTEXT_T;
78#endif /* _STRUCT_UCONTEXT64 */
79#define UC_MCONTEXT(UC) UC->uc_mcontext64
80#else /* WORD_SIZE */
81#ifdef _STRUCT_UCONTEXT
82typedef _STRUCT_UCONTEXT ExceptionInformation;
83typedef _STRUCT_MCONTEXT *MCONTEXT_T;
84#else
85typedef struct ucontext ExceptionInformation;
86typedef struct mcontext *MCONTEXT_T;
87#endif
88#define UC_MCONTEXT(UC) UC->uc_mcontext
89#endif /* WORD_SIZE */
90#ifndef __DARWIN_UNIX03
91#define __DARWIN_UNIX03 0
92#endif
93#if !__DARWIN_UNIX03
94#define __ss ss
95#define __es es
96#define __fs fs
97#define __vs vs
98
99#define __r0 r0
100#define __r1 r1
101#define __r3 r3
102#define __r4 r4
103#define __r5 r5
104#define __r6 r6
105#define __r13 r13
106#define __srr0 srr0
107#define __srr1 srr1
108#define __lr lr
109#define __ctr ctr
110#define __xer xer
111#define __cr cr
112#define __dsisr dsisr
113#define __dar dar
114#define __exception exception
115#define __fpscr fpscr
116#define __fpregs fpregs
117#endif
118#endif /* PPC */
119
120#ifdef X8664
121/* Broken <i386/ucontext.h> in xcode 2.4 */
122#ifndef _STRUCT_MCONTEXT64 /* A guess at what'll be defined when this is fixed */
123struct mcontext64 {
124        x86_exception_state64_t __es;
125        x86_thread_state64_t    __ss;   
126        x86_float_state64_t     __fs;
127};
128
129typedef struct mcontext64 *MCONTEXT_T;
130typedef ucontext64_t ExceptionInformation;
131#define UC_MCONTEXT(UC) UC->uc_mcontext64
132#define __rax rax
133#define __fpu_mxcsr fpu_mxcsr
134#define __fpu_xmm0 fpu_xmm0
135#define __rsp rsp
136#define __faultvaddr faultvaddr
137#define __err err
138#define __rip rip
139#define __rsi rsi
140#define __rdi rdi
141#define __rdx rdx
142#define __rcx rcx
143#define __r8 r8
144#define __rflags rflags
145#else
146typedef mcontext_t MCONTEXT_T;
147typedef ucontext_t ExceptionInformation;
148#define UC_MCONTEXT(UC) UC->uc_mcontext
149#endif /* _STRUCT_MCONTEXT64 */
150#endif /* X86_64 */
151#endif /* #ifdef DARWIN */
152
153#ifdef LINUX
154typedef struct ucontext ExceptionInformation;
155#endif
156
157#ifdef FREEBSD
158typedef struct __ucontext ExceptionInformation;
159#endif
160
161#ifdef SOLARIS
162typedef struct ucontext ExceptionInformation;
163#endif
164
165typedef u32_t lisp_char_code;
166
167typedef int OSStatus, OSErr;
168#define noErr ((OSErr) 0)
169typedef int Boolean;
170typedef void *LogicalAddress;
171typedef char *Ptr, *BytePtr, *StringPtr;
172typedef unsigned int UInt32;
173
174
175
176#define true 1
177#define false 0
178
179#endif /*__lisptypes__ */
Note: See TracBrowser for help on using the repository browser.