Thu, 08 Dec 2011 23:44:19 +0000
[musashi] fix stackframe type for bus errors
Bus errors incorrectly pushed a Type 0000 stackframe, when they should have pushed a Type 1000 (Type $8) stackframe.
Also, type 1000 frames were not handled for 68010 CPUs. They are now, but code must later be added to handle them for 68020s. FIXME!
Reported-By: Armin Diehl <ad ardiehl.de>
1 #ifndef _UTILS_H
2 #define _UTILS_H
4 #include <stdio.h>
6 #ifndef NDEBUG
7 /// Log a message to stderr
8 # define LOG(x, ...) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
9 # define LOGS(x) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
10 /// Log a message to stderr if 'cond' is true
11 # define LOG_IF(cond, x, ...) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
12 # define LOG_IFS(cond, x) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } while (0)
13 #else
14 #define LOG(x, ...)
15 #define LOGS(x)
16 #define LOG_IF(cond, x, ...)
17 #define LOG_IFS(cond, x)
18 #endif
20 /// Get the number of elements in an array
21 #define NELEMS(x) (sizeof(x)/sizeof(x[0]))
23 #endif // _H_UTILS