ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/sysdeps.h
(Generate patch)

Comparing BasiliskII/src/Unix/sysdeps.h (file contents):
Revision 1.8 by cebix, 1999-10-27T17:50:07Z vs.
Revision 1.28 by gbeauche, 2003-11-21T14:16:02Z

# Line 1 | Line 1
1   /*
2   *  sysdeps.h - System dependent definitions for Unix
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2002 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 42 | Line 42
42   #include <stdio.h>
43   #include <stdlib.h>
44   #include <string.h>
45 < #include <pthread.h>
45 >
46 > #ifdef HAVE_PTHREADS
47 > # include <pthread.h>
48 > #endif
49  
50   #ifdef HAVE_FCNTL_H
51   # include <fcntl.h>
# Line 60 | Line 63
63   #endif
64  
65  
66 < /* Are the Mac and the host address space the same? */
66 > #ifdef ENABLE_NATIVE_M68K
67 >
68 > /* Mac and host address space are the same */
69 > #define REAL_ADDRESSING 1
70 >
71 > /* Using 68k natively */
72 > #define EMULATED_68K 0
73 >
74 > /* Mac ROM is not write protected */
75 > #define ROM_IS_WRITE_PROTECTED 0
76 > #define USE_SCRATCHMEM_SUBTERFUGE 1
77 >
78 > #else
79 >
80 > /* Mac and host address space are distinct */
81 > #ifndef REAL_ADDRESSING
82   #define REAL_ADDRESSING 0
83 + #endif
84  
85 < /* Are we using a 68k emulator or the real thing? */
85 > /* Using 68k emulator */
86   #define EMULATED_68K 1
87  
88 < /* Is the Mac ROM write protected? */
89 < #define ROM_IS_WRITE_PROTECTED 1
88 > /* The m68k emulator uses a prefetch buffer ? */
89 > #define USE_PREFETCH_BUFFER 0
90 >
91 > /* Mac ROM is write protected when banked memory is used */
92 > #if REAL_ADDRESSING || DIRECT_ADDRESSING
93 > # define ROM_IS_WRITE_PROTECTED 0
94 > # define USE_SCRATCHMEM_SUBTERFUGE 1
95 > #else
96 > # define ROM_IS_WRITE_PROTECTED 1
97 > #endif
98 >
99 > #endif
100 >
101 > /* Direct Addressing requires Video on SEGV signals */
102 > #if DIRECT_ADDRESSING && !ENABLE_VOSF
103 > # undef  ENABLE_VOSF
104 > # define ENABLE_VOSF 1
105 > #endif
106  
107   /* ExtFS is supported */
108   #define SUPPORTS_EXTFS 1
109  
110 + /* BSD socket API supported */
111 + #define SUPPORTS_UDP_TUNNEL 1
112 +
113 +
114   /* Data types */
115   typedef unsigned char uint8;
116   typedef signed char int8;
# Line 106 | Line 145 | typedef long long int64;
145   #else
146   #error "No 8 byte type, you lose."
147   #endif
148 + #if SIZEOF_VOID_P == 4
149 + typedef uint32 uintptr;
150 + typedef int32 intptr;
151 + #elif SIZEOF_VOID_P == 8
152 + typedef uint64 uintptr;
153 + typedef int64 intptr;
154 + #else
155 + #error "Unsupported size of pointer"
156 + #endif
157 +
158 + #ifndef HAVE_LOFF_T
159 + typedef off_t loff_t;
160 + #endif
161 + #ifndef HAVE_CADDR_T
162 + typedef char * caddr_t;
163 + #endif
164  
165   /* Time data type for Time Manager emulation */
166   #ifdef HAVE_CLOCK_GETTIME
# Line 114 | Line 169 | typedef struct timespec tm_time_t;
169   typedef struct timeval tm_time_t;
170   #endif
171  
172 < /* Offset Mac->Unix time in seconds */
173 < #define TIME_OFFSET 0x7c25b080
172 > /* Define codes for all the float formats that we know of.
173 > * Though we only handle IEEE format.  */
174 > #define UNKNOWN_FLOAT_FORMAT 0
175 > #define IEEE_FLOAT_FORMAT 1
176 > #define VAX_FLOAT_FORMAT 2
177 > #define IBM_FLOAT_FORMAT 3
178 > #define C4X_FLOAT_FORMAT 4
179  
180   /* UAE CPU data types */
181   #define uae_s8 int8
# Line 129 | Line 189 | typedef struct timeval tm_time_t;
189   typedef uae_u32 uaecptr;
190  
191   /* Alignment restrictions */
192 < #if defined(__i386__) || defined(__powerpc__) || defined(__m68k__)
192 > #if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) || defined(__x86_64__)
193   # define CPU_CAN_ACCESS_UNALIGNED
194   #endif
195  
196 + /* Timing functions */
197 + extern uint64 GetTicks_usec(void);
198 + extern void Delay_usec(uint32 usec);
199 +
200 + #ifdef HAVE_PTHREADS
201 + /* Centralized pthread attribute setup */
202 + void Set_pthread_attr(pthread_attr_t *attr, int priority);
203 + #endif
204 +
205   /* UAE CPU defines */
206   #ifdef WORDS_BIGENDIAN
207  
# Line 173 | Line 242 | static inline void do_put_mem_word(uae_u
242  
243   #else /* WORDS_BIGENDIAN */
244  
245 < #ifdef __i386__
245 > #if defined(__i386__) || defined(__x86_64__)
246  
247   /* Intel x86 */
248   #define X86_PPRO_OPT
# Line 191 | Line 260 | static inline void do_put_mem_word(uae_u
260   #else
261   static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
262   #endif
263 + #define HAVE_OPTIMIZED_BYTESWAP_32
264 + /* bswap doesn't affect condition codes */
265 + static inline uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;}
266 + #define HAVE_OPTIMIZED_BYTESWAP_16
267 + #ifdef X86_PPRO_OPT
268 + static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;}
269 + #else
270 + static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;}
271 + #endif
272  
273   #elif defined(CPU_CAN_ACCESS_UNALIGNED)
274  
# Line 212 | Line 290 | static inline void do_put_mem_word(uae_u
290  
291   #endif /* WORDS_BIGENDIAN */
292  
293 + #ifndef HAVE_OPTIMIZED_BYTESWAP_32
294 + static inline uae_u32 do_byteswap_32(uae_u32 v)
295 +        { return (((v >> 24) & 0xff) | ((v >> 8) & 0xff00) | ((v & 0xff) << 24) | ((v & 0xff00) << 8)); }
296 + #endif
297 +
298 + #ifndef HAVE_OPTIMIZED_BYTESWAP_16
299 + static inline uae_u32 do_byteswap_16(uae_u32 v)
300 +        { return (((v >> 8) & 0xff) | ((v & 0xff) << 8)); }
301 + #endif
302 +
303   #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a)))
304   #define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v))
305  
# Line 219 | Line 307 | static inline void do_put_mem_word(uae_u
307   #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
308   #define __inline__ inline
309   #define CPU_EMU_SIZE 0
222 #undef USE_MAPPED_MEMORY
223 #undef CAN_MAP_MEMORY
310   #undef NO_INLINE_MEMORY_ACCESS
311   #undef MD_HAVE_MEM_1_FUNCS
226 #undef USE_COMPILER
312   #define ENUMDECL typedef enum
313   #define ENUMNAME(name) name
314   #define write_log printf
315  
316 < #ifdef X86_ASSEMBLY
316 > #if defined(X86_ASSEMBLY) || defined(X86_64_ASSEMBLY)
317   #define ASM_SYM_FOR_FUNC(a) __asm__(a)
318   #else
319   #define ASM_SYM_FOR_FUNC(a)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines