xref: /linux/arch/loongarch/include/asm/vdso/vdso.h (revision 0fdebc5ec2ca492d69df2d93a6a7abade4941aae)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Author: Huacai Chen <chenhuacai@loongson.cn>
4  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5  */
6 
7 #ifndef __ASSEMBLY__
8 
9 #include <asm/asm.h>
10 #include <asm/page.h>
11 
12 static inline unsigned long get_vdso_base(void)
13 {
14 	unsigned long addr;
15 
16 	__asm__(
17 	" la.pcrel %0, _start\n"
18 	: "=r" (addr)
19 	:
20 	:);
21 
22 	return addr;
23 }
24 
25 static inline const struct vdso_data *get_vdso_data(void)
26 {
27 	return (const struct vdso_data *)(get_vdso_base() - PAGE_SIZE);
28 }
29 
30 #endif /* __ASSEMBLY__ */
31