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