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