Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_LINKAGE_H |
| 2 | #define _LINUX_LINKAGE_H |
| 3 | |
Jeremy Fitzhardinge | a7bf0bd | 2008-05-28 15:02:14 +0100 | [diff] [blame] | 4 | #include <linux/compiler.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #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 | |
Tim Abbott | 75b1348 | 2010-02-20 01:03:37 +0100 | [diff] [blame] | 17 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) |
Tim Abbott | 7c74df0 | 2010-02-20 01:03:38 +0100 | [diff] [blame] | 18 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) |
Jeremy Fitzhardinge | a7bf0bd | 2008-05-28 15:02:14 +0100 | [diff] [blame] | 19 | |
Linus Torvalds | d10d89e | 2008-04-10 17:35:23 -0700 | [diff] [blame] | 20 | /* |
Tim Abbott | d2af12a | 2009-06-23 19:59:35 -0400 | [diff] [blame] | 21 | * For assembly routines. |
| 22 | * |
| 23 | * Note when using these that you must specify the appropriate |
| 24 | * alignment directives yourself |
| 25 | */ |
Tim Abbott | 75b1348 | 2010-02-20 01:03:37 +0100 | [diff] [blame] | 26 | #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw" |
Tim Abbott | 7c74df0 | 2010-02-20 01:03:38 +0100 | [diff] [blame] | 27 | #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw" |
Tim Abbott | d2af12a | 2009-06-23 19:59:35 -0400 | [diff] [blame] | 28 | |
| 29 | /* |
Linus Torvalds | d10d89e | 2008-04-10 17:35:23 -0700 | [diff] [blame] | 30 | * This is used by architectures to keep arguments on the stack |
| 31 | * untouched by the compiler by keeping them live until the end. |
| 32 | * The argument stack may be owned by the assembly-language |
| 33 | * caller, not the callee, and gcc doesn't always understand |
| 34 | * that. |
| 35 | * |
| 36 | * We have the return value, and a maximum of six arguments. |
| 37 | * |
| 38 | * This should always be followed by a "return ret" for the |
| 39 | * protection to work (ie no more work that the compiler might |
| 40 | * end up needing stack temporaries for). |
| 41 | */ |
Heiko Carstens | b0fac02 | 2008-04-11 13:46:54 +0200 | [diff] [blame] | 42 | /* Assembly files may be compiled with -traditional .. */ |
| 43 | #ifndef __ASSEMBLY__ |
Roland McGrath | 54a0151 | 2008-04-10 15:37:38 -0700 | [diff] [blame] | 44 | #ifndef asmlinkage_protect |
| 45 | # define asmlinkage_protect(n, ret, args...) do { } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #endif |
Heiko Carstens | b0fac02 | 2008-04-11 13:46:54 +0200 | [diff] [blame] | 47 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | #ifndef __ALIGN |
| 50 | #define __ALIGN .align 4,0x90 |
| 51 | #define __ALIGN_STR ".align 4,0x90" |
| 52 | #endif |
| 53 | |
| 54 | #ifdef __ASSEMBLY__ |
| 55 | |
Tim Abbott | 42f29a2 | 2009-09-20 18:14:12 -0400 | [diff] [blame] | 56 | #ifndef LINKER_SCRIPT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #define ALIGN __ALIGN |
| 58 | #define ALIGN_STR __ALIGN_STR |
| 59 | |
Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 60 | #ifndef ENTRY |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #define ENTRY(name) \ |
| 62 | .globl name; \ |
| 63 | ALIGN; \ |
| 64 | name: |
Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 65 | #endif |
Tim Abbott | 42f29a2 | 2009-09-20 18:14:12 -0400 | [diff] [blame] | 66 | #endif /* LINKER_SCRIPT */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
Rusty Russell | 214541d | 2007-10-21 16:41:34 -0700 | [diff] [blame] | 68 | #ifndef WEAK |
| 69 | #define WEAK(name) \ |
| 70 | .weak name; \ |
| 71 | name: |
| 72 | #endif |
| 73 | |
Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 74 | #ifndef END |
| 75 | #define END(name) \ |
| 76 | .size name, .-name |
| 77 | #endif |
| 78 | |
John Reiser | 6b8be6d | 2008-01-30 13:33:13 +0100 | [diff] [blame] | 79 | /* If symbol 'name' is treated as a subroutine (gets called, and returns) |
| 80 | * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of |
| 81 | * static analysis tools such as stack depth analyzer. |
| 82 | */ |
Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 83 | #ifndef ENDPROC |
| 84 | #define ENDPROC(name) \ |
| 85 | .type name, @function; \ |
| 86 | END(name) |
| 87 | #endif |
Prasanna S Panchamukhi | d0aaff9 | 2005-09-06 15:19:26 -0700 | [diff] [blame] | 88 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | #endif |
| 90 | |
| 91 | #define NORET_TYPE /**/ |
| 92 | #define ATTRIB_NORET __attribute__((noreturn)) |
| 93 | #define NORET_AND noreturn, |
| 94 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | #endif |