1 |
|
/* |
2 |
|
* sysdeps.h - System dependent definitions for Unix |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 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 |
43 |
|
#include <stdlib.h> |
44 |
|
#include <string.h> |
45 |
|
|
46 |
+ |
#ifdef HAVE_PTHREADS |
47 |
+ |
# include <pthread.h> |
48 |
+ |
#endif |
49 |
+ |
|
50 |
|
#ifdef HAVE_FCNTL_H |
51 |
|
# include <fcntl.h> |
52 |
|
#endif |
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 |
|
|
88 |
|
/* The m68k emulator uses a prefetch buffer ? */ |
89 |
|
#define USE_PREFETCH_BUFFER 0 |
90 |
|
|
91 |
< |
/* Mac ROM is write protected */ |
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 |
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; |
155 |
|
#error "Unsupported size of pointer" |
156 |
|
#endif |
157 |
|
|
158 |
+ |
#ifndef HAVE_LOFF_T |
159 |
+ |
typedef off_t loff_t; |
160 |
+ |
#endif |
161 |
+ |
|
162 |
|
/* Time data type for Time Manager emulation */ |
163 |
|
#ifdef HAVE_CLOCK_GETTIME |
164 |
|
typedef struct timespec tm_time_t; |
166 |
|
typedef struct timeval tm_time_t; |
167 |
|
#endif |
168 |
|
|
169 |
< |
/* Offset Mac->Unix time in seconds */ |
170 |
< |
#define TIME_OFFSET 0x7c25b080 |
169 |
> |
/* Define codes for all the float formats that we know of. |
170 |
> |
* Though we only handle IEEE format. */ |
171 |
> |
#define UNKNOWN_FLOAT_FORMAT 0 |
172 |
> |
#define IEEE_FLOAT_FORMAT 1 |
173 |
> |
#define VAX_FLOAT_FORMAT 2 |
174 |
> |
#define IBM_FLOAT_FORMAT 3 |
175 |
> |
#define C4X_FLOAT_FORMAT 4 |
176 |
|
|
177 |
|
/* UAE CPU data types */ |
178 |
|
#define uae_s8 int8 |
186 |
|
typedef uae_u32 uaecptr; |
187 |
|
|
188 |
|
/* Alignment restrictions */ |
189 |
< |
#if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) |
189 |
> |
#if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) || defined(__x86_64__) |
190 |
|
# define CPU_CAN_ACCESS_UNALIGNED |
191 |
|
#endif |
192 |
|
|
194 |
|
extern uint64 GetTicks_usec(void); |
195 |
|
extern void Delay_usec(uint32 usec); |
196 |
|
|
197 |
+ |
#ifdef HAVE_PTHREADS |
198 |
+ |
/* Centralized pthread attribute setup */ |
199 |
+ |
void Set_pthread_attr(pthread_attr_t *attr, int priority); |
200 |
+ |
#endif |
201 |
+ |
|
202 |
|
/* UAE CPU defines */ |
203 |
|
#ifdef WORDS_BIGENDIAN |
204 |
|
|
239 |
|
|
240 |
|
#else /* WORDS_BIGENDIAN */ |
241 |
|
|
242 |
< |
#ifdef __i386__ |
242 |
> |
#if defined(__i386__) || defined(__x86_64__) |
243 |
|
|
244 |
|
/* Intel x86 */ |
245 |
|
#define X86_PPRO_OPT |
257 |
|
#else |
258 |
|
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} |
259 |
|
#endif |
260 |
+ |
#define HAVE_OPTIMIZED_BYTESWAP_32 |
261 |
+ |
/* bswap doesn't affect condition codes */ |
262 |
+ |
static inline uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;} |
263 |
+ |
#define HAVE_OPTIMIZED_BYTESWAP_16 |
264 |
+ |
#ifdef X86_PPRO_OPT |
265 |
+ |
static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;} |
266 |
+ |
#else |
267 |
+ |
static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;} |
268 |
+ |
#endif |
269 |
|
|
270 |
|
#elif defined(CPU_CAN_ACCESS_UNALIGNED) |
271 |
|
|
287 |
|
|
288 |
|
#endif /* WORDS_BIGENDIAN */ |
289 |
|
|
290 |
+ |
#ifndef HAVE_OPTIMIZED_BYTESWAP_32 |
291 |
+ |
static inline uae_u32 do_byteswap_32(uae_u32 v) |
292 |
+ |
{ return (((v >> 24) & 0xff) | ((v >> 8) & 0xff00) | ((v & 0xff) << 24) | ((v & 0xff00) << 8)); } |
293 |
+ |
#endif |
294 |
+ |
|
295 |
+ |
#ifndef HAVE_OPTIMIZED_BYTESWAP_16 |
296 |
+ |
static inline uae_u32 do_byteswap_16(uae_u32 v) |
297 |
+ |
{ return (((v >> 8) & 0xff) | ((v & 0xff) << 8)); } |
298 |
+ |
#endif |
299 |
+ |
|
300 |
|
#define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a))) |
301 |
|
#define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v)) |
302 |
|
|
310 |
|
#define ENUMNAME(name) name |
311 |
|
#define write_log printf |
312 |
|
|
313 |
< |
#ifdef USE_COMPILER |
273 |
< |
#define USE_MAPPED_MEMORY |
274 |
< |
#define CAN_MAP_MEMORY |
275 |
< |
#define NO_EXCEPTION_3 |
276 |
< |
#define NO_PREFETCH_BUFFER |
277 |
< |
#else |
278 |
< |
#undef USE_MAPPED_MEMORY |
279 |
< |
#undef CAN_MAP_MEMORY |
280 |
< |
#endif |
281 |
< |
|
282 |
< |
#ifdef X86_ASSEMBLY |
313 |
> |
#if defined(X86_ASSEMBLY) || defined(X86_64_ASSEMBLY) |
314 |
|
#define ASM_SYM_FOR_FUNC(a) __asm__(a) |
315 |
|
#else |
316 |
|
#define ASM_SYM_FOR_FUNC(a) |