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