Merge branch 'core-rcu.2021.08.28a' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / arch / powerpc / kernel / vdso64 / datapage.S
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  */
26 V_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_MAP64
34         cmpldi  cr0,r4,0
35         crclr   cr0*4+so
36         beqlr
37         li      r0,NR_syscalls
38         stw     r0,0(r4)
39         blr
40   .cfi_endproc
41 V_FUNCTION_END(__kernel_get_syscall_map)
42
43
44 /*
45  * void unsigned long  __kernel_get_tbfreq(void);
46  *
47  * returns the timebase frequency in HZ
48  */
49 V_FUNCTION_BEGIN(__kernel_get_tbfreq)
50   .cfi_startproc
51         mflr    r12
52   .cfi_register lr,r12
53         get_datapage    r3
54         ld      r3,CFG_TB_TICKS_PER_SEC(r3)
55         mtlr    r12
56         crclr   cr0*4+so
57         blr
58   .cfi_endproc
59 V_FUNCTION_END(__kernel_get_tbfreq)