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.26 by gbeauche, 2002-11-16T15:38:53Z

# 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   /* Time data type for Time Manager emulation */
159   #ifdef HAVE_CLOCK_GETTIME
# Line 114 | Line 162 | typedef struct timespec tm_time_t;
162   typedef struct timeval tm_time_t;
163   #endif
164  
165 < /* Offset Mac->Unix time in seconds */
166 < #define TIME_OFFSET 0x7c25b080
165 > /* Define codes for all the float formats that we know of.
166 > * Though we only handle IEEE format.  */
167 > #define UNKNOWN_FLOAT_FORMAT 0
168 > #define IEEE_FLOAT_FORMAT 1
169 > #define VAX_FLOAT_FORMAT 2
170 > #define IBM_FLOAT_FORMAT 3
171 > #define C4X_FLOAT_FORMAT 4
172  
173   /* UAE CPU data types */
174   #define uae_s8 int8
# Line 129 | Line 182 | typedef struct timeval tm_time_t;
182   typedef uae_u32 uaecptr;
183  
184   /* Alignment restrictions */
185 < #if defined(__i386__) || defined(__powerpc__) || defined(__m68k__)
185 > #if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) || defined(__x86_64__)
186   # define CPU_CAN_ACCESS_UNALIGNED
187   #endif
188  
189 + /* Timing functions */
190 + extern uint64 GetTicks_usec(void);
191 + extern void Delay_usec(uint32 usec);
192 +
193 + #ifdef HAVE_PTHREADS
194 + /* Centralized pthread attribute setup */
195 + void Set_pthread_attr(pthread_attr_t *attr, int priority);
196 + #endif
197 +
198   /* UAE CPU defines */
199   #ifdef WORDS_BIGENDIAN
200  
# Line 173 | Line 235 | static inline void do_put_mem_word(uae_u
235  
236   #else /* WORDS_BIGENDIAN */
237  
238 < #ifdef __i386__
238 > #if defined(__i386__) || defined(__x86_64__)
239  
240   /* Intel x86 */
241   #define X86_PPRO_OPT
# Line 191 | Line 253 | static inline void do_put_mem_word(uae_u
253   #else
254   static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
255   #endif
256 + #define HAVE_OPTIMIZED_BYTESWAP_32
257 + /* bswap doesn't affect condition codes */
258 + static inline uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;}
259 + #define HAVE_OPTIMIZED_BYTESWAP_16
260 + #ifdef X86_PPRO_OPT
261 + static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;}
262 + #else
263 + static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;}
264 + #endif
265  
266   #elif defined(CPU_CAN_ACCESS_UNALIGNED)
267  
# Line 212 | Line 283 | static inline void do_put_mem_word(uae_u
283  
284   #endif /* WORDS_BIGENDIAN */
285  
286 + #ifndef HAVE_OPTIMIZED_BYTESWAP_32
287 + static inline uae_u32 do_byteswap_32(uae_u32 v)
288 +        { return (((v >> 24) & 0xff) | ((v >> 8) & 0xff00) | ((v & 0xff) << 24) | ((v & 0xff00) << 8)); }
289 + #endif
290 +
291 + #ifndef HAVE_OPTIMIZED_BYTESWAP_16
292 + static inline uae_u32 do_byteswap_16(uae_u32 v)
293 +        { return (((v >> 8) & 0xff) | ((v & 0xff) << 8)); }
294 + #endif
295 +
296   #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a)))
297   #define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v))
298  
# Line 219 | Line 300 | static inline void do_put_mem_word(uae_u
300   #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
301   #define __inline__ inline
302   #define CPU_EMU_SIZE 0
222 #undef USE_MAPPED_MEMORY
223 #undef CAN_MAP_MEMORY
303   #undef NO_INLINE_MEMORY_ACCESS
304   #undef MD_HAVE_MEM_1_FUNCS
226 #undef USE_COMPILER
305   #define ENUMDECL typedef enum
306   #define ENUMNAME(name) name
307   #define write_log printf
308  
309 < #ifdef X86_ASSEMBLY
309 > #if defined(X86_ASSEMBLY) || defined(X86_64_ASSEMBLY)
310   #define ASM_SYM_FOR_FUNC(a) __asm__(a)
311   #else
312   #define ASM_SYM_FOR_FUNC(a)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines