Merge tag 'mvebu-fixes-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/gcleme...
[linux-2.6-microblaze.git] / arch / powerpc / kernel / vdso32 / 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         .global __kernel_datapage_offset;
17 __kernel_datapage_offset:
18         .long   0
19
20 /*
21  * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
22  *
23  * returns a pointer to the syscall map. the map is agnostic to the
24  * size of "long", unlike kernel bitops, it stores bits from top to
25  * bottom so that memory actually contains a linear bitmap
26  * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
27  * 32 bits int at N >> 5.
28  */
29 V_FUNCTION_BEGIN(__kernel_get_syscall_map)
30   .cfi_startproc
31         mflr    r12
32   .cfi_register lr,r12
33         mr.     r4,r3
34         get_datapage    r3, r0
35         mtlr    r12
36         addi    r3,r3,CFG_SYSCALL_MAP32
37         beqlr
38         li      r0,NR_syscalls
39         stw     r0,0(r4)
40         crclr   cr0*4+so
41         blr
42   .cfi_endproc
43 V_FUNCTION_END(__kernel_get_syscall_map)
44
45 /*
46  * void unsigned long long  __kernel_get_tbfreq(void);
47  *
48  * returns the timebase frequency in HZ
49  */
50 V_FUNCTION_BEGIN(__kernel_get_tbfreq)
51   .cfi_startproc
52         mflr    r12
53   .cfi_register lr,r12
54         get_datapage    r3, r0
55         lwz     r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
56         lwz     r3,CFG_TB_TICKS_PER_SEC(r3)
57         mtlr    r12
58         crclr   cr0*4+so
59         blr
60   .cfi_endproc
61 V_FUNCTION_END(__kernel_get_tbfreq)