xref: /linux/arch/loongarch/mm/page.S (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
109cfefb7SHuacai Chen/* SPDX-License-Identifier: GPL-2.0 */
209cfefb7SHuacai Chen/*
309cfefb7SHuacai Chen * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
409cfefb7SHuacai Chen */
5*55b46ff9SMasahiro Yamada#include <linux/export.h>
609cfefb7SHuacai Chen#include <linux/linkage.h>
709cfefb7SHuacai Chen#include <asm/asm.h>
809cfefb7SHuacai Chen#include <asm/page.h>
909cfefb7SHuacai Chen#include <asm/regdef.h>
1009cfefb7SHuacai Chen
1109cfefb7SHuacai Chen	.align 5
1209cfefb7SHuacai ChenSYM_FUNC_START(clear_page)
1309cfefb7SHuacai Chen	lu12i.w	t0, 1 << (PAGE_SHIFT - 12)
1409cfefb7SHuacai Chen	add.d	t0, t0, a0
1509cfefb7SHuacai Chen1:
1609cfefb7SHuacai Chen	st.d	zero, a0, 0
1709cfefb7SHuacai Chen	st.d	zero, a0, 8
1809cfefb7SHuacai Chen	st.d	zero, a0, 16
1909cfefb7SHuacai Chen	st.d	zero, a0, 24
2009cfefb7SHuacai Chen	st.d	zero, a0, 32
2109cfefb7SHuacai Chen	st.d	zero, a0, 40
2209cfefb7SHuacai Chen	st.d	zero, a0, 48
2309cfefb7SHuacai Chen	st.d	zero, a0, 56
2409cfefb7SHuacai Chen	addi.d	a0,   a0, 128
2509cfefb7SHuacai Chen	st.d	zero, a0, -64
2609cfefb7SHuacai Chen	st.d	zero, a0, -56
2709cfefb7SHuacai Chen	st.d	zero, a0, -48
2809cfefb7SHuacai Chen	st.d	zero, a0, -40
2909cfefb7SHuacai Chen	st.d	zero, a0, -32
3009cfefb7SHuacai Chen	st.d	zero, a0, -24
3109cfefb7SHuacai Chen	st.d	zero, a0, -16
3209cfefb7SHuacai Chen	st.d	zero, a0, -8
3309cfefb7SHuacai Chen	bne	t0,   a0, 1b
3409cfefb7SHuacai Chen
3507b48069SWANG Xuerui	jr	ra
3609cfefb7SHuacai ChenSYM_FUNC_END(clear_page)
3709cfefb7SHuacai ChenEXPORT_SYMBOL(clear_page)
3809cfefb7SHuacai Chen
3909cfefb7SHuacai Chen.align 5
4009cfefb7SHuacai ChenSYM_FUNC_START(copy_page)
4109cfefb7SHuacai Chen	lu12i.w	t8, 1 << (PAGE_SHIFT - 12)
4209cfefb7SHuacai Chen	add.d	t8, t8, a0
4309cfefb7SHuacai Chen1:
4409cfefb7SHuacai Chen	ld.d	t0, a1, 0
4509cfefb7SHuacai Chen	ld.d	t1, a1, 8
4609cfefb7SHuacai Chen	ld.d	t2, a1, 16
4709cfefb7SHuacai Chen	ld.d	t3, a1, 24
4809cfefb7SHuacai Chen	ld.d	t4, a1, 32
4909cfefb7SHuacai Chen	ld.d	t5, a1, 40
5009cfefb7SHuacai Chen	ld.d	t6, a1, 48
5109cfefb7SHuacai Chen	ld.d	t7, a1, 56
5209cfefb7SHuacai Chen
5309cfefb7SHuacai Chen	st.d	t0, a0, 0
5409cfefb7SHuacai Chen	st.d	t1, a0, 8
5509cfefb7SHuacai Chen	ld.d	t0, a1, 64
5609cfefb7SHuacai Chen	ld.d	t1, a1, 72
5709cfefb7SHuacai Chen	st.d	t2, a0, 16
5809cfefb7SHuacai Chen	st.d	t3, a0, 24
5909cfefb7SHuacai Chen	ld.d	t2, a1, 80
6009cfefb7SHuacai Chen	ld.d	t3, a1, 88
6109cfefb7SHuacai Chen	st.d	t4, a0, 32
6209cfefb7SHuacai Chen	st.d	t5, a0, 40
6309cfefb7SHuacai Chen	ld.d	t4, a1, 96
6409cfefb7SHuacai Chen	ld.d	t5, a1, 104
6509cfefb7SHuacai Chen	st.d	t6, a0, 48
6609cfefb7SHuacai Chen	st.d	t7, a0, 56
6709cfefb7SHuacai Chen	ld.d	t6, a1, 112
6809cfefb7SHuacai Chen	ld.d	t7, a1, 120
6909cfefb7SHuacai Chen	addi.d	a0, a0, 128
7009cfefb7SHuacai Chen	addi.d	a1, a1, 128
7109cfefb7SHuacai Chen
7209cfefb7SHuacai Chen	st.d	t0, a0, -64
7309cfefb7SHuacai Chen	st.d	t1, a0, -56
7409cfefb7SHuacai Chen	st.d	t2, a0, -48
7509cfefb7SHuacai Chen	st.d	t3, a0, -40
7609cfefb7SHuacai Chen	st.d	t4, a0, -32
7709cfefb7SHuacai Chen	st.d	t5, a0, -24
7809cfefb7SHuacai Chen	st.d	t6, a0, -16
7909cfefb7SHuacai Chen	st.d	t7, a0, -8
8009cfefb7SHuacai Chen
8109cfefb7SHuacai Chen	bne	t8, a0, 1b
8207b48069SWANG Xuerui	jr	ra
8309cfefb7SHuacai ChenSYM_FUNC_END(copy_page)
8409cfefb7SHuacai ChenEXPORT_SYMBOL(copy_page)
85