--- BasiliskII/src/Unix/sysdeps.h 1999/10/19 17:41:38 1.5 +++ BasiliskII/src/Unix/sysdeps.h 2001/07/03 15:59:47 1.18 @@ -1,7 +1,7 @@ /* * sysdeps.h - System dependent definitions for Unix * - * Basilisk II (C) 1997-1999 Christian Bauer + * Basilisk II (C) 1997-2001 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 @@ -42,7 +42,6 @@ #include #include #include -#include #ifdef HAVE_FCNTL_H # include @@ -60,14 +59,50 @@ #endif -/* Are the Mac and the host address space the same? */ +#ifdef ENABLE_NATIVE_M68K + +/* Mac and host address space are the same */ +#define REAL_ADDRESSING 1 + +/* Using 68k natively */ +#define EMULATED_68K 0 + +/* Mac ROM is not write protected */ +#define ROM_IS_WRITE_PROTECTED 0 +#define USE_SCRATCHMEM_SUBTERFUGE 1 + +#else + +/* Mac and host address space are distinct */ +#ifndef REAL_ADDRESSING #define REAL_ADDRESSING 0 +#endif -/* Are we using a 68k emulator or the real thing? */ +/* Using 68k emulator */ #define EMULATED_68K 1 -/* Is the Mac ROM write protected? */ -#define ROM_IS_WRITE_PROTECTED 1 +/* The m68k emulator uses a prefetch buffer ? */ +#define USE_PREFETCH_BUFFER 0 + +/* Mac ROM is write protected when banked memory is used */ +#if REAL_ADDRESSING || DIRECT_ADDRESSING +# define ROM_IS_WRITE_PROTECTED 0 +# define USE_SCRATCHMEM_SUBTERFUGE 1 +#else +# define ROM_IS_WRITE_PROTECTED 1 +#endif + +#endif + +/* Direct Addressing requires Video on SEGV signals */ +#if DIRECT_ADDRESSING && !ENABLE_VOSF +# undef ENABLE_VOSF +# define ENABLE_VOSF 1 +#endif + +/* ExtFS is supported */ +#define SUPPORTS_EXTFS 1 + /* Data types */ typedef unsigned char uint8; @@ -93,12 +128,25 @@ typedef long int32; #if SIZEOF_LONG == 8 typedef unsigned long uint64; typedef long int64; +#define VAL64(a) (a ## l) +#define UVAL64(a) (a ## ul) #elif SIZEOF_LONG_LONG == 8 typedef unsigned long long uint64; typedef long long int64; +#define VAL64(a) (a ## LL) +#define UVAL64(a) (a ## uLL) #else #error "No 8 byte type, you lose." #endif +#if SIZEOF_VOID_P == 4 +typedef uint32 uintptr; +typedef int32 intptr; +#elif SIZEOF_VOID_P == 8 +typedef uint64 uintptr; +typedef int64 intptr; +#else +#error "Unsupported size of pointer" +#endif /* Time data type for Time Manager emulation */ #ifdef HAVE_CLOCK_GETTIME @@ -117,6 +165,8 @@ typedef struct timeval tm_time_t; #define uae_u16 uint16 #define uae_s32 int32 #define uae_u32 uint32 +#define uae_s64 int64 +#define uae_u64 uint64 typedef uae_u32 uaecptr; /* Alignment restrictions */ @@ -124,6 +174,10 @@ typedef uae_u32 uaecptr; # define CPU_CAN_ACCESS_UNALIGNED #endif +/* Timing functions */ +extern uint64 GetTicks_usec(void); +extern void Delay_usec(uint32 usec); + /* UAE CPU defines */ #ifdef WORDS_BIGENDIAN @@ -182,6 +236,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) @@ -203,6 +266,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)) @@ -210,11 +283,8 @@ static inline void do_put_mem_word(uae_u #define call_mem_put_func(func, addr, v) ((*func)(addr, v)) #define __inline__ inline #define CPU_EMU_SIZE 0 -#undef USE_MAPPED_MEMORY -#undef CAN_MAP_MEMORY #undef NO_INLINE_MEMORY_ACCESS #undef MD_HAVE_MEM_1_FUNCS -#undef USE_COMPILER #define ENUMDECL typedef enum #define ENUMNAME(name) name #define write_log printf