debuggers.hg

view xen/common/libelf/libelf-private.h @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents eccfdeb41b80
children
line source
1 /*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation;
5 * version 2.1 of the License.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16 #ifndef __LIBELF_PRIVATE_H__
17 #define __LIBELF_PRIVATE_H_
19 #ifdef __XEN__
21 #include <xen/config.h>
22 #include <xen/types.h>
23 #include <xen/string.h>
24 #include <xen/lib.h>
25 #include <xen/libelf.h>
26 #include <asm/byteorder.h>
27 #include <public/elfnote.h>
29 /* we would like to use elf->log_callback but we can't because
30 * there is no vprintk in Xen */
31 #define elf_msg(elf, fmt, args ... ) \
32 if (elf->verbose) printk(fmt, ## args )
33 #define elf_err(elf, fmt, args ... ) \
34 printk(fmt, ## args )
36 #define strtoull(str, end, base) simple_strtoull(str, end, base)
37 #define bswap_16(x) swab16(x)
38 #define bswap_32(x) swab32(x)
39 #define bswap_64(x) swab64(x)
41 #else /* !__XEN__ */
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 #include <stddef.h>
47 #include <inttypes.h>
48 #ifdef __sun__
49 #include <sys/byteorder.h>
50 #define bswap_16(x) BSWAP_16(x)
51 #define bswap_32(x) BSWAP_32(x)
52 #define bswap_64(x) BSWAP_64(x)
53 #elif defined(__NetBSD__)
54 #include <sys/bswap.h>
55 #define bswap_16(x) bswap16(x)
56 #define bswap_32(x) bswap32(x)
57 #define bswap_64(x) bswap64(x)
58 #elif defined(__OpenBSD__)
59 #include <machine/endian.h>
60 #define bswap_16(x) swap16(x)
61 #define bswap_32(x) swap32(x)
62 #define bswap_64(x) swap64(x)
63 #elif defined(__linux__) || defined(__Linux__) || defined(__MINIOS__)
64 #include <byteswap.h>
65 #else
66 #error Unsupported OS
67 #endif
68 #include <xen/elfnote.h>
69 #include <xen/libelf/libelf.h>
71 #include "xenctrl.h"
72 #include "xc_private.h"
74 #define elf_msg(elf, fmt, args ... ) \
75 elf_call_log_callback(elf, 0, fmt , ## args );
76 #define elf_err(elf, fmt, args ... ) \
77 elf_call_log_callback(elf, 1, fmt , ## args );
79 void elf_call_log_callback(struct elf_binary*, int iserr, const char *fmt,...);
81 #define safe_strcpy(d,s) \
82 do { strncpy((d),(s),sizeof((d))-1); \
83 (d)[sizeof((d))-1] = '\0'; \
84 } while (0)
86 #endif
88 #endif /* __LIBELF_PRIVATE_H_ */
90 /*
91 * Local variables:
92 * mode: C
93 * c-set-style: "BSD"
94 * c-basic-offset: 4
95 * tab-width: 4
96 * indent-tabs-mode: nil
97 * End:
98 */