2 * Based on arch/arm/mm/proc-macros.S
4 * Copyright (C) 2012 ARM Ltd.
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.
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.
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/>.
19 #include <asm/asm-offsets.h>
20 #include <asm/thread_info.h>
23 * vma_vm_mm - get mm pointer from vma pointer (vma->vm_mm)
25 .macro vma_vm_mm, rd, rn
26 ldr \rd, [\rn, #VMA_VM_MM]
30 * mmid - get context id from mm pointer (mm->context.id)
33 ldr \rd, [\rn, #MM_CONTEXT_ID]
37 * dcache_line_size - get the minimum D-cache line size from the CTR register.
39 .macro dcache_line_size, reg, tmp
40 mrs \tmp, ctr_el0 // read CTR
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
48 * icache_line_size - get the minimum I-cache line size from the CTR register.
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