| 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 |  | 
| Ingo Molnar | d50efc6 | 2008-01-30 13:33:00 +0100 | [diff] [blame] | 17 | #ifndef asmregparm | 
|  | 18 | # define asmregparm | 
|  | 19 | #endif | 
|  | 20 |  | 
| Jeremy Fitzhardinge | a7bf0bd | 2008-05-28 15:02:14 +0100 | [diff] [blame] | 21 | #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 Torvalds | d10d89e | 2008-04-10 17:35:23 -0700 | [diff] [blame] | 24 | /* | 
| Tim Abbott | d2af12a | 2009-06-23 19:59:35 -0400 | [diff] [blame] | 25 | * 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 Torvalds | d10d89e | 2008-04-10 17:35:23 -0700 | [diff] [blame] | 34 | * 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 Carstens | b0fac02 | 2008-04-11 13:46:54 +0200 | [diff] [blame] | 46 | /* Assembly files may be compiled with -traditional .. */ | 
|  | 47 | #ifndef __ASSEMBLY__ | 
| Roland McGrath | 54a0151 | 2008-04-10 15:37:38 -0700 | [diff] [blame] | 48 | #ifndef asmlinkage_protect | 
|  | 49 | # define asmlinkage_protect(n, ret, args...)	do { } while (0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #endif | 
| Heiko Carstens | b0fac02 | 2008-04-11 13:46:54 +0200 | [diff] [blame] | 51 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 |  | 
|  | 53 | #ifndef __ALIGN | 
|  | 54 | #define __ALIGN		.align 4,0x90 | 
|  | 55 | #define __ALIGN_STR	".align 4,0x90" | 
|  | 56 | #endif | 
|  | 57 |  | 
|  | 58 | #ifdef __ASSEMBLY__ | 
|  | 59 |  | 
|  | 60 | #define ALIGN __ALIGN | 
|  | 61 | #define ALIGN_STR __ALIGN_STR | 
|  | 62 |  | 
| Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 63 | #ifndef ENTRY | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | #define ENTRY(name) \ | 
|  | 65 | .globl name; \ | 
|  | 66 | ALIGN; \ | 
|  | 67 | name: | 
| Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 68 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 |  | 
| Rusty Russell | 214541d | 2007-10-21 16:41:34 -0700 | [diff] [blame] | 70 | #ifndef WEAK | 
|  | 71 | #define WEAK(name)	   \ | 
|  | 72 | .weak name;	   \ | 
|  | 73 | name: | 
|  | 74 | #endif | 
|  | 75 |  | 
| Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 76 | #ifndef END | 
|  | 77 | #define END(name) \ | 
|  | 78 | .size name, .-name | 
|  | 79 | #endif | 
|  | 80 |  | 
| John Reiser | 6b8be6d | 2008-01-30 13:33:13 +0100 | [diff] [blame] | 81 | /* If symbol 'name' is treated as a subroutine (gets called, and returns) | 
|  | 82 | * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of | 
|  | 83 | * static analysis tools such as stack depth analyzer. | 
|  | 84 | */ | 
| Jan Beulich | ab7efcc | 2006-03-24 03:16:17 -0800 | [diff] [blame] | 85 | #ifndef ENDPROC | 
|  | 86 | #define ENDPROC(name) \ | 
|  | 87 | .type name, @function; \ | 
|  | 88 | END(name) | 
|  | 89 | #endif | 
| Prasanna S Panchamukhi | d0aaff9 | 2005-09-06 15:19:26 -0700 | [diff] [blame] | 90 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | #endif | 
|  | 92 |  | 
|  | 93 | #define NORET_TYPE    /**/ | 
|  | 94 | #define ATTRIB_NORET  __attribute__((noreturn)) | 
|  | 95 | #define NORET_AND     noreturn, | 
|  | 96 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | #endif |