ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/BeOS/sysdeps.h
Revision: 1.15
Committed: 2001-07-15T14:19:08Z (23 years ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.14: +7 -0 lines
Log Message:
- UDP tunneling works under BeOS
- fixed BeOS compilation problems

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * sysdeps.h - System dependent definitions for BeOS
3     *
4 cebix 1.10 * Basilisk II (C) 1997-2001 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 cebix 1.12 #ifdef __POWERPC__
25     #define NO_STD_NAMESPACE
26     #endif
27    
28 cebix 1.1 #include <assert.h>
29     #include <support/SupportDefs.h>
30     #include <support/ByteOrder.h>
31    
32 cebix 1.2 #include "user_strings_beos.h"
33    
34 cebix 1.1 // Are the Mac and the host address space the same?
35     #ifdef __i386__
36     #define REAL_ADDRESSING 0
37 cebix 1.7 #undef WORDS_BIGENDIAN
38 cebix 1.1 #else
39     #define REAL_ADDRESSING 1
40 cebix 1.7 #define WORDS_BIGENDIAN 1
41 cebix 1.1 #endif
42    
43 cebix 1.9 // Using 68k emulator
44 cebix 1.1 #define EMULATED_68K 1
45    
46 cebix 1.9 // Mac ROM is write protected
47 cebix 1.1 #define ROM_IS_WRITE_PROTECTED 1
48    
49 cebix 1.4 // ExtFS is supported
50     #define SUPPORTS_EXTFS 1
51    
52 cebix 1.15 // BSD socket API is supported
53     #define SUPPORTS_UDP_TUNNEL 1
54    
55 cebix 1.5 // mon is not supported
56 cebix 1.9 #undef ENABLE_MON
57 cebix 1.5
58 cebix 1.1 // Time data type for Time Manager emulation
59     typedef bigtime_t tm_time_t;
60    
61     // 64 bit file offsets
62     typedef off_t loff_t;
63 cebix 1.15
64     // Networking types
65     #define PF_INET AF_INET
66     typedef int socklen_t;
67 cebix 1.1
68     // UAE CPU data types
69     #define uae_s8 int8
70     #define uae_u8 uint8
71     #define uae_s16 int16
72     #define uae_u16 uint16
73     #define uae_s32 int32
74     #define uae_u32 uint32
75 cebix 1.6 #define uae_s64 int64
76     #define uae_u64 uint64
77 cebix 1.1 typedef uae_u32 uaecptr;
78 cebix 1.6 #define VAL64(a) (a ## LL)
79     #define UVAL64(a) (a ## uLL)
80 cebix 1.12 typedef uint32 uintptr;
81     typedef int32 intptr;
82 cebix 1.1
83     // UAE CPU defines
84     #ifdef __i386__
85    
86     // Intel x86 assembler optimizations
87     #define X86_PPRO_OPT
88     static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;}
89     #ifdef X86_PPRO_OPT
90     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;}
91     #else
92     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;}
93     #endif
94     #define HAVE_GET_WORD_UNSWAPPED
95     #define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a)))
96     static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
97     #ifdef X86_PPRO_OPT
98     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;}
99     #else
100     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
101     #endif
102    
103     #define X86_ASSEMBLY
104 cebix 1.11 #define UNALIGNED_PROFITABLE
105     #define OPTIMIZED_FLAGS
106 cebix 1.1 #define ASM_SYM_FOR_FUNC(a) __asm__(a)
107     #define REGPARAM __attribute__((regparm(3)))
108    
109     #else
110    
111     // PowerPC (memory.cpp not used, so no optimization neccessary)
112     static inline uae_u32 do_get_mem_long(uae_u32 *a) {return *a;}
113     static inline uae_u32 do_get_mem_word(uae_u16 *a) {return *a;}
114     static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = v;}
115     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;}
116    
117     #undef X86_ASSEMBLY
118 cebix 1.11 #define UNALIGNED_PROFITABLE
119     #undef OPTIMIZED_FLAGS
120 cebix 1.1 #define ASM_SYM_FOR_FUNC(a)
121     #define REGPARAM
122     #endif
123    
124     #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a)))
125     #define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v))
126    
127     #define call_mem_get_func(func, addr) ((*func)(addr))
128     #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
129     #define __inline__ inline
130     #define CPU_EMU_SIZE 0
131     #undef NO_INLINE_MEMORY_ACCESS
132     #undef MD_HAVE_MEM_1_FUNCS
133     #undef USE_COMPILER
134     #define REGPARAM2
135     #define ENUMDECL typedef enum
136     #define ENUMNAME(name) name
137     #define write_log printf
138    
139     #endif