ia64/xen-unstable

view xen/common/libelf/libelf-private.h @ 18594:5e4e234d58be

x86: Define __per_cpu_shift label to help kdump/crashdump.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 08 13:11:06 2008 +0100 (2008-10-08)
parents 90c37c32182c
children 7df072566b8c
line source
1 #ifndef __LIBELF_PRIVATE_H__
2 #define __LIBELF_PRIVATE_H_
4 #ifdef __XEN__
6 #include <xen/config.h>
7 #include <xen/types.h>
8 #include <xen/string.h>
9 #include <xen/lib.h>
10 #include <asm/byteorder.h>
11 #include <public/elfnote.h>
12 #include <public/libelf.h>
14 #define elf_msg(elf, fmt, args ... ) \
15 if (elf->verbose) printk(fmt, ## args )
16 #define elf_err(elf, fmt, args ... ) \
17 printk(fmt, ## args )
19 #define strtoull(str, end, base) simple_strtoull(str, end, base)
20 #define bswap_16(x) swab16(x)
21 #define bswap_32(x) swab32(x)
22 #define bswap_64(x) swab64(x)
24 #else /* !__XEN__ */
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <stddef.h>
30 #include <inttypes.h>
31 #ifdef __sun__
32 #include <sys/byteorder.h>
33 #define bswap_16(x) BSWAP_16(x)
34 #define bswap_32(x) BSWAP_32(x)
35 #define bswap_64(x) BSWAP_64(x)
36 #elif defined(__NetBSD__)
37 #include <sys/bswap.h>
38 #define bswap_16(x) bswap16(x)
39 #define bswap_32(x) bswap32(x)
40 #define bswap_64(x) bswap64(x)
41 #elif defined(__OpenBSD__)
42 #include <machine/endian.h>
43 #define bswap_16(x) swap16(x)
44 #define bswap_32(x) swap32(x)
45 #define bswap_64(x) swap64(x)
46 #elif defined(__linux__) || defined(__Linux__) || defined(__MINIOS__)
47 #include <byteswap.h>
48 #else
49 #error Unsupported OS
50 #endif
51 #include <xen/elfnote.h>
52 #include <xen/libelf.h>
54 #include "xenctrl.h"
55 #include "xc_private.h"
57 #define elf_msg(elf, fmt, args ... ) \
58 if (elf->log && elf->verbose) fprintf(elf->log, fmt , ## args )
59 #define elf_err(elf, fmt, args ... ) do { \
60 if (elf->log) \
61 fprintf(elf->log, fmt , ## args ); \
62 xc_set_error(XC_INVALID_KERNEL, fmt , ## args ); \
63 } while (0)
65 #define safe_strcpy(d,s) \
66 do { strncpy((d),(s),sizeof((d))-1); \
67 (d)[sizeof((d))-1] = '\0'; \
68 } while (0)
70 #endif
72 #endif /* __LIBELF_PRIVATE_H_ */
74 /*
75 * Local variables:
76 * mode: C
77 * c-set-style: "BSD"
78 * c-basic-offset: 4
79 * tab-width: 4
80 * indent-tabs-mode: nil
81 * End:
82 */