--- BasiliskII/src/Unix/sysdeps.h 2000/10/09 17:05:17 1.14 +++ BasiliskII/src/Unix/sysdeps.h 2002/11/05 10:32:05 1.25 @@ -1,7 +1,7 @@ /* * sysdeps.h - System dependent definitions for Unix * - * Basilisk II (C) 1997-2000 Christian Bauer + * Basilisk II (C) 1997-2002 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +43,10 @@ #include #include +#ifdef HAVE_PTHREADS +# include +#endif + #ifdef HAVE_FCNTL_H # include #endif @@ -103,6 +107,9 @@ /* ExtFS is supported */ #define SUPPORTS_EXTFS 1 +/* BSD socket API supported */ +#define SUPPORTS_UDP_TUNNEL 1 + /* Data types */ typedef unsigned char uint8; @@ -155,8 +162,13 @@ typedef struct timespec tm_time_t; typedef struct timeval tm_time_t; #endif -/* Offset Mac->Unix time in seconds */ -#define TIME_OFFSET 0x7c25b080 +/* Define codes for all the float formats that we know of. + * Though we only handle IEEE format. */ +#define UNKNOWN_FLOAT_FORMAT 0 +#define IEEE_FLOAT_FORMAT 1 +#define VAX_FLOAT_FORMAT 2 +#define IBM_FLOAT_FORMAT 3 +#define C4X_FLOAT_FORMAT 4 /* UAE CPU data types */ #define uae_s8 int8 @@ -170,7 +182,7 @@ typedef struct timeval tm_time_t; typedef uae_u32 uaecptr; /* Alignment restrictions */ -#if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) +#if defined(__i386__) || defined(__powerpc__) || defined(__m68k__) || defined(__x86_64__) # define CPU_CAN_ACCESS_UNALIGNED #endif @@ -178,6 +190,11 @@ typedef uae_u32 uaecptr; extern uint64 GetTicks_usec(void); extern void Delay_usec(uint32 usec); +#ifdef HAVE_PTHREADS +/* Centralized pthread attribute setup */ +void Set_pthread_attr(pthread_attr_t *attr, int priority); +#endif + /* UAE CPU defines */ #ifdef WORDS_BIGENDIAN @@ -218,7 +235,7 @@ static inline void do_put_mem_word(uae_u #else /* WORDS_BIGENDIAN */ -#ifdef __i386__ +#if defined(__i386__) || defined(__x86_64__) /* Intel x86 */ #define X86_PPRO_OPT @@ -236,6 +253,15 @@ static inline void do_put_mem_word(uae_u #else static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} #endif +#define HAVE_OPTIMIZED_BYTESWAP_32 +/* bswap doesn't affect condition codes */ +static inline uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;} +#define HAVE_OPTIMIZED_BYTESWAP_16 +#ifdef X86_PPRO_OPT +static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); return v;} +#else +static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); return v;} +#endif #elif defined(CPU_CAN_ACCESS_UNALIGNED) @@ -257,6 +283,16 @@ static inline void do_put_mem_word(uae_u #endif /* WORDS_BIGENDIAN */ +#ifndef HAVE_OPTIMIZED_BYTESWAP_32 +static inline uae_u32 do_byteswap_32(uae_u32 v) + { return (((v >> 24) & 0xff) | ((v >> 8) & 0xff00) | ((v & 0xff) << 24) | ((v & 0xff00) << 8)); } +#endif + +#ifndef HAVE_OPTIMIZED_BYTESWAP_16 +static inline uae_u32 do_byteswap_16(uae_u32 v) + { return (((v >> 8) & 0xff) | ((v & 0xff) << 8)); } +#endif + #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a))) #define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v)) @@ -270,16 +306,6 @@ static inline void do_put_mem_word(uae_u #define ENUMNAME(name) name #define write_log printf -#ifdef USE_COMPILER -#define USE_MAPPED_MEMORY -#define CAN_MAP_MEMORY -#define NO_EXCEPTION_3 -#define NO_PREFETCH_BUFFER -#else -#undef USE_MAPPED_MEMORY -#undef CAN_MAP_MEMORY -#endif - #ifdef X86_ASSEMBLY #define ASM_SYM_FOR_FUNC(a) __asm__(a) #else