Michael Ellerman | c5157e5 | 2008-06-24 11:32:39 +1000 | [diff] [blame^] | 1 | #ifndef __ASM_POWERPC_FEATURE_FIXUPS_H |
| 2 | #define __ASM_POWERPC_FEATURE_FIXUPS_H |
| 3 | |
| 4 | /* |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version |
| 8 | * 2 of the License, or (at your option) any later version. |
| 9 | */ |
| 10 | |
| 11 | #ifdef __ASSEMBLY__ |
| 12 | |
| 13 | /* |
| 14 | * Feature section common macros |
| 15 | * |
| 16 | * Note that the entries now contain offsets between the table entry |
| 17 | * and the code rather than absolute code pointers in order to be |
| 18 | * useable with the vdso shared library. There is also an assumption |
| 19 | * that values will be negative, that is, the fixup table has to be |
| 20 | * located after the code it fixes up. |
| 21 | */ |
| 22 | #ifdef CONFIG_PPC64 |
| 23 | |
| 24 | #ifdef __powerpc64__ |
| 25 | |
| 26 | /* 64 bits kernel, 64 bits code */ |
| 27 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ |
| 28 | 99: \ |
| 29 | .section sect,"a"; \ |
| 30 | .align 3; \ |
| 31 | 98: \ |
| 32 | .llong msk; \ |
| 33 | .llong val; \ |
| 34 | .llong label##b-98b; \ |
| 35 | .llong 99b-98b; \ |
| 36 | .previous |
| 37 | |
| 38 | #else /* __powerpc64__ */ |
| 39 | |
| 40 | /* 64 bits kernel, 32 bits code (ie. vdso32) */ |
| 41 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ |
| 42 | 99: \ |
| 43 | .section sect,"a"; \ |
| 44 | .align 3; \ |
| 45 | 98: \ |
| 46 | .llong msk; \ |
| 47 | .llong val; \ |
| 48 | .long 0xffffffff; \ |
| 49 | .long label##b-98b; \ |
| 50 | .long 0xffffffff; \ |
| 51 | .long 99b-98b; \ |
| 52 | .previous |
| 53 | |
| 54 | #endif /* !__powerpc64__ */ |
| 55 | |
| 56 | #else /* CONFIG_PPC64 */ |
| 57 | |
| 58 | /* 32 bits kernel, 32 bits code */ |
| 59 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ |
| 60 | 99: \ |
| 61 | .section sect,"a"; \ |
| 62 | .align 2; \ |
| 63 | 98: \ |
| 64 | .long msk; \ |
| 65 | .long val; \ |
| 66 | .long label##b-98b; \ |
| 67 | .long 99b-98b; \ |
| 68 | .previous |
| 69 | |
| 70 | #endif /* !CONFIG_PPC64 */ |
| 71 | |
| 72 | |
| 73 | /* CPU feature dependent sections */ |
| 74 | #define BEGIN_FTR_SECTION_NESTED(label) label: |
| 75 | #define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97) |
| 76 | |
| 77 | #define END_FTR_SECTION_NESTED(msk, val, label) \ |
| 78 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup) |
| 79 | |
| 80 | #define END_FTR_SECTION(msk, val) \ |
| 81 | END_FTR_SECTION_NESTED(msk, val, 97) |
| 82 | |
| 83 | #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) |
| 84 | #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) |
| 85 | |
| 86 | |
| 87 | /* Firmware feature dependent sections */ |
| 88 | #define BEGIN_FW_FTR_SECTION_NESTED(label) label: |
| 89 | #define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97) |
| 90 | |
| 91 | #define END_FW_FTR_SECTION_NESTED(msk, val, label) \ |
| 92 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup) |
| 93 | |
| 94 | #define END_FW_FTR_SECTION(msk, val) \ |
| 95 | END_FW_FTR_SECTION_NESTED(msk, val, 97) |
| 96 | |
| 97 | #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) |
| 98 | #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) |
| 99 | |
| 100 | #endif /* __ASSEMBLY__ */ |
| 101 | |
| 102 | #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */ |