ia64/xen-unstable

annotate xen/include/xen/lib.h @ 11212:ca9f3a7b1b03

[XEN] Remove shadow2 dependencies from common code.
Disable debugtrace functionality even in debug builds:
it's currently only used by shadow2 maintainers.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Aug 18 17:59:26 2006 +0100 (2006-08-18)
parents 0f917d63e960
children 3409c35a0b0e
rev   line source
kaf24@1210 1 #ifndef __LIB_H__
kaf24@1210 2 #define __LIB_H__
kaf24@1210 3
kaf24@4809 4 #include <xen/inttypes.h>
kaf24@1210 5 #include <stdarg.h>
kaf24@3827 6 #include <xen/config.h>
kaf24@1210 7 #include <xen/types.h>
cl349@5285 8 #include <xen/xmalloc.h>
kaf24@1486 9 #include <xen/string.h>
kaf24@1210 10
kfraser@10577 11 extern void __bug(char *file, int line) __attribute__((noreturn));
kfraser@10577 12 #define BUG() __bug(__FILE__, __LINE__)
kaf24@3848 13 #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
kaf24@3848 14
kaf24@9878 15 /* Force a compilation error if condition is true */
kaf24@9878 16 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
kaf24@9878 17
kaf24@1210 18 #ifndef NDEBUG
kfraser@10577 19 #define ASSERT(_p) \
kfraser@10577 20 do { \
tdeegan@11172 21 if ( unlikely(!(_p)) ) \
kfraser@10577 22 { \
kfraser@10577 23 printk("Assertion '%s' failed, line %d, file %s\n", #_p , \
kfraser@10577 24 __LINE__, __FILE__); \
kfraser@10577 25 BUG(); \
kfraser@10577 26 } \
kfraser@10577 27 } while ( 0 )
kaf24@1210 28 #else
kaf24@1210 29 #define ASSERT(_p) ((void)0)
kaf24@1210 30 #endif
kaf24@1210 31
kaf24@2635 32 #define SWAP(_a, _b) \
kaf24@2635 33 do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
kaf24@2635 34
iap10@4606 35 #define DIV_ROUND(x, y) (((x) + (y) / 2) / (y))
arun@3920 36
kaf24@3354 37 #define reserve_bootmem(_p,_l) ((void)0)
kaf24@1210 38
cl349@2448 39 struct domain;
cl349@2448 40
kaf24@3338 41 void cmdline_parse(char *cmdline);
kaf24@3338 42
kfraser@11212 43 /*#define DEBUG_TRACE_DUMP*/
kfraser@11212 44 #ifdef DEBUG_TRACE_DUMP
kaf24@3875 45 extern void debugtrace_dump(void);
kaf24@3827 46 extern void debugtrace_printk(const char *fmt, ...);
kaf24@3827 47 #else
kaf24@3875 48 #define debugtrace_dump() ((void)0)
kaf24@3875 49 #define debugtrace_printk(_f, ...) ((void)0)
kaf24@3827 50 #endif
kaf24@3827 51
kaf24@4654 52 /* Allows us to use '%p' as general-purpose machine-word format char. */
kaf24@4654 53 #define _p(_x) ((void *)(unsigned long)(_x))
kaf24@4654 54 #define printk(_f , _a...) printf( _f , ## _a )
kaf24@4654 55 extern void printf(const char *format, ...)
kaf24@4654 56 __attribute__ ((format (printf, 1, 2)));
kaf24@9454 57 extern void panic(const char *format, ...)
kaf24@9454 58 __attribute__ ((format (printf, 1, 2)));
kaf24@4654 59 extern long vm_assist(struct domain *, unsigned int, unsigned int);
kaf24@1210 60
kaf24@1210 61 /* vsprintf.c */
kaf24@1210 62 extern int sprintf(char * buf, const char * fmt, ...)
kaf24@4654 63 __attribute__ ((format (printf, 2, 3)));
kaf24@8520 64 extern int vsprintf(char *buf, const char *, va_list)
kaf24@8520 65 __attribute__ ((format (printf, 2, 0)));
kaf24@1210 66 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
kaf24@4654 67 __attribute__ ((format (printf, 3, 4)));
kaf24@8520 68 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
kaf24@8520 69 __attribute__ ((format (printf, 3, 0)));
kaf24@8520 70 extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
kaf24@8520 71 __attribute__ ((format (printf, 3, 4)));
kaf24@8520 72 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
kaf24@8520 73 __attribute__ ((format (printf, 3, 0)));
kaf24@1210 74
kaf24@4850 75 long simple_strtol(
kaf24@4850 76 const char *cp,char **endp, unsigned int base);
kaf24@4850 77 unsigned long simple_strtoul(
kaf24@4850 78 const char *cp,char **endp, unsigned int base);
kaf24@4850 79 long long simple_strtoll(
kaf24@4850 80 const char *cp,char **endp, unsigned int base);
kaf24@4850 81 unsigned long long simple_strtoull(
kaf24@4850 82 const char *cp,char **endp, unsigned int base);
kaf24@4850 83
kaf24@5018 84 unsigned long long parse_size_and_unit(char *s);
kaf24@1210 85
kaf24@8846 86 #define TAINT_UNSAFE_SMP (1<<0)
kaf24@8846 87 #define TAINT_MACHINE_CHECK (1<<1)
kaf24@8846 88 #define TAINT_BAD_PAGE (1<<2)
kaf24@10500 89 #define TAINT_SYNC_CONSOLE (1<<3)
kaf24@8846 90 extern int tainted;
kaf24@8846 91 #define TAINT_STRING_MAX_LEN 20
kaf24@8846 92 extern char *print_tainted(char *str);
kaf24@8846 93 extern void add_taint(unsigned);
kaf24@8846 94
kaf24@1210 95 #endif /* __LIB_H__ */