Xen Test Framework
asm_macros.h
Go to the documentation of this file.
1
6#ifndef XTF_ASM_MACROS_H
7#define XTF_ASM_MACROS_H
8
9#include <xtf/numbers.h>
10
11#include <arch/asm_macros.h>
12
13#ifdef __ASSEMBLY__
14
19#define GLOBAL(name) \
20 .globl name; \
21name:
22
27#define ENTRY(name) \
28 ALIGN; \
29 GLOBAL(name)
30
35#define SIZE(name) \
36 .size name, . - name;
37
42#define ENDFUNC(name) \
43 .type name, STT_FUNC; \
44 SIZE(name)
45
52#define DECLSTR(name, val) \
53 .pushsection .rodata.str1, "aMS", @progbits, 1; \
54 name: .asciz val; \
55 .type name, STT_OBJECT; \
56 SIZE(name) \
57 .popsection
58
64#define ELFNOTE(name, type, desc) \
65 .pushsection .note.name, "a", @note ; \
66 .align 4 ; \
67 .long 2f - 1f /* namesz */ ; \
68 .long 4f - 3f /* descsz */ ; \
69 .long type /* type */ ; \
701:.asciz #name /* name */ ; \
712:.align 4 ; \
723:desc /* desc */ ; \
734:.align 4 ; \
74 .popsection
75
76#else
77
78#define ELFNOTE(name, type, desc) \
79 asm (".pushsection .note, \"a\", @note;" \
80 ".align 4;" \
81 ".long 2f - 1f;" /* namesz */ \
82 ".long 4f - 3f;" /* descsz */ \
83 ".long " STR(type) ";" /* type */ \
84 "1: .asciz \"" #name "\";" /* name */ \
85 "2:.align 4;" \
86 "3: " desc ";" /* desc */ \
87 "4:.align 4;" \
88 ".popsection;")
89
90#endif /* __ASSEMBLY__ */
91
92#endif /* XTF_ASM_MACROS_H */
93
94/*
95 * Local variables:
96 * mode: C
97 * c-file-style: "BSD"
98 * c-basic-offset: 4
99 * tab-width: 4
100 * indent-tabs-mode: nil
101 * End:
102 */
Macros for use in x86 assembly files.
Primatives for number manipulation.