blob: 5126cceb6ae97c7d401f197497f0a1311e55fe6f [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/*
Tim Abbottd2af12a2009-06-23 19:59:35 -040025 * For assembly routines.
26 *
27 * Note when using these that you must specify the appropriate
28 * alignment directives yourself
29 */
30#define __PAGE_ALIGNED_DATA .section ".data.page_aligned", "aw"
31#define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw"
32
33/*
Linus Torvaldsd10d89e2008-04-10 17:35:23 -070034 * This is used by architectures to keep arguments on the stack
35 * untouched by the compiler by keeping them live until the end.
36 * The argument stack may be owned by the assembly-language
37 * caller, not the callee, and gcc doesn't always understand
38 * that.
39 *
40 * We have the return value, and a maximum of six arguments.
41 *
42 * This should always be followed by a "return ret" for the
43 * protection to work (ie no more work that the compiler might
44 * end up needing stack temporaries for).
45 */
Heiko Carstensb0fac022008-04-11 13:46:54 +020046/* Assembly files may be compiled with -traditional .. */
47#ifndef __ASSEMBLY__
Roland McGrath54a01512008-04-10 15:37:38 -070048#ifndef asmlinkage_protect
49# define asmlinkage_protect(n, ret, args...) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#endif
Heiko Carstensb0fac022008-04-11 13:46:54 +020051#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53#ifndef __ALIGN
54#define __ALIGN .align 4,0x90
55#define __ALIGN_STR ".align 4,0x90"
56#endif
57
58#ifdef __ASSEMBLY__
59
Tim Abbott42f29a22009-09-20 18:14:12 -040060#ifndef LINKER_SCRIPT
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#define ALIGN __ALIGN
62#define ALIGN_STR __ALIGN_STR
63
Jan Beulichab7efcc2006-03-24 03:16:17 -080064#ifndef ENTRY
Linus Torvalds1da177e2005-04-16 15:20:36 -070065#define ENTRY(name) \
66 .globl name; \
67 ALIGN; \
68 name:
Jan Beulichab7efcc2006-03-24 03:16:17 -080069#endif
Tim Abbott42f29a22009-09-20 18:14:12 -040070#endif /* LINKER_SCRIPT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Rusty Russell214541d2007-10-21 16:41:34 -070072#ifndef WEAK
73#define WEAK(name) \
74 .weak name; \
75 name:
76#endif
77
Jan Beulichab7efcc2006-03-24 03:16:17 -080078#ifndef END
79#define END(name) \
80 .size name, .-name
81#endif
82
John Reiser6b8be6d2008-01-30 13:33:13 +010083/* If symbol 'name' is treated as a subroutine (gets called, and returns)
84 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
85 * static analysis tools such as stack depth analyzer.
86 */
Jan Beulichab7efcc2006-03-24 03:16:17 -080087#ifndef ENDPROC
88#define ENDPROC(name) \
89 .type name, @function; \
90 END(name)
91#endif
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#endif
94
95#define NORET_TYPE /**/
96#define ATTRIB_NORET __attribute__((noreturn))
97#define NORET_AND noreturn,
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099#endif