1 |
|
/* |
2 |
|
* sysdeps.h - System dependent definitions for Unix |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 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 |
42 |
|
#include <stdio.h> |
43 |
|
#include <stdlib.h> |
44 |
|
#include <string.h> |
45 |
– |
#include <pthread.h> |
45 |
|
|
46 |
|
#ifdef HAVE_FCNTL_H |
47 |
|
# include <fcntl.h> |
59 |
|
#endif |
60 |
|
|
61 |
|
|
62 |
< |
/* Are the Mac and the host address space the same? */ |
62 |
> |
#ifdef ENABLE_NATIVE_M68K |
63 |
> |
|
64 |
> |
/* Mac and host address space are the same */ |
65 |
> |
#define REAL_ADDRESSING 1 |
66 |
> |
|
67 |
> |
/* Using 68k natively */ |
68 |
> |
#define EMULATED_68K 0 |
69 |
> |
|
70 |
> |
/* Mac ROM is not write protected */ |
71 |
> |
#define ROM_IS_WRITE_PROTECTED 0 |
72 |
> |
#define USE_SCRATCHMEM_SUBTERFUGE 1 |
73 |
> |
|
74 |
> |
#else |
75 |
> |
|
76 |
> |
/* Mac and host address space are distinct */ |
77 |
> |
#ifndef REAL_ADDRESSING |
78 |
|
#define REAL_ADDRESSING 0 |
79 |
+ |
#endif |
80 |
|
|
81 |
< |
/* Are we using a 68k emulator or the real thing? */ |
81 |
> |
/* Using 68k emulator */ |
82 |
|
#define EMULATED_68K 1 |
83 |
|
|
84 |
< |
/* Is the Mac ROM write protected? */ |
85 |
< |
#define ROM_IS_WRITE_PROTECTED 1 |
84 |
> |
/* The m68k emulator uses a prefetch buffer ? */ |
85 |
> |
#define USE_PREFETCH_BUFFER 0 |
86 |
> |
|
87 |
> |
/* Mac ROM is write protected when banked memory is used */ |
88 |
> |
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
89 |
> |
# define ROM_IS_WRITE_PROTECTED 0 |
90 |
> |
# define USE_SCRATCHMEM_SUBTERFUGE 1 |
91 |
> |
#else |
92 |
> |
# define ROM_IS_WRITE_PROTECTED 1 |
93 |
> |
#endif |
94 |
> |
|
95 |
> |
#endif |
96 |
> |
|
97 |
> |
/* Direct Addressing requires Video on SEGV signals */ |
98 |
> |
#if DIRECT_ADDRESSING && !ENABLE_VOSF |
99 |
> |
# undef ENABLE_VOSF |
100 |
> |
# define ENABLE_VOSF 1 |
101 |
> |
#endif |
102 |
> |
|
103 |
> |
/* ExtFS is supported */ |
104 |
> |
#define SUPPORTS_EXTFS 1 |
105 |
> |
|
106 |
|
|
107 |
|
/* Data types */ |
108 |
|
typedef unsigned char uint8; |
128 |
|
#if SIZEOF_LONG == 8 |
129 |
|
typedef unsigned long uint64; |
130 |
|
typedef long int64; |
131 |
+ |
#define VAL64(a) (a ## l) |
132 |
+ |
#define UVAL64(a) (a ## ul) |
133 |
|
#elif SIZEOF_LONG_LONG == 8 |
134 |
|
typedef unsigned long long uint64; |
135 |
|
typedef long long int64; |
136 |
+ |
#define VAL64(a) (a ## LL) |
137 |
+ |
#define UVAL64(a) (a ## uLL) |
138 |
|
#else |
139 |
|
#error "No 8 byte type, you lose." |
140 |
|
#endif |
141 |
+ |
#if SIZEOF_VOID_P == 4 |
142 |
+ |
typedef uint32 uintptr; |
143 |
+ |
typedef int32 intptr; |
144 |
+ |
#elif SIZEOF_VOID_P == 8 |
145 |
+ |
typedef uint64 uintptr; |
146 |
+ |
typedef int64 intptr; |
147 |
+ |
#else |
148 |
+ |
#error "Unsupported size of pointer" |
149 |
+ |
#endif |
150 |
|
|
151 |
|
/* Time data type for Time Manager emulation */ |
152 |
|
#ifdef HAVE_CLOCK_GETTIME |
155 |
|
typedef struct timeval tm_time_t; |
156 |
|
#endif |
157 |
|
|
158 |
+ |
/* Offset Mac->Unix time in seconds */ |
159 |
+ |
#define TIME_OFFSET 0x7c25b080 |
160 |
+ |
|
161 |
|
/* UAE CPU data types */ |
162 |
|
#define uae_s8 int8 |
163 |
|
#define uae_u8 uint8 |
165 |
|
#define uae_u16 uint16 |
166 |
|
#define uae_s32 int32 |
167 |
|
#define uae_u32 uint32 |
168 |
+ |
#define uae_s64 int64 |
169 |
+ |
#define uae_u64 uint64 |
170 |
|
typedef uae_u32 uaecptr; |
171 |
|
|
172 |
|
/* Alignment restrictions */ |
173 |
< |
#if defined(__i386__) || defined(__powerpc__) |
173 |
> |
#if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) |
174 |
|
# define CPU_CAN_ACCESS_UNALIGNED |
175 |
|
#endif |
176 |
|
|
177 |
+ |
/* Timing functions */ |
178 |
+ |
extern uint64 GetTicks_usec(void); |
179 |
+ |
extern void Delay_usec(uint32 usec); |
180 |
+ |
|
181 |
|
/* UAE CPU defines */ |
182 |
|
#ifdef WORDS_BIGENDIAN |
183 |
|
|
264 |
|
#define call_mem_put_func(func, addr, v) ((*func)(addr, v)) |
265 |
|
#define __inline__ inline |
266 |
|
#define CPU_EMU_SIZE 0 |
210 |
– |
#undef USE_MAPPED_MEMORY |
211 |
– |
#undef CAN_MAP_MEMORY |
267 |
|
#undef NO_INLINE_MEMORY_ACCESS |
268 |
|
#undef MD_HAVE_MEM_1_FUNCS |
214 |
– |
#undef USE_COMPILER |
269 |
|
#define ENUMDECL typedef enum |
270 |
|
#define ENUMNAME(name) name |
271 |
|
#define write_log printf |
272 |
+ |
#undef USE_MAPPED_MEMORY |
273 |
+ |
#undef CAN_MAP_MEMORY |
274 |
|
|
275 |
|
#ifdef X86_ASSEMBLY |
276 |
|
#define ASM_SYM_FOR_FUNC(a) __asm__(a) |