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 | */ |
Michael Ellerman | c1137c3 | 2008-06-24 11:32:48 +1000 | [diff] [blame^] | 22 | #if defined(CONFIG_PPC64) && !defined(__powerpc64__) |
Michael Ellerman | c5157e5 | 2008-06-24 11:32:39 +1000 | [diff] [blame] | 23 | /* 64 bits kernel, 32 bits code (ie. vdso32) */ |
Michael Ellerman | c1137c3 | 2008-06-24 11:32:48 +1000 | [diff] [blame^] | 24 | #define FTR_ENTRY_LONG .llong |
| 25 | #define FTR_ENTRY_OFFSET .long 0xffffffff; .long |
| 26 | #else |
| 27 | /* 64 bit kernel 64 bit code, or 32 bit kernel 32 bit code */ |
| 28 | #define FTR_ENTRY_LONG PPC_LONG |
| 29 | #define FTR_ENTRY_OFFSET PPC_LONG |
| 30 | #endif |
| 31 | |
Michael Ellerman | c5157e5 | 2008-06-24 11:32:39 +1000 | [diff] [blame] | 32 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ |
| 33 | 99: \ |
| 34 | .section sect,"a"; \ |
| 35 | .align 3; \ |
| 36 | 98: \ |
Michael Ellerman | c1137c3 | 2008-06-24 11:32:48 +1000 | [diff] [blame^] | 37 | FTR_ENTRY_LONG msk; \ |
| 38 | FTR_ENTRY_LONG val; \ |
| 39 | FTR_ENTRY_OFFSET label##b-98b; \ |
| 40 | FTR_ENTRY_OFFSET 99b-98b; \ |
Michael Ellerman | c5157e5 | 2008-06-24 11:32:39 +1000 | [diff] [blame] | 41 | .previous |
| 42 | |
Michael Ellerman | c5157e5 | 2008-06-24 11:32:39 +1000 | [diff] [blame] | 43 | |
| 44 | |
| 45 | /* CPU feature dependent sections */ |
| 46 | #define BEGIN_FTR_SECTION_NESTED(label) label: |
| 47 | #define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97) |
| 48 | |
| 49 | #define END_FTR_SECTION_NESTED(msk, val, label) \ |
| 50 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup) |
| 51 | |
| 52 | #define END_FTR_SECTION(msk, val) \ |
| 53 | END_FTR_SECTION_NESTED(msk, val, 97) |
| 54 | |
| 55 | #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) |
| 56 | #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) |
| 57 | |
| 58 | |
| 59 | /* Firmware feature dependent sections */ |
| 60 | #define BEGIN_FW_FTR_SECTION_NESTED(label) label: |
| 61 | #define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97) |
| 62 | |
| 63 | #define END_FW_FTR_SECTION_NESTED(msk, val, label) \ |
| 64 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup) |
| 65 | |
| 66 | #define END_FW_FTR_SECTION(msk, val) \ |
| 67 | END_FW_FTR_SECTION_NESTED(msk, val, 97) |
| 68 | |
| 69 | #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) |
| 70 | #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) |
| 71 | |
| 72 | #endif /* __ASSEMBLY__ */ |
| 73 | |
| 74 | #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */ |