Linux 3.17-rc2
[linux/fpc-iii.git] / arch / arm64 / include / asm / sysreg.h
blob5c89df0acbcb2694890c671682a9dc5c9e40d339
1 /*
2 * Macros for accessing system registers with older binutils.
4 * Copyright (C) 2014 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
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 #ifndef __ASM_SYSREG_H
21 #define __ASM_SYSREG_H
23 #define sys_reg(op0, op1, crn, crm, op2) \
24 ((((op0)-2)<<19)|((op1)<<16)|((crn)<<12)|((crm)<<8)|((op2)<<5))
26 #ifdef __ASSEMBLY__
28 .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
29 .equ __reg_num_x\num, \num
30 .endr
31 .equ __reg_num_xzr, 31
33 .macro mrs_s, rt, sreg
34 .inst 0xd5300000|(\sreg)|(__reg_num_\rt)
35 .endm
37 .macro msr_s, sreg, rt
38 .inst 0xd5100000|(\sreg)|(__reg_num_\rt)
39 .endm
41 #else
43 asm(
44 " .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30\n"
45 " .equ __reg_num_x\\num, \\num\n"
46 " .endr\n"
47 " .equ __reg_num_xzr, 31\n"
48 "\n"
49 " .macro mrs_s, rt, sreg\n"
50 " .inst 0xd5300000|(\\sreg)|(__reg_num_\\rt)\n"
51 " .endm\n"
52 "\n"
53 " .macro msr_s, sreg, rt\n"
54 " .inst 0xd5100000|(\\sreg)|(__reg_num_\\rt)\n"
55 " .endm\n"
58 #endif
60 #endif /* __ASM_SYSREG_H */