blob: 2119610b24f812fe1c80a6f806c679af11d56ab9 [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
6#ifdef __cplusplus
7#define CPP_ASMLINKAGE extern "C"
8#else
9#define CPP_ASMLINKAGE
10#endif
11
12#ifndef asmlinkage
13#define asmlinkage CPP_ASMLINKAGE
14#endif
15
Ingo Molnard50efc62008-01-30 13:33:00 +010016#ifndef asmregparm
17# define asmregparm
18#endif
19
Linus Torvaldsd10d89e2008-04-10 17:35:23 -070020/*
21 * This is used by architectures to keep arguments on the stack
22 * untouched by the compiler by keeping them live until the end.
23 * The argument stack may be owned by the assembly-language
24 * caller, not the callee, and gcc doesn't always understand
25 * that.
26 *
27 * We have the return value, and a maximum of six arguments.
28 *
29 * This should always be followed by a "return ret" for the
30 * protection to work (ie no more work that the compiler might
31 * end up needing stack temporaries for).
32 */
Heiko Carstensb0fac022008-04-11 13:46:54 +020033/* Assembly files may be compiled with -traditional .. */
34#ifndef __ASSEMBLY__
Roland McGrath54a01512008-04-10 15:37:38 -070035#ifndef asmlinkage_protect
36# define asmlinkage_protect(n, ret, args...) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#endif
Heiko Carstensb0fac022008-04-11 13:46:54 +020038#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40#ifndef __ALIGN
41#define __ALIGN .align 4,0x90
42#define __ALIGN_STR ".align 4,0x90"
43#endif
44
45#ifdef __ASSEMBLY__
46
47#define ALIGN __ALIGN
48#define ALIGN_STR __ALIGN_STR
49
Jan Beulichab7efcc2006-03-24 03:16:17 -080050#ifndef ENTRY
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#define ENTRY(name) \
52 .globl name; \
53 ALIGN; \
54 name:
Jan Beulichab7efcc2006-03-24 03:16:17 -080055#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Rusty Russell214541d2007-10-21 16:41:34 -070057#ifndef WEAK
58#define WEAK(name) \
59 .weak name; \
60 name:
61#endif
62
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070063#define KPROBE_ENTRY(name) \
Prasanna S.Pd28c4392006-09-26 10:52:34 +020064 .pushsection .kprobes.text, "ax"; \
Jan Beulichab7efcc2006-03-24 03:16:17 -080065 ENTRY(name)
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070066
Prasanna S.Pd28c4392006-09-26 10:52:34 +020067#define KPROBE_END(name) \
68 END(name); \
69 .popsection
70
Jan Beulichab7efcc2006-03-24 03:16:17 -080071#ifndef END
72#define END(name) \
73 .size name, .-name
74#endif
75
John Reiser6b8be6d2008-01-30 13:33:13 +010076/* If symbol 'name' is treated as a subroutine (gets called, and returns)
77 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
78 * static analysis tools such as stack depth analyzer.
79 */
Jan Beulichab7efcc2006-03-24 03:16:17 -080080#ifndef ENDPROC
81#define ENDPROC(name) \
82 .type name, @function; \
83 END(name)
84#endif
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070085
Linus Torvalds1da177e2005-04-16 15:20:36 -070086#endif
87
88#define NORET_TYPE /**/
89#define ATTRIB_NORET __attribute__((noreturn))
90#define NORET_AND noreturn,
91
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#endif