1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _VDSO_DATAPAGE_H 3 #define _VDSO_DATAPAGE_H 4 #ifdef __KERNEL__ 5 6 /* 7 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM 8 * Copyright (C) 2005 Benjamin Herrenschmidy <benh@kernel.crashing.org>, 9 * IBM Corp. 10 */ 11 12 #ifndef __ASSEMBLY__ 13 14 #include <linux/unistd.h> 15 #include <linux/time.h> 16 #include <vdso/datapage.h> 17 18 #define SYSCALL_MAP_SIZE ((NR_syscalls + 31) / 32) 19 20 #ifdef CONFIG_PPC64 21 22 struct vdso_arch_data { 23 __u64 tb_ticks_per_sec; /* Timebase tics / sec */ 24 __u32 dcache_block_size; /* L1 d-cache block size */ 25 __u32 icache_block_size; /* L1 i-cache block size */ 26 __u32 dcache_log_block_size; /* L1 d-cache log block size */ 27 __u32 icache_log_block_size; /* L1 i-cache log block size */ 28 __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */ 29 __u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */ 30 31 struct vdso_data data[CS_BASES]; 32 struct vdso_rng_data rng_data; 33 }; 34 35 #else /* CONFIG_PPC64 */ 36 37 struct vdso_arch_data { 38 __u64 tb_ticks_per_sec; /* Timebase tics / sec */ 39 __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */ 40 __u32 compat_syscall_map[0]; /* No compat syscalls on PPC32 */ 41 struct vdso_data data[CS_BASES]; 42 struct vdso_rng_data rng_data; 43 }; 44 45 #endif /* CONFIG_PPC64 */ 46 47 extern struct vdso_arch_data *vdso_data; 48 49 #else /* __ASSEMBLY__ */ 50 51 .macro get_datapage ptr 52 bcl 20, 31, .+4 53 999: 54 mflr \ptr 55 addis \ptr, \ptr, (_vdso_datapage - 999b)@ha 56 addi \ptr, \ptr, (_vdso_datapage - 999b)@l 57 .endm 58 59 #include <asm/asm-offsets.h> 60 #include <asm/page.h> 61 62 .macro get_realdatapage ptr scratch 63 get_datapage \ptr 64 #ifdef CONFIG_TIME_NS 65 lwz \scratch, VDSO_CLOCKMODE_OFFSET(\ptr) 66 xoris \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@h 67 xori \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@l 68 cntlzw \scratch, \scratch 69 rlwinm \scratch, \scratch, PAGE_SHIFT - 5, 1 << PAGE_SHIFT 70 add \ptr, \ptr, \scratch 71 #endif 72 .endm 73 74 #endif /* __ASSEMBLY__ */ 75 76 #endif /* __KERNEL__ */ 77 #endif /* _SYSTEMCFG_H */ 78