1 |
cebix |
1.1 |
/* |
2 |
|
|
* sysdeps.h - System dependent definitions for BeOS |
3 |
|
|
* |
4 |
cebix |
1.8 |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
cebix |
1.1 |
* |
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 |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef SYSDEPS_H |
22 |
|
|
#define SYSDEPS_H |
23 |
|
|
|
24 |
|
|
#include <assert.h> |
25 |
|
|
#include <support/SupportDefs.h> |
26 |
|
|
#include <support/ByteOrder.h> |
27 |
|
|
|
28 |
cebix |
1.2 |
#include "user_strings_beos.h" |
29 |
|
|
|
30 |
cebix |
1.1 |
// Are the Mac and the host address space the same? |
31 |
|
|
#ifdef __i386__ |
32 |
|
|
#define REAL_ADDRESSING 0 |
33 |
cebix |
1.7 |
#undef WORDS_BIGENDIAN |
34 |
cebix |
1.1 |
#else |
35 |
|
|
#define REAL_ADDRESSING 1 |
36 |
cebix |
1.7 |
#define WORDS_BIGENDIAN 1 |
37 |
cebix |
1.1 |
#endif |
38 |
|
|
|
39 |
cebix |
1.9 |
// Using 68k emulator |
40 |
cebix |
1.1 |
#define EMULATED_68K 1 |
41 |
|
|
|
42 |
cebix |
1.9 |
// Mac ROM is write protected |
43 |
cebix |
1.1 |
#define ROM_IS_WRITE_PROTECTED 1 |
44 |
|
|
|
45 |
cebix |
1.4 |
// ExtFS is supported |
46 |
|
|
#define SUPPORTS_EXTFS 1 |
47 |
|
|
|
48 |
cebix |
1.5 |
// mon is not supported |
49 |
cebix |
1.9 |
#undef ENABLE_MON |
50 |
cebix |
1.5 |
|
51 |
cebix |
1.1 |
// Time data type for Time Manager emulation |
52 |
|
|
typedef bigtime_t tm_time_t; |
53 |
|
|
|
54 |
cebix |
1.3 |
// Offset Mac->BeOS time in seconds |
55 |
|
|
#define TIME_OFFSET 0x7c25b080 |
56 |
|
|
|
57 |
cebix |
1.1 |
// 64 bit file offsets |
58 |
|
|
typedef off_t loff_t; |
59 |
|
|
|
60 |
|
|
// UAE CPU data types |
61 |
|
|
#define uae_s8 int8 |
62 |
|
|
#define uae_u8 uint8 |
63 |
|
|
#define uae_s16 int16 |
64 |
|
|
#define uae_u16 uint16 |
65 |
|
|
#define uae_s32 int32 |
66 |
|
|
#define uae_u32 uint32 |
67 |
cebix |
1.6 |
#define uae_s64 int64 |
68 |
|
|
#define uae_u64 uint64 |
69 |
cebix |
1.1 |
typedef uae_u32 uaecptr; |
70 |
cebix |
1.6 |
#define VAL64(a) (a ## LL) |
71 |
|
|
#define UVAL64(a) (a ## uLL) |
72 |
cebix |
1.1 |
|
73 |
|
|
// UAE CPU defines |
74 |
|
|
#ifdef __i386__ |
75 |
|
|
|
76 |
|
|
// Intel x86 assembler optimizations |
77 |
|
|
#define X86_PPRO_OPT |
78 |
|
|
static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;} |
79 |
|
|
#ifdef X86_PPRO_OPT |
80 |
|
|
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswap %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} |
81 |
|
|
#else |
82 |
|
|
static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} |
83 |
|
|
#endif |
84 |
|
|
#define HAVE_GET_WORD_UNSWAPPED |
85 |
|
|
#define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a))) |
86 |
|
|
static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;} |
87 |
|
|
#ifdef X86_PPRO_OPT |
88 |
|
|
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;} |
89 |
|
|
#else |
90 |
|
|
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} |
91 |
|
|
#endif |
92 |
|
|
|
93 |
|
|
#define X86_ASSEMBLY |
94 |
|
|
#define ASM_SYM_FOR_FUNC(a) __asm__(a) |
95 |
|
|
#define REGPARAM __attribute__((regparm(3))) |
96 |
|
|
|
97 |
|
|
#else |
98 |
|
|
|
99 |
|
|
// PowerPC (memory.cpp not used, so no optimization neccessary) |
100 |
|
|
static inline uae_u32 do_get_mem_long(uae_u32 *a) {return *a;} |
101 |
|
|
static inline uae_u32 do_get_mem_word(uae_u16 *a) {return *a;} |
102 |
|
|
static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = v;} |
103 |
|
|
static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;} |
104 |
|
|
|
105 |
|
|
#undef X86_ASSEMBLY |
106 |
|
|
#define ASM_SYM_FOR_FUNC(a) |
107 |
|
|
#define REGPARAM |
108 |
|
|
#endif |
109 |
|
|
|
110 |
|
|
#define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a))) |
111 |
|
|
#define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v)) |
112 |
|
|
|
113 |
|
|
#define call_mem_get_func(func, addr) ((*func)(addr)) |
114 |
|
|
#define call_mem_put_func(func, addr, v) ((*func)(addr, v)) |
115 |
|
|
#define __inline__ inline |
116 |
|
|
#define CPU_EMU_SIZE 0 |
117 |
|
|
#undef USE_MAPPED_MEMORY |
118 |
|
|
#undef CAN_MAP_MEMORY |
119 |
|
|
#undef NO_INLINE_MEMORY_ACCESS |
120 |
|
|
#undef MD_HAVE_MEM_1_FUNCS |
121 |
|
|
#undef USE_COMPILER |
122 |
|
|
#define REGPARAM2 |
123 |
|
|
#define ENUMDECL typedef enum |
124 |
|
|
#define ENUMNAME(name) name |
125 |
|
|
#define write_log printf |
126 |
|
|
|
127 |
|
|
#endif |