Catalin Marinas | 0becb08 | 2009-07-24 12:32:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-arm/unified.h - Unified Assembler Syntax helper macros |
| 3 | * |
| 4 | * Copyright (C) 2008 ARM Limited |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef __ASM_UNIFIED_H |
| 21 | #define __ASM_UNIFIED_H |
| 22 | |
| 23 | #if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED) |
| 24 | .syntax unified |
| 25 | #endif |
| 26 | |
| 27 | #ifdef CONFIG_THUMB2_KERNEL |
| 28 | |
| 29 | #if __GNUC__ < 4 |
| 30 | #error Thumb-2 kernel requires gcc >= 4 |
| 31 | #endif |
| 32 | |
| 33 | /* The CPSR bit describing the instruction set (Thumb) */ |
| 34 | #define PSR_ISETSTATE PSR_T_BIT |
| 35 | |
| 36 | #define ARM(x...) |
| 37 | #define THUMB(x...) x |
Alexey Dobriyan | 74109b8 | 2009-09-18 15:09:33 +0100 | [diff] [blame] | 38 | #ifdef __ASSEMBLY__ |
Catalin Marinas | 0becb08 | 2009-07-24 12:32:53 +0100 | [diff] [blame] | 39 | #define W(instr) instr.w |
Alexey Dobriyan | 74109b8 | 2009-09-18 15:09:33 +0100 | [diff] [blame] | 40 | #endif |
Catalin Marinas | 0becb08 | 2009-07-24 12:32:53 +0100 | [diff] [blame] | 41 | #define BSYM(sym) sym + 1 |
| 42 | |
| 43 | #else /* !CONFIG_THUMB2_KERNEL */ |
| 44 | |
| 45 | /* The CPSR bit describing the instruction set (ARM) */ |
| 46 | #define PSR_ISETSTATE 0 |
| 47 | |
| 48 | #define ARM(x...) x |
| 49 | #define THUMB(x...) |
Alexey Dobriyan | 74109b8 | 2009-09-18 15:09:33 +0100 | [diff] [blame] | 50 | #ifdef __ASSEMBLY__ |
Catalin Marinas | 0becb08 | 2009-07-24 12:32:53 +0100 | [diff] [blame] | 51 | #define W(instr) instr |
Alexey Dobriyan | 74109b8 | 2009-09-18 15:09:33 +0100 | [diff] [blame] | 52 | #endif |
Catalin Marinas | 0becb08 | 2009-07-24 12:32:53 +0100 | [diff] [blame] | 53 | #define BSYM(sym) sym |
| 54 | |
| 55 | #endif /* CONFIG_THUMB2_KERNEL */ |
| 56 | |
| 57 | #ifndef CONFIG_ARM_ASM_UNIFIED |
| 58 | |
| 59 | /* |
| 60 | * If the unified assembly syntax isn't used (in ARM mode), these |
| 61 | * macros expand to an empty string |
| 62 | */ |
| 63 | #ifdef __ASSEMBLY__ |
| 64 | .macro it, cond |
| 65 | .endm |
| 66 | .macro itt, cond |
| 67 | .endm |
| 68 | .macro ite, cond |
| 69 | .endm |
| 70 | .macro ittt, cond |
| 71 | .endm |
| 72 | .macro itte, cond |
| 73 | .endm |
| 74 | .macro itet, cond |
| 75 | .endm |
| 76 | .macro itee, cond |
| 77 | .endm |
| 78 | .macro itttt, cond |
| 79 | .endm |
| 80 | .macro ittte, cond |
| 81 | .endm |
| 82 | .macro ittet, cond |
| 83 | .endm |
| 84 | .macro ittee, cond |
| 85 | .endm |
| 86 | .macro itett, cond |
| 87 | .endm |
| 88 | .macro itete, cond |
| 89 | .endm |
| 90 | .macro iteet, cond |
| 91 | .endm |
| 92 | .macro iteee, cond |
| 93 | .endm |
| 94 | #else /* !__ASSEMBLY__ */ |
| 95 | __asm__( |
| 96 | " .macro it, cond\n" |
| 97 | " .endm\n" |
| 98 | " .macro itt, cond\n" |
| 99 | " .endm\n" |
| 100 | " .macro ite, cond\n" |
| 101 | " .endm\n" |
| 102 | " .macro ittt, cond\n" |
| 103 | " .endm\n" |
| 104 | " .macro itte, cond\n" |
| 105 | " .endm\n" |
| 106 | " .macro itet, cond\n" |
| 107 | " .endm\n" |
| 108 | " .macro itee, cond\n" |
| 109 | " .endm\n" |
| 110 | " .macro itttt, cond\n" |
| 111 | " .endm\n" |
| 112 | " .macro ittte, cond\n" |
| 113 | " .endm\n" |
| 114 | " .macro ittet, cond\n" |
| 115 | " .endm\n" |
| 116 | " .macro ittee, cond\n" |
| 117 | " .endm\n" |
| 118 | " .macro itett, cond\n" |
| 119 | " .endm\n" |
| 120 | " .macro itete, cond\n" |
| 121 | " .endm\n" |
| 122 | " .macro iteet, cond\n" |
| 123 | " .endm\n" |
| 124 | " .macro iteee, cond\n" |
| 125 | " .endm\n"); |
| 126 | #endif /* __ASSEMBLY__ */ |
| 127 | |
| 128 | #endif /* CONFIG_ARM_ASM_UNIFIED */ |
| 129 | |
| 130 | #endif /* !__ASM_UNIFIED_H */ |