ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/BeOS/sysdeps.h
Revision: 1.1.1.1 (vendor branch)
Committed: 1999-10-03T14:16:25Z (25 years, 1 month ago) by cebix
Content type: text/plain
Branch: cebix
CVS Tags: release-0_7-2, start
Changes since 1.1: +0 -0 lines
Log Message:
Imported sources

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * sysdeps.h - System dependent definitions for BeOS
3     *
4     * Basilisk II (C) 1997-1999 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
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     // Are the Mac and the host address space the same?
29     #ifdef __i386__
30     #define REAL_ADDRESSING 0
31     #else
32     #define REAL_ADDRESSING 1
33     #endif
34    
35     // Are we using a 68k emulator or the real thing?
36     #define EMULATED_68K 1
37    
38     // Is the Mac ROM write protected?
39     #define ROM_IS_WRITE_PROTECTED 1
40    
41     // Time data type for Time Manager emulation
42     typedef bigtime_t tm_time_t;
43    
44     // 64 bit file offsets
45     typedef off_t loff_t;
46    
47     // UAE CPU data types
48     #define uae_s8 int8
49     #define uae_u8 uint8
50     #define uae_s16 int16
51     #define uae_u16 uint16
52     #define uae_s32 int32
53     #define uae_u32 uint32
54     typedef uae_u32 uaecptr;
55    
56     // UAE CPU defines
57     #ifdef __i386__
58    
59     // Intel x86 assembler optimizations
60     #define X86_PPRO_OPT
61     static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;}
62     #ifdef X86_PPRO_OPT
63     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;}
64     #else
65     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;}
66     #endif
67     #define HAVE_GET_WORD_UNSWAPPED
68     #define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a)))
69     static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
70     #ifdef X86_PPRO_OPT
71     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;}
72     #else
73     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;}
74     #endif
75    
76     #define X86_ASSEMBLY
77     #define ASM_SYM_FOR_FUNC(a) __asm__(a)
78     #define REGPARAM __attribute__((regparm(3)))
79    
80     #else
81    
82     // PowerPC (memory.cpp not used, so no optimization neccessary)
83     static inline uae_u32 do_get_mem_long(uae_u32 *a) {return *a;}
84     static inline uae_u32 do_get_mem_word(uae_u16 *a) {return *a;}
85     static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = v;}
86     static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;}
87    
88     #undef X86_ASSEMBLY
89     #define ASM_SYM_FOR_FUNC(a)
90     #define REGPARAM
91     #endif
92    
93     #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a)))
94     #define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v))
95    
96     #define call_mem_get_func(func, addr) ((*func)(addr))
97     #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
98     #define __inline__ inline
99     #define CPU_EMU_SIZE 0
100     #undef USE_MAPPED_MEMORY
101     #undef CAN_MAP_MEMORY
102     #undef NO_INLINE_MEMORY_ACCESS
103     #undef MD_HAVE_MEM_1_FUNCS
104     #undef USE_COMPILER
105     #define REGPARAM2
106     #define ENUMDECL typedef enum
107     #define ENUMNAME(name) name
108     #define write_log printf
109    
110     #endif