xref: /openbmc/linux/arch/arm64/lib/copy_page.S (revision f27bb139)
1f27bb139SMarc Zyngier/*
2f27bb139SMarc Zyngier * Copyright (C) 2012 ARM Ltd.
3f27bb139SMarc Zyngier *
4f27bb139SMarc Zyngier * This program is free software; you can redistribute it and/or modify
5f27bb139SMarc Zyngier * it under the terms of the GNU General Public License version 2 as
6f27bb139SMarc Zyngier * published by the Free Software Foundation.
7f27bb139SMarc Zyngier *
8f27bb139SMarc Zyngier * This program is distributed in the hope that it will be useful,
9f27bb139SMarc Zyngier * but WITHOUT ANY WARRANTY; without even the implied warranty of
10f27bb139SMarc Zyngier * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11f27bb139SMarc Zyngier * GNU General Public License for more details.
12f27bb139SMarc Zyngier *
13f27bb139SMarc Zyngier * You should have received a copy of the GNU General Public License
14f27bb139SMarc Zyngier * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15f27bb139SMarc Zyngier */
16f27bb139SMarc Zyngier
17f27bb139SMarc Zyngier#include <linux/linkage.h>
18f27bb139SMarc Zyngier#include <linux/const.h>
19f27bb139SMarc Zyngier#include <asm/assembler.h>
20f27bb139SMarc Zyngier#include <asm/page.h>
21f27bb139SMarc Zyngier
22f27bb139SMarc Zyngier/*
23f27bb139SMarc Zyngier * Copy a page from src to dest (both are page aligned)
24f27bb139SMarc Zyngier *
25f27bb139SMarc Zyngier * Parameters:
26f27bb139SMarc Zyngier *	x0 - dest
27f27bb139SMarc Zyngier *	x1 - src
28f27bb139SMarc Zyngier */
29f27bb139SMarc ZyngierENTRY(copy_page)
30f27bb139SMarc Zyngier	/* Assume cache line size is 64 bytes. */
31f27bb139SMarc Zyngier	prfm	pldl1strm, [x1, #64]
32f27bb139SMarc Zyngier1:	ldp	x2, x3, [x1]
33f27bb139SMarc Zyngier	ldp	x4, x5, [x1, #16]
34f27bb139SMarc Zyngier	ldp	x6, x7, [x1, #32]
35f27bb139SMarc Zyngier	ldp	x8, x9, [x1, #48]
36f27bb139SMarc Zyngier	add	x1, x1, #64
37f27bb139SMarc Zyngier	prfm	pldl1strm, [x1, #64]
38f27bb139SMarc Zyngier	stnp	x2, x3, [x0]
39f27bb139SMarc Zyngier	stnp	x4, x5, [x0, #16]
40f27bb139SMarc Zyngier	stnp	x6, x7, [x0, #32]
41f27bb139SMarc Zyngier	stnp	x8, x9, [x0, #48]
42f27bb139SMarc Zyngier	add	x0, x0, #64
43f27bb139SMarc Zyngier	tst	x1, #(PAGE_SIZE - 1)
44f27bb139SMarc Zyngier	b.ne	1b
45f27bb139SMarc Zyngier	ret
46f27bb139SMarc ZyngierENDPROC(copy_page)
47