blob: faab501a45be458fca85e083ee7fe60136d3502a [file] [log] [blame]
Julius Werner64b9ca92013-12-12 20:24:48 -08001/*
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 Werner64b9ca92013-12-12 20:24:48 -080014 */
15
16#ifndef __ARM_ASM_H
17#define __ARM_ASM_H
18
Julius Werner25a282d2014-01-13 13:24:30 -080019/* __arm__ is defined regardless of Thumb mode, so need to order this right */
20#if defined __thumb2__
Julius Werner64b9ca92013-12-12 20:24:48 -080021# define ARM(x...)
22# define THUMB(x...) x
Julius Wernerd65e2142013-12-13 12:59:57 -080023# define W(instr) instr.w
Julius Werner25a282d2014-01-13 13:24:30 -080024#elif defined __thumb__
25# error You are not compiling Thumb2, this won't work!
Julius Werner64b9ca92013-12-12 20:24:48 -080026#else
Julius Werner25a282d2014-01-13 13:24:30 -080027# define ARM(x...) x
28# define THUMB(x...)
29# define W(instr) instr
Julius Werner64b9ca92013-12-12 20:24:48 -080030#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 Werner7c6e4892014-01-24 16:23:08 -080039 .section .text.name, "ax", %progbits; \
40 .global name; \
Julius Werner64b9ca92013-12-12 20:24:48 -080041 ALIGN; \
42 name:
43
44#define END(name) \
45 .size name, .-name
46
Julius Werner25a282d2014-01-13 13:24:30 -080047/* Thumb code uses the (new) unified assembly syntax. */
48THUMB( .syntax unified )
49
Julius Werner64b9ca92013-12-12 20:24:48 -080050#endif /* __ARM_ASM_H */