blob: 9fd1f859021b5018baffdb440261379dab4a55b3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_LINKAGE_H
2#define _LINUX_LINKAGE_H
3
Jeremy Fitzhardingea7bf0bd2008-05-28 15:02:14 +01004#include <linux/compiler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm/linkage.h>
6
7#ifdef __cplusplus
8#define CPP_ASMLINKAGE extern "C"
9#else
10#define CPP_ASMLINKAGE
11#endif
12
13#ifndef asmlinkage
14#define asmlinkage CPP_ASMLINKAGE
15#endif
16
Ingo Molnard50efc62008-01-30 13:33:00 +010017#ifndef asmregparm
18# define asmregparm
19#endif
20
Jeremy Fitzhardingea7bf0bd2008-05-28 15:02:14 +010021#define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE)
22#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
23
Linus Torvaldsd10d89e2008-04-10 17:35:23 -070024/*
25 * This is used by architectures to keep arguments on the stack
26 * untouched by the compiler by keeping them live until the end.
27 * The argument stack may be owned by the assembly-language
28 * caller, not the callee, and gcc doesn't always understand
29 * that.
30 *
31 * We have the return value, and a maximum of six arguments.
32 *
33 * This should always be followed by a "return ret" for the
34 * protection to work (ie no more work that the compiler might
35 * end up needing stack temporaries for).
36 */
Heiko Carstensb0fac022008-04-11 13:46:54 +020037/* Assembly files may be compiled with -traditional .. */
38#ifndef __ASSEMBLY__
Roland McGrath54a01512008-04-10 15:37:38 -070039#ifndef asmlinkage_protect
40# define asmlinkage_protect(n, ret, args...) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#endif
Heiko Carstensb0fac022008-04-11 13:46:54 +020042#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44#ifndef __ALIGN
45#define __ALIGN .align 4,0x90
46#define __ALIGN_STR ".align 4,0x90"
47#endif
48
49#ifdef __ASSEMBLY__
50
51#define ALIGN __ALIGN
52#define ALIGN_STR __ALIGN_STR
53
Jan Beulichab7efcc2006-03-24 03:16:17 -080054#ifndef ENTRY
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#define ENTRY(name) \
56 .globl name; \
57 ALIGN; \
58 name:
Jan Beulichab7efcc2006-03-24 03:16:17 -080059#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Rusty Russell214541d2007-10-21 16:41:34 -070061#ifndef WEAK
62#define WEAK(name) \
63 .weak name; \
64 name:
65#endif
66
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070067#define KPROBE_ENTRY(name) \
Prasanna S.Pd28c4392006-09-26 10:52:34 +020068 .pushsection .kprobes.text, "ax"; \
Jan Beulichab7efcc2006-03-24 03:16:17 -080069 ENTRY(name)
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070070
Prasanna S.Pd28c4392006-09-26 10:52:34 +020071#define KPROBE_END(name) \
72 END(name); \
73 .popsection
74
Jan Beulichab7efcc2006-03-24 03:16:17 -080075#ifndef END
76#define END(name) \
77 .size name, .-name
78#endif
79
John Reiser6b8be6d2008-01-30 13:33:13 +010080/* If symbol 'name' is treated as a subroutine (gets called, and returns)
81 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
82 * static analysis tools such as stack depth analyzer.
83 */
Jan Beulichab7efcc2006-03-24 03:16:17 -080084#ifndef ENDPROC
85#define ENDPROC(name) \
86 .type name, @function; \
87 END(name)
88#endif
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070089
Linus Torvalds1da177e2005-04-16 15:20:36 -070090#endif
91
92#define NORET_TYPE /**/
93#define ATTRIB_NORET __attribute__((noreturn))
94#define NORET_AND noreturn,
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096#endif