ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/sysdeps.h
(Generate patch)

Comparing SheepShaver/src/Unix/sysdeps.h (file contents):
Revision 1.2 by cebix, 2002-02-21T15:12:12Z vs.
Revision 1.5 by gbeauche, 2003-09-07T14:19:25Z

# Line 59 | Line 59
59   # endif
60   #endif
61  
62 < // Are we using a PPC emulator or the real thing?
63 < #ifdef __powerpc__
64 < #define EMULATED_PPC 0
65 < #else
66 < #define EMULATED_PPC 1
67 < #endif
62 > // Define for external components
63 > #define SHEEPSHAVER 1
64 >
65 > // Mac and host address space are the same
66 > #define REAL_ADDRESSING 1
67  
68   #define POWERPC_ROM 1
69  
70 + #if EMULATED_PPC
71 + // Mac ROM is write protected when banked memory is used
72 + #if REAL_ADDRESSING || DIRECT_ADDRESSING
73 + # define ROM_IS_WRITE_PROTECTED 0
74 + # define USE_SCRATCHMEM_SUBTERFUGE 1
75 + #else
76 + # define ROM_IS_WRITE_PROTECTED 1
77 + #endif
78 + #else
79 + // Mac ROM is write protected
80 + #define ROM_IS_WRITE_PROTECTED 1
81 + #define USE_SCRATCHMEM_SUBTERFUGE 0
82 + #endif
83 +
84   // Data types
85   typedef unsigned char uint8;
86   typedef signed char int8;
# Line 92 | Line 105 | typedef long int32;
105   #if SIZEOF_LONG == 8
106   typedef unsigned long uint64;
107   typedef long int64;
108 + #define VAL64(a) (a ## l)
109 + #define UVAL64(a) (a ## ul)
110   #elif SIZEOF_LONG_LONG == 8
111   typedef unsigned long long uint64;
112   typedef long long int64;
113 + #define VAL64(a) (a ## LL)
114 + #define UVAL64(a) (a ## uLL)
115   #else
116   #error "No 8 byte type, you lose."
117   #endif
118 + #if SIZEOF_VOID_P == 4
119 + typedef uint32 uintptr;
120 + typedef int32 intptr;
121 + #elif SIZEOF_VOID_P == 8
122 + typedef uint64 uintptr;
123 + typedef int64 intptr;
124 + #else
125 + #error "Unsupported size of pointer"
126 + #endif
127 +
128 + // Helper functions to byteswap data
129 + #ifdef HAVE_BYTESWAP_H
130 + #include <byteswap.h>
131 + #endif
132 +
133 + #ifndef bswap_16
134 + #define bswap_16 generic_bswap_16
135 + #endif
136 +
137 + static inline uint16 generic_bswap_16(uint16 x)
138 + {
139 +  return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
140 + }
141 +
142 + #ifndef bswap_32
143 + #define bswap_32 generic_bswap_32
144 + #endif
145 +
146 + static inline uint32 generic_bswap_32(uint32 x)
147 + {
148 +  return (((x & 0xff000000) >> 24) |
149 +                  ((x & 0x00ff0000) >>  8) |
150 +                  ((x & 0x0000ff00) <<  8) |
151 +                  ((x & 0x000000ff) << 24) );
152 + }
153 +
154 + #ifndef bswap_64
155 + #define bswap_64 generic_bswap_64
156 + #endif
157 +
158 + static inline uint64 generic_bswap_64(uint64 x)
159 + {
160 +  return (((x & UVAL64(0xff00000000000000)) >> 56) |
161 +                  ((x & UVAL64(0x00ff000000000000)) >> 40) |
162 +                  ((x & UVAL64(0x0000ff0000000000)) >> 24) |
163 +                  ((x & UVAL64(0x000000ff00000000)) >>  8) |
164 +                  ((x & UVAL64(0x00000000ff000000)) <<  8) |
165 +                  ((x & UVAL64(0x0000000000ff0000)) << 24) |
166 +                  ((x & UVAL64(0x000000000000ff00)) << 40) |
167 +                  ((x & UVAL64(0x00000000000000ff)) << 56) );
168 + }
169 +
170 + #ifdef WORDS_BIGENDIAN
171 + static inline uint16 tswap16(uint16 x) { return x; }
172 + static inline uint32 tswap32(uint32 x) { return x; }
173 + static inline uint64 tswap64(uint64 x) { return x; }
174 + #else
175 + static inline uint16 tswap16(uint16 x) { return bswap_16(x); }
176 + static inline uint32 tswap32(uint32 x) { return bswap_32(x); }
177 + static inline uint64 tswap64(uint64 x) { return bswap_64(x); }
178 + #endif
179  
180   // Time data type for Time Manager emulation
181   #ifdef HAVE_CLOCK_GETTIME
# Line 127 | Line 205 | typedef struct rgb_color {
205   #define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6)
206   #define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6, (uint32)arg7)
207  
208 < extern "C" uint32 call_macos(uint32 tvect);
209 < extern "C" uint32 call_macos1(uint32 tvect, uint32 arg1);
210 < extern "C" uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2);
211 < extern "C" uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3);
212 < extern "C" uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4);
213 < extern "C" uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5);
214 < extern "C" uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6);
215 < extern "C" uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7);
208 > #ifdef __cplusplus
209 > extern "C" {
210 > #endif
211 > extern uint32 call_macos(uint32 tvect);
212 > extern uint32 call_macos1(uint32 tvect, uint32 arg1);
213 > extern uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2);
214 > extern uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3);
215 > extern uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4);
216 > extern uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5);
217 > extern uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6);
218 > extern uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7);
219 > #ifdef __cplusplus
220 > }
221 > #endif
222  
223   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines