Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2013 Google Inc. |
| 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 as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 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. |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef __ARM_ASM_H |
| 17 | #define __ARM_ASM_H |
| 18 | |
Julius Werner | 25a282d | 2014-01-13 13:24:30 -0800 | [diff] [blame] | 19 | /* __arm__ is defined regardless of Thumb mode, so need to order this right */ |
| 20 | #if defined __thumb2__ |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 21 | # define ARM(x...) |
| 22 | # define THUMB(x...) x |
Julius Werner | d65e214 | 2013-12-13 12:59:57 -0800 | [diff] [blame] | 23 | # define W(instr) instr.w |
Julius Werner | 25a282d | 2014-01-13 13:24:30 -0800 | [diff] [blame] | 24 | #elif defined __thumb__ |
| 25 | # error You are not compiling Thumb2, this won't work! |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 26 | #else |
Julius Werner | 25a282d | 2014-01-13 13:24:30 -0800 | [diff] [blame] | 27 | # define ARM(x...) x |
| 28 | # define THUMB(x...) |
| 29 | # define W(instr) instr |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #define ALIGN .align 0 |
| 33 | |
| 34 | #define ENDPROC(name) \ |
| 35 | .type name, %function; \ |
| 36 | END(name) |
| 37 | |
| 38 | #define ENTRY(name) \ |
Julius Werner | 7c6e489 | 2014-01-24 16:23:08 -0800 | [diff] [blame] | 39 | .section .text.name, "ax", %progbits; \ |
| 40 | .global name; \ |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 41 | ALIGN; \ |
| 42 | name: |
| 43 | |
| 44 | #define END(name) \ |
| 45 | .size name, .-name |
| 46 | |
Julius Werner | 25a282d | 2014-01-13 13:24:30 -0800 | [diff] [blame] | 47 | /* Thumb code uses the (new) unified assembly syntax. */ |
| 48 | THUMB( .syntax unified ) |
| 49 | |
Julius Werner | 64b9ca9 | 2013-12-12 20:24:48 -0800 | [diff] [blame] | 50 | #endif /* __ARM_ASM_H */ |