• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * asmmacro.h: Assembler macros to make things easier to read.
4  *
5  * Copyright (C) 2020 Loongson Technology Co., Ltd.
6  */
7 #ifndef _ASM_ASMMACRO_64_H
8 #define _ASM_ASMMACRO_64_H
9 
10 #include <asm/asm-offsets.h>
11 #include <asm/regdef.h>
12 #include <asm/fpregdef.h>
13 #include <asm/loongarchregs.h>
14 
15 	.macro	cpu_save_nonscratch thread
16 	stptr.d	s0, \thread, THREAD_REG23
17 	stptr.d	s1, \thread, THREAD_REG24
18 	stptr.d	s2, \thread, THREAD_REG25
19 	stptr.d	s3, \thread, THREAD_REG26
20 	stptr.d	s4, \thread, THREAD_REG27
21 	stptr.d	s5, \thread, THREAD_REG28
22 	stptr.d	s6, \thread, THREAD_REG29
23 	stptr.d	s7, \thread, THREAD_REG30
24 	stptr.d	s8, \thread, THREAD_REG31
25 	stptr.d	sp, \thread, THREAD_REG03
26 	stptr.d	fp, \thread, THREAD_REG22
27 	.endm
28 
29 	.macro	cpu_restore_nonscratch thread
30 	ldptr.d	s0, \thread, THREAD_REG23
31 	ldptr.d	s1, \thread, THREAD_REG24
32 	ldptr.d	s2, \thread, THREAD_REG25
33 	ldptr.d	s3, \thread, THREAD_REG26
34 	ldptr.d	s4, \thread, THREAD_REG27
35 	ldptr.d	s5, \thread, THREAD_REG28
36 	ldptr.d	s6, \thread, THREAD_REG29
37 	ldptr.d	s7, \thread, THREAD_REG30
38 	ldptr.d	s8, \thread, THREAD_REG31
39 	ldptr.d	sp, \thread, THREAD_REG03
40 	ldptr.d	fp, \thread, THREAD_REG22
41 	ldptr.d	ra, \thread, THREAD_REG01
42 	.endm
43 
44 #endif /* _ASM_ASMMACRO_64_H */
45