diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2012-03-05 06:49:26 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-09-17 05:24:44 -0400 |
commit | 0be7320a635c2e434e8b67e0e9474a85ceb421c4 (patch) | |
tree | 1c2097fe020e4308b159b7819d183e81c44fdb2a /arch/arm64/mm/proc-macros.S | |
parent | 048fa2df92c325cb4425dccd66c8922c8342b507 (diff) |
arm64: Assembly macros and definitions
This patch introduces several assembly macros and definitions used in
the .S files across arch/arm64/ like IRQ disabling/enabling, together
with asm-offsets.c.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm64/mm/proc-macros.S')
-rw-r--r-- | arch/arm64/mm/proc-macros.S | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/arm64/mm/proc-macros.S b/arch/arm64/mm/proc-macros.S new file mode 100644 index 000000000000..8957b822010b --- /dev/null +++ b/arch/arm64/mm/proc-macros.S | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Based on arch/arm/mm/proc-macros.S | ||
3 | * | ||
4 | * Copyright (C) 2012 ARM Ltd. | ||
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, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <asm/asm-offsets.h> | ||
20 | #include <asm/thread_info.h> | ||
21 | |||
22 | /* | ||
23 | * vma_vm_mm - get mm pointer from vma pointer (vma->vm_mm) | ||
24 | */ | ||
25 | .macro vma_vm_mm, rd, rn | ||
26 | ldr \rd, [\rn, #VMA_VM_MM] | ||
27 | .endm | ||
28 | |||
29 | /* | ||
30 | * mmid - get context id from mm pointer (mm->context.id) | ||
31 | */ | ||
32 | .macro mmid, rd, rn | ||
33 | ldr \rd, [\rn, #MM_CONTEXT_ID] | ||
34 | .endm | ||
35 | |||
36 | /* | ||
37 | * dcache_line_size - get the minimum D-cache line size from the CTR register. | ||
38 | */ | ||
39 | .macro dcache_line_size, reg, tmp | ||
40 | mrs \tmp, ctr_el0 // read CTR | ||
41 | lsr \tmp, \tmp, #16 | ||
42 | and \tmp, \tmp, #0xf // cache line size encoding | ||
43 | mov \reg, #4 // bytes per word | ||
44 | lsl \reg, \reg, \tmp // actual cache line size | ||
45 | .endm | ||
46 | |||
47 | /* | ||
48 | * icache_line_size - get the minimum I-cache line size from the CTR register. | ||
49 | */ | ||
50 | .macro icache_line_size, reg, tmp | ||
51 | mrs \tmp, ctr_el0 // read CTR | ||
52 | and \tmp, \tmp, #0xf // cache line size encoding | ||
53 | mov \reg, #4 // bytes per word | ||
54 | lsl \reg, \reg, \tmp // actual cache line size | ||
55 | .endm | ||