2 |
#define MISC_H |
#define MISC_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
6 |
* |
* |
7 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
8 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: misc.h,v 1.231 2005/05/23 18:21:37 debug Exp $ |
* $Id: misc.h,v 1.242 2006/07/25 21:03:25 debug Exp $ |
32 |
* |
* |
33 |
* Misc. definitions for gxemul. |
* Misc. definitions for gxemul. |
34 |
*/ |
*/ |
45 |
|
|
46 |
#include "../../config.h" |
#include "../../config.h" |
47 |
|
|
48 |
/* |
|
49 |
* ENABLE_INSTRUCTION_DELAYS should be defined on the cc commandline using |
#ifdef NO_C99_PRINTF_DEFINES |
50 |
* -D if you want it. (This is done by ./configure --delays) |
/* |
51 |
* |
* This is a SUPER-UGLY HACK which happens to work on some machines. |
52 |
* ALWAYS_SIGNEXTEND_32 is enabled by ./configure --always32 |
* The correct solution is to upgrade your compiler to C99. |
53 |
*/ |
*/ |
54 |
#define USE_TINY_CACHE |
#ifdef NO_C99_64BIT_LONGLONG |
55 |
/* #define HALT_IF_PC_ZERO */ |
#define PRIi16 "i" |
56 |
|
#define PRIi32 "i" |
57 |
|
#define PRIi64 "lli" |
58 |
|
#define PRIx16 "x" |
59 |
|
#define PRIx32 "x" |
60 |
|
#define PRIx64 "llx" |
61 |
|
#else |
62 |
|
#define PRIi16 "i" |
63 |
|
#define PRIi32 "i" |
64 |
|
#define PRIi64 "li" |
65 |
|
#define PRIx16 "x" |
66 |
|
#define PRIx32 "x" |
67 |
|
#define PRIx64 "lx" |
68 |
|
#endif |
69 |
|
#endif |
70 |
|
|
71 |
|
|
72 |
#ifdef NO_MAP_ANON |
#ifdef NO_MAP_ANON |
111 |
#define EMUL_LITTLE_ENDIAN 0 |
#define EMUL_LITTLE_ENDIAN 0 |
112 |
#define EMUL_BIG_ENDIAN 1 |
#define EMUL_BIG_ENDIAN 1 |
113 |
|
|
114 |
|
#ifdef HOST_LITTLE_ENDIAN |
115 |
|
#define LE16_TO_HOST(x) (x) |
116 |
|
#define BE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) |
117 |
|
#else |
118 |
|
#define LE16_TO_HOST(x) ((((x) & 0xff00) >> 8) | (((x)&0xff) << 8)) |
119 |
|
#define BE16_TO_HOST(x) (x) |
120 |
|
#endif |
121 |
|
|
122 |
|
#ifdef HOST_LITTLE_ENDIAN |
123 |
|
#define LE32_TO_HOST(x) (x) |
124 |
|
#define BE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ |
125 |
|
(((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8)) |
126 |
|
#else |
127 |
|
#define LE32_TO_HOST(x) ((((x) & 0xff000000) >> 24) | (((x)&0xff) << 24) | \ |
128 |
|
(((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8)) |
129 |
|
#define BE32_TO_HOST(x) (x) |
130 |
|
#endif |
131 |
|
|
132 |
|
|
133 |
/* Debug stuff: */ |
/* Debug stuff: */ |
134 |
#define DEBUG_BUFSIZE 1024 |
#define DEBUG_BUFSIZE 1024 |
135 |
|
#define DEBUG_INDENTATION 4 |
|
#ifndef DEFAULT_BINTRANS_SIZE_IN_MB |
|
|
#define DEFAULT_BINTRANS_SIZE_IN_MB 16 |
|
|
#endif |
|
136 |
|
|
137 |
|
|
138 |
/* dec_prom.c: */ |
/* dec_prom.c: */ |
150 |
void debug_indentation(int diff); |
void debug_indentation(int diff); |
151 |
void debug(char *fmt, ...); |
void debug(char *fmt, ...); |
152 |
void fatal(char *fmt, ...); |
void fatal(char *fmt, ...); |
|
unsigned long long mystrtoull(const char *s, char **endp, int base); |
|
153 |
|
|
154 |
|
|
155 |
/* of.c: */ |
/* misc.c: */ |
156 |
int of_emul(struct cpu *cpu); |
unsigned long long mystrtoull(const char *s, char **endp, int base); |
157 |
|
int mymkstemp(char *template); |
158 |
|
#ifdef USE_STRLCPY_REPLACEMENTS |
159 |
|
size_t mystrlcpy(char *dst, const char *src, size_t size); |
160 |
|
size_t mystrlcat(char *dst, const char *src, size_t size); |
161 |
|
#endif |
162 |
|
|
163 |
|
|
164 |
/* pc_bios.c: */ |
/* pc_bios.c: */ |
180 |
void useremul_init(void); |
void useremul_init(void); |
181 |
|
|
182 |
|
|
183 |
|
/* yamon.c: */ |
184 |
|
int yamon_emul(struct cpu *cpu); |
185 |
|
|
186 |
|
|
187 |
#endif /* MISC_H */ |
#endif /* MISC_H */ |