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.21 by cebix, 2004-01-12T15:37:22Z vs.
Revision 1.27 by gbeauche, 2004-05-12T11:38:16Z

# Line 44 | Line 44
44   #include <string.h>
45   #include <signal.h>
46  
47 + #ifdef HAVE_PTHREADS
48 + # include <pthread.h>
49 + #endif
50 +
51   #ifdef HAVE_FCNTL_H
52   # include <fcntl.h>
53   #endif
# Line 139 | Line 143 | typedef int64 intptr;
143   **/
144  
145   #if defined(__GNUC__)
146 < #if defined(__x86_64__)
146 > #if defined(__x86_64__) || defined(__i386__)
147   // Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h>
148   #define opt_bswap_32 do_opt_bswap_32
149   static inline uint32 do_opt_bswap_32(uint32 x)
# Line 184 | Line 188 | static inline uint32 generic_bswap_32(ui
188                    ((x & 0x000000ff) << 24) );
189   }
190  
191 + #if defined(__i386__)
192 + #define opt_bswap_64 do_opt_bswap_64
193 + static inline uint64 do_opt_bswap_64(uint64 x)
194 + {
195 +  return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32));
196 + }
197 + #endif
198 +
199   #ifdef  opt_bswap_64
200   #undef  bswap_64
201   #define bswap_64 opt_bswap_64
# Line 217 | Line 229 | static inline uint64 tswap64(uint64 x) {
229   // spin locks
230   #ifdef __GNUC__
231  
232 < #ifdef __powerpc__
232 > #if defined(__powerpc__) || defined(__ppc__)
233   #define HAVE_TEST_AND_SET 1
234   static inline int testandset(volatile int *p)
235   {
236          int ret;
237 <        __asm__ __volatile__("0:    lwarx %0,0,%1 ;"
238 <                                                 "      xor. %0,%3,%0;"
239 <                                                 "      bne 1f;"
240 <                                                 "      stwcx. %2,0,%1;"
241 <                                                 "      bne- 0b;"
237 >        __asm__ __volatile__("0:    lwarx       %0,0,%1\n"
238 >                                                 "      xor.    %0,%3,%0\n"
239 >                                                 "      bne             1f\n"
240 >                                                 "      stwcx.  %2,0,%1\n"
241 >                                                 "      bne-    0b\n"
242                                                   "1:    "
243                                                   : "=&r" (ret)
244                                                   : "r" (p), "r" (1), "r" (0)
# Line 348 | Line 360 | typedef struct timeval tm_time_t;
360   extern uint64 GetTicks_usec(void);
361   extern void Delay_usec(uint32 usec);
362  
363 + #if defined(HAVE_PTHREADS) || (defined(__linux__) && defined(__powerpc__))
364   // Setup pthread attributes
365   extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
366 + #endif
367  
368   // Various definitions
369   typedef struct rgb_color {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines