Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: Add new asm macro copy_page

Kexec and hibernate need to copy pages of memory, but may not have all
of the kernel mapped, and are unable to call copy_page().

Add a simplistic copy_page() macro, that can be inlined in these
situations. lib/copy_page.S provides a bigger better version, but
uses more registers.

Signed-off-by: Geoff Levand <geoff@infradead.org>
[Changed asm label to 9998, added commit message]
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Geoff Levand and committed by
Will Deacon
5003dbde 28c72583

+19
+19
arch/arm64/include/asm/assembler.h
··· 24 24 #define __ASM_ASSEMBLER_H 25 25 26 26 #include <asm/asm-offsets.h> 27 + #include <asm/page.h> 27 28 #include <asm/pgtable-hwdef.h> 28 29 #include <asm/ptrace.h> 29 30 #include <asm/thread_info.h> ··· 278 277 b.lt 9000f 279 278 msr pmuserenr_el0, xzr // Disable PMU access from EL0 280 279 9000: 280 + .endm 281 + 282 + /* 283 + * copy_page - copy src to dest using temp registers t1-t8 284 + */ 285 + .macro copy_page dest:req src:req t1:req t2:req t3:req t4:req t5:req t6:req t7:req t8:req 286 + 9998: ldp \t1, \t2, [\src] 287 + ldp \t3, \t4, [\src, #16] 288 + ldp \t5, \t6, [\src, #32] 289 + ldp \t7, \t8, [\src, #48] 290 + add \src, \src, #64 291 + stnp \t1, \t2, [\dest] 292 + stnp \t3, \t4, [\dest, #16] 293 + stnp \t5, \t6, [\dest, #32] 294 + stnp \t7, \t8, [\dest, #48] 295 + add \dest, \dest, #64 296 + tst \src, #(PAGE_SIZE - 1) 297 + b.ne 9998b 281 298 .endm 282 299 283 300 /*