summaryrefslogtreecommitdiff
path: root/arch/loongarch/include/asm/vdso/vdso.h
blob: 5a01643a65b3b2db6e9cade37cd6e1d45cc05424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Author: Huacai Chen <chenhuacai@loongson.cn>
 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
 */

#ifndef __ASSEMBLY__

#include <asm/asm.h>
#include <asm/page.h>

static inline unsigned long get_vdso_base(void)
{
	unsigned long addr;

	__asm__(
	" la.pcrel %0, _start\n"
	: "=r" (addr)
	:
	:);

	return addr;
}

static inline const struct vdso_data *get_vdso_data(void)
{
	return (const struct vdso_data *)(get_vdso_base() - PAGE_SIZE);
}

#endif /* __ASSEMBLY__ */