--- uae/src/include/sysdeps.h 2018/04/24 16:49:04 1.1.1.5 +++ uae/src/include/sysdeps.h 2018/04/24 17:14:48 1.1.1.11 @@ -103,7 +103,7 @@ struct utimbuf }; #endif -#if defined(__GNUC__) && defined(AMIGA) +#if defined(__GNUC__) /* gcc on the amiga need that __attribute((regparm)) must */ /* be defined in function prototypes as well as in */ /* function definitions ! */ @@ -114,7 +114,7 @@ struct utimbuf /* sam: some definitions so that SAS/C can compile UAE */ #if defined(__SASC) && defined(AMIGA) -#define REGPARAM2 +#define REGPARAM2 #define REGPARAM #define S_IRUSR S_IREAD #define S_IWUSR S_IWRITE @@ -144,7 +144,7 @@ struct utimbuf #define memset q_memset #define strdup my_strdup #define random rand -#define creat(x,y) open("T:creat",O_CREAT|O_RDWR,777) +#define creat(x,y) open("T:creat",O_CREAT|O_RDWR|O_TRUNC,777) extern void* q_memset(void*,int,size_t); extern void* q_memcpy(void*,const void*,size_t); #endif @@ -202,7 +202,7 @@ typedef uae_u32 uaecptr; #if SIZEOF_LONG_LONG == 8 #define uae_s64 long long -#define uae_u64 long long +#define uae_u64 unsigned long long #define VAL64(a) (a ## LL) #define UVAL64(a) (a ## uLL) #elif SIZEOF___INT64 == 8 @@ -224,12 +224,20 @@ extern char *my_strdup (const char*s); #endif extern void *xmalloc(size_t); +extern void *xcalloc(size_t, size_t); /* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known * to have problems, and it's likely that other compilers choke too. */ #ifdef __GNUC__ #define ENUMDECL typedef enum #define ENUMNAME(name) name + +/* While we're here, make abort more useful. */ +#define abort() \ + do { \ + write_log ("Internal error; file %s, line %d\n", __FILE__, __LINE__); \ + (abort) (); \ +} while (0) #else #define ENUMDECL enum #define ENUMNAME(name) ; typedef int name @@ -269,7 +277,7 @@ extern void *xmalloc(size_t); #endif -#endif /* _WIN32 */ +#endif /* _WIN32 */ #ifdef DONT_HAVE_POSIX @@ -359,10 +367,53 @@ extern void mallocemu_free (void *ptr); #include "target.h" +#ifdef UAE_CONSOLE +#undef write_log +#define write_log write_log_standard +#endif + +#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 6 +extern void write_log (const char *, ...) __attribute__ ((format (printf, 1, 2))); +#else +extern void write_log (const char *, ...); +#endif + +extern void console_out (const char *, ...); +extern void console_flush (void); +extern int console_get (char *, int); + #ifndef O_BINARY #define O_BINARY 0 #endif #ifndef STATIC_INLINE +#if __GNUC__ - 1 > 1 && __GNUC_MINOR__ - 1 >= 0 +#define STATIC_INLINE static __inline__ __attribute__ ((always_inline)) +#define NOINLINE __attribute__ ((noinline)) +#else #define STATIC_INLINE static __inline__ +#define NOINLINE +#endif #endif + +/* Every Amiga hardware clock cycle takes this many "virtual" cycles. This + used to be hardcoded as 1, but using higher values allows us to time some + stuff more precisely. + 512 is the official value from now on - it can't change, unless we want + _another_ config option "finegrain2_m68k_speed". + + We define this value here rather than in events.h so that gencpu.c sees + it. */ +#define CYCLE_UNIT 512 + +/* This one is used by cfgfile.c. We could reduce the CYCLE_UNIT back to 1, + I'm not 100% sure this code is bug free yet. */ +#define OFFICIAL_CYCLE_UNIT 512 + +/* + * You can specify numbers from 0 to 5 here. It is possible that higher + * numbers will make the CPU emulation slightly faster, but if the setting + * is too high, you will run out of memory while compiling. + * Best to leave this as it is. + */ +#define CPU_EMU_SIZE 0