2 * Based on arch/arm/include/asm/assembler.h
4 * Copyright (C) 1996-2000 Russell King
5 * Copyright (C) 2012 ARM Ltd.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #error "Only include this from assembly code"
23 #include <asm/ptrace.h>
26 * Stack pushing/popping (register pairs only). Equivalent to store decrement
27 * before, load increment after.
29 .macro push
, xreg1
, xreg2
30 stp \xreg1
, \xreg2
, [sp
, #-16]!
33 .macro pop
, xreg1
, xreg2
34 ldp \xreg1
, \xreg2
, [sp
], #16
38 * Enable and disable interrupts.
49 * Save/disable and restore interrupts.
51 .macro save_and_disable_irqs
, olddaif
56 .macro restore_irqs
, olddaif
61 * Enable and disable debug exceptions.
71 .macro disable_step
, tmp
77 .macro enable_step
, tmp
83 .macro enable_dbg_if_not_stepping
, tmp
91 * SMP data memory barrier
99 #define USER(l, x...) \
101 .section __ex_table,"a"; \
109 lr
.req x30
// link register
120 * Select code when configured for BE.
122 #ifdef CONFIG_CPU_BIG_ENDIAN
123 #define CPU_BE(code...) code
125 #define CPU_BE(code...)
129 * Select code when configured for LE.
131 #ifdef CONFIG_CPU_BIG_ENDIAN
132 #define CPU_LE(code...)
134 #define CPU_LE(code...) code
138 * Define a macro that constructs a 64-bit value by concatenating two
139 * 32-bit registers. Note that on big endian systems the order of the
140 * registers is swapped.
142 #ifndef CONFIG_CPU_BIG_ENDIAN
143 .macro regs_to_64
, rd
, lbits
, hbits
145 .macro regs_to_64
, rd
, hbits
, lbits
147 orr
\rd
, \lbits
, \hbits
, lsl
#32