• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
29V_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_MAP64
37	cmpldi	cr0,r4,0
38	crclr	cr0*4+so
39	beqlr
40	li	r0,NR_syscalls
41	stw	r0,0(r4)
42	blr
43  .cfi_endproc
44V_FUNCTION_END(__kernel_get_syscall_map)
45
46
47/*
48 * void unsigned long  __kernel_get_tbfreq(void);
49 *
50 * returns the timebase frequency in HZ
51 */
52V_FUNCTION_BEGIN(__kernel_get_tbfreq)
53  .cfi_startproc
54	mflr	r12
55  .cfi_register lr,r12
56	get_datapage	r3, r0
57	ld	r3,CFG_TB_TICKS_PER_SEC(r3)
58	mtlr	r12
59	crclr	cr0*4+so
60	blr
61  .cfi_endproc
62V_FUNCTION_END(__kernel_get_tbfreq)
63