1 #ifndef _LINUX_LINKAGE_H 2 #define _LINUX_LINKAGE_H 3 4 #include <linux/compiler.h> 5 #include <linux/stringify.h> 6 #include <linux/export.h> 7 #include <asm/linkage.h> 8 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 19 #ifndef cond_syscall 20 #define cond_syscall(x) asm( \ 21 ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \ 22 ".set " VMLINUX_SYMBOL_STR(x) "," \ 23 VMLINUX_SYMBOL_STR(sys_ni_syscall)) 24 #endif 25 26 #ifndef SYSCALL_ALIAS 27 #define SYSCALL_ALIAS(alias, name) asm( \ 28 ".globl " VMLINUX_SYMBOL_STR(alias) "\n\t" \ 29 ".set " VMLINUX_SYMBOL_STR(alias) "," \ 30 VMLINUX_SYMBOL_STR(name)) 31 #endif 32 33 #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) 34 #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) 35 36 /* 37 * For assembly routines. 38 * 39 * Note when using these that you must specify the appropriate 40 * alignment directives yourself 41 */ 42 #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw" 43 #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw" 44 45 /* 46 * This is used by architectures to keep arguments on the stack 47 * untouched by the compiler by keeping them live until the end. 48 * The argument stack may be owned by the assembly-language 49 * caller, not the callee, and gcc doesn't always understand 50 * that. 51 * 52 * We have the return value, and a maximum of six arguments. 53 * 54 * This should always be followed by a "return ret" for the 55 * protection to work (ie no more work that the compiler might 56 * end up needing stack temporaries for). 57 */ 58 /* Assembly files may be compiled with -traditional .. */ 59 #ifndef __ASSEMBLY__ 60 #ifndef asmlinkage_protect 61 # define asmlinkage_protect(n, ret, args...) do { } while (0) 62 #endif 63 #endif 64 65 #ifndef __ALIGN 66 #define __ALIGN .align 4,0x90 67 #define __ALIGN_STR ".align 4,0x90" 68 #endif 69 70 #ifdef __ASSEMBLY__ 71 72 #ifndef LINKER_SCRIPT 73 #define ALIGN __ALIGN 74 #define ALIGN_STR __ALIGN_STR 75 76 #ifndef ENTRY 77 #define ENTRY(name) \ 78 .globl name; \ 79 ALIGN; \ 80 name: 81 #endif 82 #endif /* LINKER_SCRIPT */ 83 84 #ifndef WEAK 85 #define WEAK(name) \ 86 .weak name; \ 87 name: 88 #endif 89 90 #ifndef END 91 #define END(name) \ 92 .size name, .-name 93 #endif 94 95 /* If symbol 'name' is treated as a subroutine (gets called, and returns) 96 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of 97 * static analysis tools such as stack depth analyzer. 98 */ 99 #ifndef ENDPROC 100 #define ENDPROC(name) \ 101 .type name, @function; \ 102 END(name) 103 #endif 104 105 #endif 106 107 #endif 108