blob: 14f329c64ba8ee54cf2c4166d09272167c836bd7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_LINKAGE_H
2#define _LINUX_LINKAGE_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <asm/linkage.h>
5
Ingo Molnarffdc1a02008-05-12 21:20:41 +02006#define notrace __attribute__((no_instrument_function))
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#ifdef __cplusplus
9#define CPP_ASMLINKAGE extern "C"
10#else
11#define CPP_ASMLINKAGE
12#endif
13
14#ifndef asmlinkage
15#define asmlinkage CPP_ASMLINKAGE
16#endif
17
Ingo Molnard50efc62008-01-30 13:33:00 +010018#ifndef asmregparm
19# define asmregparm
20#endif
21
Linus Torvaldsd10d89e2008-04-10 17:35:23 -070022/*
23 * This is used by architectures to keep arguments on the stack
24 * untouched by the compiler by keeping them live until the end.
25 * The argument stack may be owned by the assembly-language
26 * caller, not the callee, and gcc doesn't always understand
27 * that.
28 *
29 * We have the return value, and a maximum of six arguments.
30 *
31 * This should always be followed by a "return ret" for the
32 * protection to work (ie no more work that the compiler might
33 * end up needing stack temporaries for).
34 */
Heiko Carstensb0fac022008-04-11 13:46:54 +020035/* Assembly files may be compiled with -traditional .. */
36#ifndef __ASSEMBLY__
Roland McGrath54a01512008-04-10 15:37:38 -070037#ifndef asmlinkage_protect
38# define asmlinkage_protect(n, ret, args...) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#endif
Heiko Carstensb0fac022008-04-11 13:46:54 +020040#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42#ifndef __ALIGN
43#define __ALIGN .align 4,0x90
44#define __ALIGN_STR ".align 4,0x90"
45#endif
46
47#ifdef __ASSEMBLY__
48
49#define ALIGN __ALIGN
50#define ALIGN_STR __ALIGN_STR
51
Jan Beulichab7efcc2006-03-24 03:16:17 -080052#ifndef ENTRY
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#define ENTRY(name) \
54 .globl name; \
55 ALIGN; \
56 name:
Jan Beulichab7efcc2006-03-24 03:16:17 -080057#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Rusty Russell214541d2007-10-21 16:41:34 -070059#ifndef WEAK
60#define WEAK(name) \
61 .weak name; \
62 name:
63#endif
64
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070065#define KPROBE_ENTRY(name) \
Prasanna S.Pd28c4392006-09-26 10:52:34 +020066 .pushsection .kprobes.text, "ax"; \
Jan Beulichab7efcc2006-03-24 03:16:17 -080067 ENTRY(name)
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070068
Prasanna S.Pd28c4392006-09-26 10:52:34 +020069#define KPROBE_END(name) \
70 END(name); \
71 .popsection
72
Jan Beulichab7efcc2006-03-24 03:16:17 -080073#ifndef END
74#define END(name) \
75 .size name, .-name
76#endif
77
John Reiser6b8be6d2008-01-30 13:33:13 +010078/* If symbol 'name' is treated as a subroutine (gets called, and returns)
79 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
80 * static analysis tools such as stack depth analyzer.
81 */
Jan Beulichab7efcc2006-03-24 03:16:17 -080082#ifndef ENDPROC
83#define ENDPROC(name) \
84 .type name, @function; \
85 END(name)
86#endif
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070087
Linus Torvalds1da177e2005-04-16 15:20:36 -070088#endif
89
90#define NORET_TYPE /**/
91#define ATTRIB_NORET __attribute__((noreturn))
92#define NORET_AND noreturn,
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#endif