--- trunk/src/include/misc.h 2007/10/08 16:20:40 30 +++ upstream/0.4.4/src/include/misc.h 2007/10/08 16:21:26 35 @@ -2,7 +2,7 @@ #define MISC_H /* - * Copyright (C) 2003-2006 Anders Gavare. All rights reserved. + * Copyright (C) 2003-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * - * $Id: misc.h,v 1.242 2006/07/25 21:03:25 debug Exp $ + * $Id: misc.h,v 1.249 2006/12/30 13:31:01 debug Exp $ * * Misc. definitions for gxemul. */ @@ -52,16 +52,20 @@ * The correct solution is to upgrade your compiler to C99. */ #ifdef NO_C99_64BIT_LONGLONG +#define PRIi8 "i" #define PRIi16 "i" #define PRIi32 "i" #define PRIi64 "lli" +#define PRIx8 "x" #define PRIx16 "x" #define PRIx32 "x" #define PRIx64 "llx" #else +#define PRIi8 "i" #define PRIi16 "i" #define PRIi32 "i" #define PRIi64 "li" +#define PRIx8 "x" #define PRIx16 "x" #define PRIx32 "x" #define PRIx64 "lx" @@ -107,28 +111,51 @@ struct memory; -#define NO_BYTE_ORDER_OVERRIDE -1 -#define EMUL_LITTLE_ENDIAN 0 -#define EMUL_BIG_ENDIAN 1 +#define NO_BYTE_ORDER_OVERRIDE -1 +#define EMUL_UNDEFINED_ENDIAN 0 +#define EMUL_LITTLE_ENDIAN 1 +#define EMUL_BIG_ENDIAN 2 #ifdef HOST_LITTLE_ENDIAN #define LE16_TO_HOST(x) (x) -#define BE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) +#define BE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) #else -#define LE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) +#define LE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) #define BE16_TO_HOST(x) (x) #endif #ifdef HOST_LITTLE_ENDIAN #define LE32_TO_HOST(x) (x) -#define BE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ +#define BE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ (((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8)) #else -#define LE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ +#define LE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ (((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8)) #define BE32_TO_HOST(x) (x) #endif +#ifdef HOST_LITTLE_ENDIAN +#define LE64_TO_HOST(x) (x) +#define BE64_TO_HOST(x) ( (((x) >> 56) & 0xff) + \ + ((((x) >> 48) & 0xff) << 8) + \ + ((((x) >> 40) & 0xff) << 16) + \ + ((((x) >> 32) & 0xff) << 24) + \ + ((((x) >> 24) & 0xff) << 32) + \ + ((((x) >> 16) & 0xff) << 40) + \ + ((((x) >> 8) & 0xff) << 48) + \ + (((x) & 0xff) << 56) ) +#else +#define BE64_TO_HOST(x) (x) +#define LE64_TO_HOST(x) ( (((x) >> 56) & 0xff) + \ + ((((x) >> 48) & 0xff) << 8) + \ + ((((x) >> 40) & 0xff) << 16) + \ + ((((x) >> 32) & 0xff) << 24) + \ + ((((x) >> 24) & 0xff) << 32) + \ + ((((x) >> 16) & 0xff) << 40) + \ + ((((x) >> 8) & 0xff) << 48) + \ + (((x) & 0xff) << 56) ) +#endif + /* Debug stuff: */ #define DEBUG_BUFSIZE 1024 @@ -139,6 +166,15 @@ int decstation_prom_emul(struct cpu *cpu); +/* dreamcast.c: */ +void dreamcast_machine_setup(struct machine *); +int dreamcast_emul(struct cpu *cpu); + + +/* dreamcast_scramble.c: */ +void dreamcast_descramble(char *from, char *to); + + /* file.c: */ int file_n_executables_loaded(void); void file_load(struct machine *machine, struct memory *mem, @@ -181,7 +217,8 @@ /* yamon.c: */ -int yamon_emul(struct cpu *cpu); +void yamon_machine_setup(struct machine *machine, uint64_t env); +int yamon_emul(struct cpu *); #endif /* MISC_H */