1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Access to the shared data page by the vDSO & syscall map
4 *
5 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
6 */
7
8#include <asm/processor.h>
9#include <asm/ppc_asm.h>
10#include <asm/asm-offsets.h>
11#include <asm/unistd.h>
12#include <asm/vdso.h>
13#include <asm/vdso_datapage.h>
14
15	.text
16
17/*
18 * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
19 *
20 * returns a pointer to the syscall map. the map is agnostic to the
21 * size of "long", unlike kernel bitops, it stores bits from top to
22 * bottom so that memory actually contains a linear bitmap
23 * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
24 * 32 bits int at N >> 5.
25 */
26V_FUNCTION_BEGIN(__kernel_get_syscall_map)
27  .cfi_startproc
28	mflr	r12
29  .cfi_register lr,r12
30	mr.	r4,r3
31	get_datapage	r3
32	mtlr	r12
33	addi	r3,r3,CFG_SYSCALL_MAP32
34	beqlr
35	li	r0,NR_syscalls
36	stw	r0,0(r4)
37	crclr	cr0*4+so
38	blr
39  .cfi_endproc
40V_FUNCTION_END(__kernel_get_syscall_map)
41
42/*
43 * void unsigned long long  __kernel_get_tbfreq(void);
44 *
45 * returns the timebase frequency in HZ
46 */
47V_FUNCTION_BEGIN(__kernel_get_tbfreq)
48  .cfi_startproc
49	mflr	r12
50  .cfi_register lr,r12
51	get_datapage	r3
52	lwz	r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
53	lwz	r3,CFG_TB_TICKS_PER_SEC(r3)
54	mtlr	r12
55	crclr	cr0*4+so
56	blr
57  .cfi_endproc
58V_FUNCTION_END(__kernel_get_tbfreq)
59