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 
get_vdso_base(void)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 
get_vdso_data(void)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