From fd1feade75fb1a9275c39d76c5ccdbbbe6b37aa3 Mon Sep 17 00:00:00 2001 From: Christophe Leroy Date: Fri, 21 Jan 2022 16:30:27 +0000 Subject: powerpc/vdso: Merge vdso64 and vdso32 into a single directory merge vdso64 into vdso32 and rename it vdso. Reported-by: kernel test robot Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/4dbe05cc130f6a0858d09ac72e436c373cb08b70.1642782130.git.christophe.leroy@csgroup.eu --- arch/powerpc/Makefile | 4 +- arch/powerpc/kernel/Makefile | 6 +- arch/powerpc/kernel/vdso/.gitignore | 5 + arch/powerpc/kernel/vdso/Makefile | 103 ++++++++ arch/powerpc/kernel/vdso/cacheflush.S | 98 +++++++ arch/powerpc/kernel/vdso/datapage.S | 64 +++++ arch/powerpc/kernel/vdso/gen_vdso32_offsets.sh | 16 ++ arch/powerpc/kernel/vdso/gen_vdso64_offsets.sh | 16 ++ arch/powerpc/kernel/vdso/getcpu.S | 50 ++++ arch/powerpc/kernel/vdso/gettimeofday.S | 82 ++++++ arch/powerpc/kernel/vdso/note.S | 28 ++ arch/powerpc/kernel/vdso/sigtramp32.S | 295 +++++++++++++++++++++ arch/powerpc/kernel/vdso/sigtramp64.S | 313 +++++++++++++++++++++++ arch/powerpc/kernel/vdso/vdso32.lds.S | 140 ++++++++++ arch/powerpc/kernel/vdso/vdso64.lds.S | 134 ++++++++++ arch/powerpc/kernel/vdso/vgettimeofday.c | 49 ++++ arch/powerpc/kernel/vdso32/.gitignore | 3 - arch/powerpc/kernel/vdso32/Makefile | 68 ----- arch/powerpc/kernel/vdso32/cacheflush.S | 98 ------- arch/powerpc/kernel/vdso32/datapage.S | 64 ----- arch/powerpc/kernel/vdso32/gen_vdso32_offsets.sh | 16 -- arch/powerpc/kernel/vdso32/getcpu.S | 50 ---- arch/powerpc/kernel/vdso32/gettimeofday.S | 82 ------ arch/powerpc/kernel/vdso32/note.S | 28 -- arch/powerpc/kernel/vdso32/sigtramp32.S | 295 --------------------- arch/powerpc/kernel/vdso32/vdso32.lds.S | 140 ---------- arch/powerpc/kernel/vdso32/vgettimeofday.c | 49 ---- arch/powerpc/kernel/vdso32_wrapper.S | 2 +- arch/powerpc/kernel/vdso64/.gitignore | 3 - arch/powerpc/kernel/vdso64/Makefile | 56 ---- arch/powerpc/kernel/vdso64/cacheflush.S | 75 ------ arch/powerpc/kernel/vdso64/datapage.S | 59 ----- arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh | 16 -- arch/powerpc/kernel/vdso64/getcpu.S | 33 --- arch/powerpc/kernel/vdso64/gettimeofday.S | 58 ----- arch/powerpc/kernel/vdso64/note.S | 1 - arch/powerpc/kernel/vdso64/sigtramp.S | 313 ----------------------- arch/powerpc/kernel/vdso64/vdso64.lds.S | 134 ---------- arch/powerpc/kernel/vdso64/vgettimeofday.c | 29 --- arch/powerpc/kernel/vdso64_wrapper.S | 2 +- 40 files changed, 1400 insertions(+), 1677 deletions(-) create mode 100644 arch/powerpc/kernel/vdso/.gitignore create mode 100644 arch/powerpc/kernel/vdso/Makefile create mode 100644 arch/powerpc/kernel/vdso/cacheflush.S create mode 100644 arch/powerpc/kernel/vdso/datapage.S create mode 100755 arch/powerpc/kernel/vdso/gen_vdso32_offsets.sh create mode 100755 arch/powerpc/kernel/vdso/gen_vdso64_offsets.sh create mode 100644 arch/powerpc/kernel/vdso/getcpu.S create mode 100644 arch/powerpc/kernel/vdso/gettimeofday.S create mode 100644 arch/powerpc/kernel/vdso/note.S create mode 100644 arch/powerpc/kernel/vdso/sigtramp32.S create mode 100644 arch/powerpc/kernel/vdso/sigtramp64.S create mode 100644 arch/powerpc/kernel/vdso/vdso32.lds.S create mode 100644 arch/powerpc/kernel/vdso/vdso64.lds.S create mode 100644 arch/powerpc/kernel/vdso/vgettimeofday.c delete mode 100644 arch/powerpc/kernel/vdso32/.gitignore delete mode 100644 arch/powerpc/kernel/vdso32/Makefile delete mode 100644 arch/powerpc/kernel/vdso32/cacheflush.S delete mode 100644 arch/powerpc/kernel/vdso32/datapage.S delete mode 100755 arch/powerpc/kernel/vdso32/gen_vdso32_offsets.sh delete mode 100644 arch/powerpc/kernel/vdso32/getcpu.S delete mode 100644 arch/powerpc/kernel/vdso32/gettimeofday.S delete mode 100644 arch/powerpc/kernel/vdso32/note.S delete mode 100644 arch/powerpc/kernel/vdso32/sigtramp32.S delete mode 100644 arch/powerpc/kernel/vdso32/vdso32.lds.S delete mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c delete mode 100644 arch/powerpc/kernel/vdso64/.gitignore delete mode 100644 arch/powerpc/kernel/vdso64/Makefile delete mode 100644 arch/powerpc/kernel/vdso64/cacheflush.S delete mode 100644 arch/powerpc/kernel/vdso64/datapage.S delete mode 100755 arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh delete mode 100644 arch/powerpc/kernel/vdso64/getcpu.S delete mode 100644 arch/powerpc/kernel/vdso64/gettimeofday.S delete mode 100644 arch/powerpc/kernel/vdso64/note.S delete mode 100644 arch/powerpc/kernel/vdso64/sigtramp.S delete mode 100644 arch/powerpc/kernel/vdso64/vdso64.lds.S delete mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 5f16ac1583c5..ddc5a706760a 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -421,9 +421,9 @@ ifeq ($(KBUILD_EXTMOD),) prepare: vdso_prepare vdso_prepare: prepare0 $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \ - $(build)=arch/powerpc/kernel/vdso32 include/generated/vdso32-offsets.h) + $(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h) $(if $(CONFIG_PPC64),$(Q)$(MAKE) \ - $(build)=arch/powerpc/kernel/vdso64 include/generated/vdso64-offsets.h) + $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) endif archprepare: checkbin diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 4d7829399570..4ddd161aef32 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -194,8 +194,8 @@ targets += prom_init_check clean-files := vmlinux.lds # Force dependency (incbin is bad) -$(obj)/vdso32_wrapper.o : $(obj)/vdso32/vdso32.so.dbg -$(obj)/vdso64_wrapper.o : $(obj)/vdso64/vdso64.so.dbg +$(obj)/vdso32_wrapper.o : $(obj)/vdso/vdso32.so.dbg +$(obj)/vdso64_wrapper.o : $(obj)/vdso/vdso64.so.dbg # for cleaning -subdir- += vdso32 vdso64 +subdir- += vdso diff --git a/arch/powerpc/kernel/vdso/.gitignore b/arch/powerpc/kernel/vdso/.gitignore new file mode 100644 index 000000000000..dd9bdd67758b --- /dev/null +++ b/arch/powerpc/kernel/vdso/.gitignore @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only +vdso32.lds +vdso32.so.dbg +vdso64.lds +vdso64.so.dbg diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile new file mode 100644 index 000000000000..954974287ee7 --- /dev/null +++ b/arch/powerpc/kernel/vdso/Makefile @@ -0,0 +1,103 @@ +# SPDX-License-Identifier: GPL-2.0 + +# List of files in the vdso, has to be asm only for now + +ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24 +include $(srctree)/lib/vdso/Makefile + +obj-vdso32 = sigtramp32-32.o gettimeofday-32.o datapage-32.o cacheflush-32.o note-32.o getcpu-32.o +obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o note-64.o getcpu-64.o + +ifneq ($(c-gettimeofday-y),) + CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) + CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector) + CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING + CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables + CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE) + CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc + CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) + CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector) + CFLAGS_vgettimeofday-64.o += -DDISABLE_BRANCH_PROFILING + CFLAGS_vgettimeofday-64.o += -ffreestanding -fasynchronous-unwind-tables + CFLAGS_REMOVE_vgettimeofday-64.o = $(CC_FLAGS_FTRACE) +# Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true +# by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is +# compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code +# generation is minimal, it will just use r29 instead. + CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30) +endif + +# Build rules + +ifdef CROSS32_COMPILE + VDSOCC := $(CROSS32_COMPILE)gcc +else + VDSOCC := $(CC) +endif + +targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o +obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) +targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o +obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) + +GCOV_PROFILE := n +KCOV_INSTRUMENT := n +UBSAN_SANITIZE := n +KASAN_SANITIZE := n + +ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both + +CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32 +AS32FLAGS := -D__VDSO32__ -s + +CC64FLAGS := -Wl,-soname=linux-vdso64.so.1 +AS64FLAGS := -D__VDSO64__ -s + +targets += vdso32.lds +CPPFLAGS_vdso32.lds += -P -C -Upowerpc +targets += vdso64.lds +CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) + +# link rule for the .so file, .lds has to be first +$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o FORCE + $(call if_changed,vdso32ld_and_check) +$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o FORCE + $(call if_changed,vdso64ld_and_check) + +# assembly rules for the .S files +$(obj-vdso32): %-32.o: %.S FORCE + $(call if_changed_dep,vdso32as) +$(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE + $(call if_changed_dep,vdso32cc) +$(obj-vdso64): %-64.o: %.S FORCE + $(call if_changed_dep,vdso64as) +$(obj)/vgettimeofday-64.o: %-64.o: %.c FORCE + $(call if_changed_dep,cc_o_c) + +# Generate VDSO offsets using helper script +gen-vdso32sym := $(srctree)/$(src)/gen_vdso32_offsets.sh +quiet_cmd_vdso32sym = VDSO32SYM $@ + cmd_vdso32sym = $(NM) $< | $(gen-vdso32sym) | LC_ALL=C sort > $@ +gen-vdso64sym := $(srctree)/$(src)/gen_vdso64_offsets.sh +quiet_cmd_vdso64sym = VDSO64SYM $@ + cmd_vdso64sym = $(NM) $< | $(gen-vdso64sym) | LC_ALL=C sort > $@ + +include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE + $(call if_changed,vdso32sym) +include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE + $(call if_changed,vdso64sym) + +# actual build commands +quiet_cmd_vdso32ld_and_check = VDSO32L $@ + cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) +quiet_cmd_vdso32as = VDSO32A $@ + cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $< +quiet_cmd_vdso32cc = VDSO32C $@ + cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< + +quiet_cmd_vdso64ld_and_check = VDSO64L $@ + cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) +quiet_cmd_vdso64as = VDSO64A $@ + cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $< diff --git a/arch/powerpc/kernel/vdso/cacheflush.S b/arch/powerpc/kernel/vdso/cacheflush.S new file mode 100644 index 000000000000..d4e43ab2d5df --- /dev/null +++ b/arch/powerpc/kernel/vdso/cacheflush.S @@ -0,0 +1,98 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * vDSO provided cache flush routines + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), + * IBM Corp. + */ +#include +#include +#include +#include +#include +#include + + .text + +/* + * Default "generic" version of __kernel_sync_dicache. + * + * void __kernel_sync_dicache(unsigned long start, unsigned long end) + * + * Flushes the data cache & invalidate the instruction cache for the + * provided range [start, end[ + */ +V_FUNCTION_BEGIN(__kernel_sync_dicache) + .cfi_startproc +BEGIN_FTR_SECTION + b 3f +END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) +#ifdef CONFIG_PPC64 + mflr r12 + .cfi_register lr,r12 + get_datapage r10 + mtlr r12 + .cfi_restore lr +#endif + +#ifdef CONFIG_PPC64 + lwz r7,CFG_DCACHE_BLOCKSZ(r10) + addi r5,r7,-1 +#else + li r5, L1_CACHE_BYTES - 1 +#endif + andc r6,r3,r5 /* round low to line bdy */ + subf r8,r6,r4 /* compute length */ + add r8,r8,r5 /* ensure we get enough */ +#ifdef CONFIG_PPC64 + lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) + PPC_SRL. r8,r8,r9 /* compute line count */ +#else + srwi. r8, r8, L1_CACHE_SHIFT + mr r7, r6 +#endif + crclr cr0*4+so + beqlr /* nothing to do? */ + mtctr r8 +1: dcbst 0,r6 +#ifdef CONFIG_PPC64 + add r6,r6,r7 +#else + addi r6, r6, L1_CACHE_BYTES +#endif + bdnz 1b + sync + +/* Now invalidate the instruction cache */ + +#ifdef CONFIG_PPC64 + lwz r7,CFG_ICACHE_BLOCKSZ(r10) + addi r5,r7,-1 + andc r6,r3,r5 /* round low to line bdy */ + subf r8,r6,r4 /* compute length */ + add r8,r8,r5 + lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) + PPC_SRL. r8,r8,r9 /* compute line count */ + crclr cr0*4+so + beqlr /* nothing to do? */ +#endif + mtctr r8 +#ifdef CONFIG_PPC64 +2: icbi 0,r6 + add r6,r6,r7 +#else +2: icbi 0, r7 + addi r7, r7, L1_CACHE_BYTES +#endif + bdnz 2b + isync + li r3,0 + blr +3: + crclr cr0*4+so + sync + isync + li r3,0 + blr + .cfi_endproc +V_FUNCTION_END(__kernel_sync_dicache) diff --git a/arch/powerpc/kernel/vdso/datapage.S b/arch/powerpc/kernel/vdso/datapage.S new file mode 100644 index 000000000000..db8e167f0166 --- /dev/null +++ b/arch/powerpc/kernel/vdso/datapage.S @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Access to the shared data page by the vDSO & syscall map + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. + */ + +#include +#include +#include +#include +#include +#include + + .text + +/* + * void *__kernel_get_syscall_map(unsigned int *syscall_count) ; + * + * returns a pointer to the syscall map. the map is agnostic to the + * size of "long", unlike kernel bitops, it stores bits from top to + * bottom so that memory actually contains a linear bitmap + * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of + * 32 bits int at N >> 5. + */ +V_FUNCTION_BEGIN(__kernel_get_syscall_map) + .cfi_startproc + mflr r12 + .cfi_register lr,r12 + mr. r4,r3 + get_datapage r3 + mtlr r12 +#ifdef __powerpc64__ + addi r3,r3,CFG_SYSCALL_MAP64 +#else + addi r3,r3,CFG_SYSCALL_MAP32 +#endif + crclr cr0*4+so + beqlr + li r0,NR_syscalls + stw r0,0(r4) + blr + .cfi_endproc +V_FUNCTION_END(__kernel_get_syscall_map) + +/* + * void unsigned long long __kernel_get_tbfreq(void); + * + * returns the timebase frequency in HZ + */ +V_FUNCTION_BEGIN(__kernel_get_tbfreq) + .cfi_startproc + mflr r12 + .cfi_register lr,r12 + get_datapage r3 +#ifndef __powerpc64__ + lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) +#endif + PPC_LL r3,CFG_TB_TICKS_PER_SEC(r3) + mtlr r12 + crclr cr0*4+so + blr + .cfi_endproc +V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/arch/powerpc/kernel/vdso/gen_vdso32_offsets.sh b/arch/powerpc/kernel/vdso/gen_vdso32_offsets.sh new file mode 100755 index 000000000000..c7b54a5dcd3e --- /dev/null +++ b/arch/powerpc/kernel/vdso/gen_vdso32_offsets.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# +# Match symbols in the DSO that look like VDSO_*; produce a header file +# of constant offsets into the shared object. +# +# Doing this inside the Makefile will break the $(filter-out) function, +# causing Kbuild to rebuild the vdso-offsets header file every time. +# +# Author: Will Deacon + */ +#include +#include + + .text +/* + * Exact prototype of getcpu + * + * int __kernel_getcpu(unsigned *cpu, unsigned *node); + * + */ +#if defined(CONFIG_PPC64) +V_FUNCTION_BEGIN(__kernel_getcpu) + .cfi_startproc + mfspr r5,SPRN_SPRG_VDSO_READ + PPC_LCMPI cr0,r3,0 + PPC_LCMPI cr1,r4,0 + clrlwi r6,r5,16 + rlwinm r7,r5,16,31-15,31-0 + beq cr0,1f + stw r6,0(r3) +1: crclr cr0*4+so + li r3,0 /* always success */ + beqlr cr1 + stw r7,0(r4) + blr + .cfi_endproc +V_FUNCTION_END(__kernel_getcpu) +#elif !defined(CONFIG_SMP) +V_FUNCTION_BEGIN(__kernel_getcpu) + .cfi_startproc + cmpwi cr0, r3, 0 + cmpwi cr1, r4, 0 + li r5, 0 + beq cr0, 1f + stw r5, 0(r3) +1: li r3, 0 /* always success */ + crclr cr0*4+so + beqlr cr1 + stw r5, 0(r4) + blr + .cfi_endproc +V_FUNCTION_END(__kernel_getcpu) +#endif diff --git a/arch/powerpc/kernel/vdso/gettimeofday.S b/arch/powerpc/kernel/vdso/gettimeofday.S new file mode 100644 index 000000000000..c875312274aa --- /dev/null +++ b/arch/powerpc/kernel/vdso/gettimeofday.S @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Userland implementation of gettimeofday() for processes + * for use in the vDSO + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org, + * IBM Corp. + */ +#include +#include +#include +#include +#include +#include +#include + + .text +/* + * Exact prototype of gettimeofday + * + * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); + * + */ +V_FUNCTION_BEGIN(__kernel_gettimeofday) + cvdso_call __c_kernel_gettimeofday +V_FUNCTION_END(__kernel_gettimeofday) + +/* + * Exact prototype of clock_gettime() + * + * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); + * + */ +V_FUNCTION_BEGIN(__kernel_clock_gettime) + cvdso_call __c_kernel_clock_gettime +V_FUNCTION_END(__kernel_clock_gettime) + +/* + * Exact prototype of clock_gettime64() + * + * int __kernel_clock_gettime64(clockid_t clock_id, struct __timespec64 *ts); + * + */ +#ifndef __powerpc64__ +V_FUNCTION_BEGIN(__kernel_clock_gettime64) + cvdso_call __c_kernel_clock_gettime64 +V_FUNCTION_END(__kernel_clock_gettime64) +#endif + +/* + * Exact prototype of clock_getres() + * + * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); + * + */ +V_FUNCTION_BEGIN(__kernel_clock_getres) + cvdso_call __c_kernel_clock_getres +V_FUNCTION_END(__kernel_clock_getres) + + +/* + * Exact prototype of time() + * + * time_t time(time *t); + * + */ +V_FUNCTION_BEGIN(__kernel_time) + cvdso_call_time __c_kernel_time +V_FUNCTION_END(__kernel_time) + +/* Routines for restoring integer registers, called by the compiler. */ +/* Called with r11 pointing to the stack header word of the caller of the */ +/* function, just beyond the end of the integer restore area. */ +#ifndef __powerpc64__ +_GLOBAL(_restgpr_31_x) +_GLOBAL(_rest32gpr_31_x) + lwz r0,4(r11) + lwz r31,-4(r11) + mtlr r0 + mr r1,r11 + blr +#endif diff --git a/arch/powerpc/kernel/vdso/note.S b/arch/powerpc/kernel/vdso/note.S new file mode 100644 index 000000000000..227a7327399e --- /dev/null +++ b/arch/powerpc/kernel/vdso/note.S @@ -0,0 +1,28 @@ +/* + * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text. + * Here we can supply some information useful to userland. + */ + +#include +#include +#include + +#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \ + .section name, flags; \ + .balign 4; \ + .long 1f - 0f; /* name length */ \ + .long 3f - 2f; /* data length */ \ + .long type; /* note type */ \ +0: .asciz vendor; /* vendor name */ \ +1: .balign 4; \ +2: + +#define ASM_ELF_NOTE_END \ +3: .balign 4; /* pad out section */ \ + .previous + + ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0) + .long LINUX_VERSION_CODE + ASM_ELF_NOTE_END + +BUILD_SALT diff --git a/arch/powerpc/kernel/vdso/sigtramp32.S b/arch/powerpc/kernel/vdso/sigtramp32.S new file mode 100644 index 000000000000..0bcc5e5fe789 --- /dev/null +++ b/arch/powerpc/kernel/vdso/sigtramp32.S @@ -0,0 +1,295 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Signal trampolines for 32 bits processes in a ppc64 kernel for + * use in the vDSO + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. + * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp. + */ +#include +#include +#include +#include + + .text + +/* The nop here is a hack. The dwarf2 unwind routines subtract 1 from + the return address to get an address in the middle of the presumed + call instruction. Since we don't have a call here, we artificially + extend the range covered by the unwind info by adding a nop before + the real start. */ + nop +V_FUNCTION_BEGIN(__kernel_sigtramp32) +.Lsig_start = . - 4 + li r0,__NR_sigreturn + sc +.Lsig_end: +V_FUNCTION_END(__kernel_sigtramp32) + +.Lsigrt_start: + nop +V_FUNCTION_BEGIN(__kernel_sigtramp_rt32) + li r0,__NR_rt_sigreturn + sc +.Lsigrt_end: +V_FUNCTION_END(__kernel_sigtramp_rt32) + + .section .eh_frame,"a",@progbits + +/* Register r1 can be found at offset 4 of a pt_regs structure. + A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ +#define cfa_save \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x23; .uleb128 RSIZE; /* DW_OP_plus_uconst */ \ + .byte 0x06; /* DW_OP_deref */ \ +9: + +/* Register REGNO can be found at offset OFS of a pt_regs structure. + A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ +#define rsave(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .ifne ofs; \ + .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ + .endif; \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 + of the VMX reg struct. The VMX reg struct is at offset VREGS of + the pt_regs struct. This macro is for REGNO == 0, and contains + 'subroutines' that the other macros jump to. */ +#define vsave_msr0(regno) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x30 + regno; /* DW_OP_lit0 */ \ +2: \ + .byte 0x40; /* DW_OP_lit16 */ \ + .byte 0x1e; /* DW_OP_mul */ \ +3: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x12; /* DW_OP_dup */ \ + .byte 0x23; /* DW_OP_plus_uconst */ \ + .uleb128 33*RSIZE; /* msr offset */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x0c; .long 1 << 25; /* DW_OP_const4u */ \ + .byte 0x1a; /* DW_OP_and */ \ + .byte 0x12; /* DW_OP_dup, ret 0 if bra taken */ \ + .byte 0x30; /* DW_OP_lit0 */ \ + .byte 0x29; /* DW_OP_eq */ \ + .byte 0x28; .short 0x7fff; /* DW_OP_bra to end */ \ + .byte 0x13; /* DW_OP_drop, pop the 0 */ \ + .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ + .byte 0x22; /* DW_OP_plus */ \ + .byte 0x2f; .short 0x7fff; /* DW_OP_skip to end */ \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 + of the VMX reg struct. REGNO is 1 thru 31. */ +#define vsave_msr1(regno) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x30 + regno; /* DW_OP_lit n */ \ + .byte 0x2f; .short 2b - 9f; /* DW_OP_skip */ \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of + the VMX save block. */ +#define vsave_msr2(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x0a; .short ofs; /* DW_OP_const2u */ \ + .byte 0x2f; .short 3b - 9f; /* DW_OP_skip */ \ +9: + +/* VMX register REGNO is at offset OFS of the VMX save area. */ +#define vsave(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ + .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ +9: + +/* This is where the pt_regs pointer can be found on the stack. */ +#define PTREGS 64+28 + +/* Size of regs. */ +#define RSIZE 4 + +/* This is the offset of the VMX regs. */ +#define VREGS 48*RSIZE+34*8 + +/* Describe where general purpose regs are saved. */ +#define EH_FRAME_GEN \ + cfa_save; \ + rsave ( 0, 0*RSIZE); \ + rsave ( 2, 2*RSIZE); \ + rsave ( 3, 3*RSIZE); \ + rsave ( 4, 4*RSIZE); \ + rsave ( 5, 5*RSIZE); \ + rsave ( 6, 6*RSIZE); \ + rsave ( 7, 7*RSIZE); \ + rsave ( 8, 8*RSIZE); \ + rsave ( 9, 9*RSIZE); \ + rsave (10, 10*RSIZE); \ + rsave (11, 11*RSIZE); \ + rsave (12, 12*RSIZE); \ + rsave (13, 13*RSIZE); \ + rsave (14, 14*RSIZE); \ + rsave (15, 15*RSIZE); \ + rsave (16, 16*RSIZE); \ + rsave (17, 17*RSIZE); \ + rsave (18, 18*RSIZE); \ + rsave (19, 19*RSIZE); \ + rsave (20, 20*RSIZE); \ + rsave (21, 21*RSIZE); \ + rsave (22, 22*RSIZE); \ + rsave (23, 23*RSIZE); \ + rsave (24, 24*RSIZE); \ + rsave (25, 25*RSIZE); \ + rsave (26, 26*RSIZE); \ + rsave (27, 27*RSIZE); \ + rsave (28, 28*RSIZE); \ + rsave (29, 29*RSIZE); \ + rsave (30, 30*RSIZE); \ + rsave (31, 31*RSIZE); \ + rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ + rsave (65, 36*RSIZE); /* lr */ \ + rsave (70, 38*RSIZE) /* cr */ + +/* Describe where the FP regs are saved. */ +#define EH_FRAME_FP \ + rsave (32, 48*RSIZE + 0*8); \ + rsave (33, 48*RSIZE + 1*8); \ + rsave (34, 48*RSIZE + 2*8); \ + rsave (35, 48*RSIZE + 3*8); \ + rsave (36, 48*RSIZE + 4*8); \ + rsave (37, 48*RSIZE + 5*8); \ + rsave (38, 48*RSIZE + 6*8); \ + rsave (39, 48*RSIZE + 7*8); \ + rsave (40, 48*RSIZE + 8*8); \ + rsave (41, 48*RSIZE + 9*8); \ + rsave (42, 48*RSIZE + 10*8); \ + rsave (43, 48*RSIZE + 11*8); \ + rsave (44, 48*RSIZE + 12*8); \ + rsave (45, 48*RSIZE + 13*8); \ + rsave (46, 48*RSIZE + 14*8); \ + rsave (47, 48*RSIZE + 15*8); \ + rsave (48, 48*RSIZE + 16*8); \ + rsave (49, 48*RSIZE + 17*8); \ + rsave (50, 48*RSIZE + 18*8); \ + rsave (51, 48*RSIZE + 19*8); \ + rsave (52, 48*RSIZE + 20*8); \ + rsave (53, 48*RSIZE + 21*8); \ + rsave (54, 48*RSIZE + 22*8); \ + rsave (55, 48*RSIZE + 23*8); \ + rsave (56, 48*RSIZE + 24*8); \ + rsave (57, 48*RSIZE + 25*8); \ + rsave (58, 48*RSIZE + 26*8); \ + rsave (59, 48*RSIZE + 27*8); \ + rsave (60, 48*RSIZE + 28*8); \ + rsave (61, 48*RSIZE + 29*8); \ + rsave (62, 48*RSIZE + 30*8); \ + rsave (63, 48*RSIZE + 31*8) + +/* Describe where the VMX regs are saved. */ +#ifdef CONFIG_ALTIVEC +#define EH_FRAME_VMX \ + vsave_msr0 ( 0); \ + vsave_msr1 ( 1); \ + vsave_msr1 ( 2); \ + vsave_msr1 ( 3); \ + vsave_msr1 ( 4); \ + vsave_msr1 ( 5); \ + vsave_msr1 ( 6); \ + vsave_msr1 ( 7); \ + vsave_msr1 ( 8); \ + vsave_msr1 ( 9); \ + vsave_msr1 (10); \ + vsave_msr1 (11); \ + vsave_msr1 (12); \ + vsave_msr1 (13); \ + vsave_msr1 (14); \ + vsave_msr1 (15); \ + vsave_msr1 (16); \ + vsave_msr1 (17); \ + vsave_msr1 (18); \ + vsave_msr1 (19); \ + vsave_msr1 (20); \ + vsave_msr1 (21); \ + vsave_msr1 (22); \ + vsave_msr1 (23); \ + vsave_msr1 (24); \ + vsave_msr1 (25); \ + vsave_msr1 (26); \ + vsave_msr1 (27); \ + vsave_msr1 (28); \ + vsave_msr1 (29); \ + vsave_msr1 (30); \ + vsave_msr1 (31); \ + vsave_msr2 (33, 32*16+12); \ + vsave (32, 32*16) +#else +#define EH_FRAME_VMX +#endif + +.Lcie: + .long .Lcie_end - .Lcie_start +.Lcie_start: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NUL-terminated augmentation string */ + .uleb128 4 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 67 /* Return address register column, ap */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel | DW_EH_PE_sdata4. */ + .byte 0x0c,1,0 /* DW_CFA_def_cfa: r1 ofs 0 */ + .balign 4 +.Lcie_end: + + .long .Lfde0_end - .Lfde0_start +.Lfde0_start: + .long .Lfde0_start - .Lcie /* CIE pointer. */ + .long .Lsig_start - . /* PC start, length */ + .long .Lsig_end - .Lsig_start + .uleb128 0 /* Augmentation */ + EH_FRAME_GEN + EH_FRAME_FP + EH_FRAME_VMX + .balign 4 +.Lfde0_end: + +/* We have a different stack layout for rt_sigreturn. */ +#undef PTREGS +#define PTREGS 64+16+128+20+28 + + .long .Lfde1_end - .Lfde1_start +.Lfde1_start: + .long .Lfde1_start - .Lcie /* CIE pointer. */ + .long .Lsigrt_start - . /* PC start, length */ + .long .Lsigrt_end - .Lsigrt_start + .uleb128 0 /* Augmentation */ + EH_FRAME_GEN + EH_FRAME_FP + EH_FRAME_VMX + .balign 4 +.Lfde1_end: diff --git a/arch/powerpc/kernel/vdso/sigtramp64.S b/arch/powerpc/kernel/vdso/sigtramp64.S new file mode 100644 index 000000000000..2d4067561293 --- /dev/null +++ b/arch/powerpc/kernel/vdso/sigtramp64.S @@ -0,0 +1,313 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Signal trampoline for 64 bits processes in a ppc64 kernel for + * use in the vDSO + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. + * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp. + */ +#include /* IFETCH_ALIGN_BYTES */ +#include +#include +#include +#include +#include /* XXX for __SIGNAL_FRAMESIZE */ + + .text + +/* + * __kernel_start_sigtramp_rt64 and __kernel_sigtramp_rt64 together + * are one function split in two parts. The kernel jumps to the former + * and the signal handler indirectly (by blr) returns to the latter. + * __kernel_sigtramp_rt64 needs to point to the return address so + * glibc can correctly identify the trampoline stack frame. + */ + .balign 8 + .balign IFETCH_ALIGN_BYTES +V_FUNCTION_BEGIN(__kernel_start_sigtramp_rt64) +.Lsigrt_start: + bctrl /* call the handler */ +V_FUNCTION_END(__kernel_start_sigtramp_rt64) +V_FUNCTION_BEGIN(__kernel_sigtramp_rt64) + addi r1, r1, __SIGNAL_FRAMESIZE + li r0,__NR_rt_sigreturn + sc +.Lsigrt_end: +V_FUNCTION_END(__kernel_sigtramp_rt64) +/* The .balign 8 above and the following zeros mimic the old stack + trampoline layout. The last magic value is the ucontext pointer, + chosen in such a way that older libgcc unwind code returns a zero + for a sigcontext pointer. */ + .long 0,0,0 + .quad 0,-21*8 + +/* Register r1 can be found at offset 8 of a pt_regs structure. + A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ +#define cfa_save \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x23; .uleb128 RSIZE; /* DW_OP_plus_uconst */ \ + .byte 0x06; /* DW_OP_deref */ \ +9: + +/* Register REGNO can be found at offset OFS of a pt_regs structure. + A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ +#define rsave(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .ifne ofs; \ + .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ + .endif; \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 + of the VMX reg struct. A pointer to the VMX reg struct is at VREGS in + the pt_regs struct. This macro is for REGNO == 0, and contains + 'subroutines' that the other macros jump to. */ +#define vsave_msr0(regno) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x30 + regno; /* DW_OP_lit0 */ \ +2: \ + .byte 0x40; /* DW_OP_lit16 */ \ + .byte 0x1e; /* DW_OP_mul */ \ +3: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x12; /* DW_OP_dup */ \ + .byte 0x23; /* DW_OP_plus_uconst */ \ + .uleb128 33*RSIZE; /* msr offset */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x0c; .long 1 << 25; /* DW_OP_const4u */ \ + .byte 0x1a; /* DW_OP_and */ \ + .byte 0x12; /* DW_OP_dup, ret 0 if bra taken */ \ + .byte 0x30; /* DW_OP_lit0 */ \ + .byte 0x29; /* DW_OP_eq */ \ + .byte 0x28; .short 0x7fff; /* DW_OP_bra to end */ \ + .byte 0x13; /* DW_OP_drop, pop the 0 */ \ + .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x22; /* DW_OP_plus */ \ + .byte 0x2f; .short 0x7fff; /* DW_OP_skip to end */ \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 + of the VMX reg struct. REGNO is 1 thru 31. */ +#define vsave_msr1(regno) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x30 + regno; /* DW_OP_lit n */ \ + .byte 0x2f; .short 2b - 9f; /* DW_OP_skip */ \ +9: + +/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of + the VMX save block. */ +#define vsave_msr2(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x0a; .short ofs; /* DW_OP_const2u */ \ + .byte 0x2f; .short 3b - 9f; /* DW_OP_skip */ \ +9: + +/* VMX register REGNO is at offset OFS of the VMX save area. */ +#define vsave(regno, ofs) \ + .byte 0x10; /* DW_CFA_expression */ \ + .uleb128 regno + 77; /* regno */ \ + .uleb128 9f - 1f; /* length */ \ +1: \ + .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ + .byte 0x06; /* DW_OP_deref */ \ + .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ +9: + +/* This is where the pt_regs pointer can be found on the stack. */ +#define PTREGS 128+168+56 + +/* Size of regs. */ +#define RSIZE 8 + +/* Size of CR reg in DWARF unwind info. */ +#define CRSIZE 4 + +/* Offset of CR reg within a full word. */ +#ifdef __LITTLE_ENDIAN__ +#define CROFF 0 +#else +#define CROFF (RSIZE - CRSIZE) +#endif + +/* This is the offset of the VMX reg pointer. */ +#define VREGS 48*RSIZE+33*8 + +/* Describe where general purpose regs are saved. */ +#define EH_FRAME_GEN \ + cfa_save; \ + rsave ( 0, 0*RSIZE); \ + rsave ( 2, 2*RSIZE); \ + rsave ( 3, 3*RSIZE); \ + rsave ( 4, 4*RSIZE); \ + rsave ( 5, 5*RSIZE); \ + rsave ( 6, 6*RSIZE); \ + rsave ( 7, 7*RSIZE); \ + rsave ( 8, 8*RSIZE); \ + rsave ( 9, 9*RSIZE); \ + rsave (10, 10*RSIZE); \ + rsave (11, 11*RSIZE); \ + rsave (12, 12*RSIZE); \ + rsave (13, 13*RSIZE); \ + rsave (14, 14*RSIZE); \ + rsave (15, 15*RSIZE); \ + rsave (16, 16*RSIZE); \ + rsave (17, 17*RSIZE); \ + rsave (18, 18*RSIZE); \ + rsave (19, 19*RSIZE); \ + rsave (20, 20*RSIZE); \ + rsave (21, 21*RSIZE); \ + rsave (22, 22*RSIZE); \ + rsave (23, 23*RSIZE); \ + rsave (24, 24*RSIZE); \ + rsave (25, 25*RSIZE); \ + rsave (26, 26*RSIZE); \ + rsave (27, 27*RSIZE); \ + rsave (28, 28*RSIZE); \ + rsave (29, 29*RSIZE); \ + rsave (30, 30*RSIZE); \ + rsave (31, 31*RSIZE); \ + rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ + rsave (65, 36*RSIZE); /* lr */ \ + rsave (68, 38*RSIZE + CROFF); /* cr fields */ \ + rsave (69, 38*RSIZE + CROFF); \ + rsave (70, 38*RSIZE + CROFF); \ + rsave (71, 38*RSIZE + CROFF); \ + rsave (72, 38*RSIZE + CROFF); \ + rsave (73, 38*RSIZE + CROFF); \ + rsave (74, 38*RSIZE + CROFF); \ + rsave (75, 38*RSIZE + CROFF) + +/* Describe where the FP regs are saved. */ +#define EH_FRAME_FP \ + rsave (32, 48*RSIZE + 0*8); \ + rsave (33, 48*RSIZE + 1*8); \ + rsave (34, 48*RSIZE + 2*8); \ + rsave (35, 48*RSIZE + 3*8); \ + rsave (36, 48*RSIZE + 4*8); \ + rsave (37, 48*RSIZE + 5*8); \ + rsave (38, 48*RSIZE + 6*8); \ + rsave (39, 48*RSIZE + 7*8); \ + rsave (40, 48*RSIZE + 8*8); \ + rsave (41, 48*RSIZE + 9*8); \ + rsave (42, 48*RSIZE + 10*8); \ + rsave (43, 48*RSIZE + 11*8); \ + rsave (44, 48*RSIZE + 12*8); \ + rsave (45, 48*RSIZE + 13*8); \ + rsave (46, 48*RSIZE + 14*8); \ + rsave (47, 48*RSIZE + 15*8); \ + rsave (48, 48*RSIZE + 16*8); \ + rsave (49, 48*RSIZE + 17*8); \ + rsave (50, 48*RSIZE + 18*8); \ + rsave (51, 48*RSIZE + 19*8); \ + rsave (52, 48*RSIZE + 20*8); \ + rsave (53, 48*RSIZE + 21*8); \ + rsave (54, 48*RSIZE + 22*8); \ + rsave (55, 48*RSIZE + 23*8); \ + rsave (56, 48*RSIZE + 24*8); \ + rsave (57, 48*RSIZE + 25*8); \ + rsave (58, 48*RSIZE + 26*8); \ + rsave (59, 48*RSIZE + 27*8); \ + rsave (60, 48*RSIZE + 28*8); \ + rsave (61, 48*RSIZE + 29*8); \ + rsave (62, 48*RSIZE + 30*8); \ + rsave (63, 48*RSIZE + 31*8) + +/* Describe where the VMX regs are saved. */ +#ifdef CONFIG_ALTIVEC +#define EH_FRAME_VMX \ + vsave_msr0 ( 0); \ + vsave_msr1 ( 1); \ + vsave_msr1 ( 2); \ + vsave_msr1 ( 3); \ + vsave_msr1 ( 4); \ + vsave_msr1 ( 5); \ + vsave_msr1 ( 6); \ + vsave_msr1 ( 7); \ + vsave_msr1 ( 8); \ + vsave_msr1 ( 9); \ + vsave_msr1 (10); \ + vsave_msr1 (11); \ + vsave_msr1 (12); \ + vsave_msr1 (13); \ + vsave_msr1 (14); \ + vsave_msr1 (15); \ + vsave_msr1 (16); \ + vsave_msr1 (17); \ + vsave_msr1 (18); \ + vsave_msr1 (19); \ + vsave_msr1 (20); \ + vsave_msr1 (21); \ + vsave_msr1 (22); \ + vsave_msr1 (23); \ + vsave_msr1 (24); \ + vsave_msr1 (25); \ + vsave_msr1 (26); \ + vsave_msr1 (27); \ + vsave_msr1 (28); \ + vsave_msr1 (29); \ + vsave_msr1 (30); \ + vsave_msr1 (31); \ + vsave_msr2 (33, 32*16+12); \ + vsave (32, 33*16) +#else +#define EH_FRAME_VMX +#endif + + .section .eh_frame,"a",@progbits +.Lcie: + .long .Lcie_end - .Lcie_start +.Lcie_start: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NUL-terminated augmentation string */ + .uleb128 4 /* Code alignment factor */ + .sleb128 -8 /* Data alignment factor */ + .byte 67 /* Return address register column, ap */ + .uleb128 1 /* Augmentation value length */ + .byte 0x14 /* DW_EH_PE_pcrel | DW_EH_PE_udata8. */ + .byte 0x0c,1,0 /* DW_CFA_def_cfa: r1 ofs 0 */ + .balign 8 +.Lcie_end: + + .long .Lfde0_end - .Lfde0_start +.Lfde0_start: + .long .Lfde0_start - .Lcie /* CIE pointer. */ + .quad .Lsigrt_start - . /* PC start, length */ + .quad .Lsigrt_end - .Lsigrt_start + .uleb128 0 /* Augmentation */ + EH_FRAME_GEN + EH_FRAME_FP + EH_FRAME_VMX +# Do we really need to describe the frame at this point? ie. will +# we ever have some call chain that returns somewhere past the addi? +# I don't think so, since gcc doesn't support async signals. +# .byte 0x41 /* DW_CFA_advance_loc 1*4 */ +#undef PTREGS +#define PTREGS 168+56 +# EH_FRAME_GEN +# EH_FRAME_FP +# EH_FRAME_VMX + .balign 8 +.Lfde0_end: diff --git a/arch/powerpc/kernel/vdso/vdso32.lds.S b/arch/powerpc/kernel/vdso/vdso32.lds.S new file mode 100644 index 000000000000..58e0099f70f4 --- /dev/null +++ b/arch/powerpc/kernel/vdso/vdso32.lds.S @@ -0,0 +1,140 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This is the infamous ld script for the 32 bits vdso + * library + */ +#include +#include +#include + +#ifdef __LITTLE_ENDIAN__ +OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle") +#else +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +#endif +OUTPUT_ARCH(powerpc:common) +ENTRY(_start) + +SECTIONS +{ + PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE); + . = SIZEOF_HEADERS; + + .hash : { *(.hash) } :text + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + + .note : { *(.note.*) } :text :note + + . = ALIGN(16); + .text : { + *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) + } :text + PROVIDE(__etext = .); + PROVIDE(_etext = .); + PROVIDE(etext = .); + + . = ALIGN(8); + VDSO_ftr_fixup_start = .; + __ftr_fixup : { *(__ftr_fixup) } + VDSO_ftr_fixup_end = .; + + . = ALIGN(8); + VDSO_mmu_ftr_fixup_start = .; + __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } + VDSO_mmu_ftr_fixup_end = .; + + . = ALIGN(8); + VDSO_lwsync_fixup_start = .; + __lwsync_fixup : { *(__lwsync_fixup) } + VDSO_lwsync_fixup_end = .; + +#ifdef CONFIG_PPC64 + . = ALIGN(8); + VDSO_fw_ftr_fixup_start = .; + __fw_ftr_fixup : { *(__fw_ftr_fixup) } + VDSO_fw_ftr_fixup_end = .; +#endif + + /* + * Other stuff is appended to the text segment: + */ + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr + .eh_frame : { KEEP (*(.eh_frame)) } :text + .gcc_except_table : { *(.gcc_except_table) } + .fixup : { *(.fixup) } + + .dynamic : { *(.dynamic) } :text :dynamic + .got : { *(.got) } :text + .plt : { *(.plt) } + + _end = .; + __end = .; + PROVIDE(end = .); + + STABS_DEBUG + DWARF_DEBUG + ELF_DETAILS + + /DISCARD/ : { + *(.note.GNU-stack) + *(.data .data.* .gnu.linkonce.d.* .sdata*) + *(.bss .sbss .dynbss .dynsbss) + *(.got1) + } +} + +/* + * Very old versions of ld do not recognize this name token; use the constant. + */ +#define PT_GNU_EH_FRAME 0x6474e550 + +/* + * We must supply the ELF program headers explicitly to get just one + * PT_LOAD segment, and set the flags explicitly to make segments read-only. + */ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ + dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ + note PT_NOTE FLAGS(4); /* PF_R */ + eh_frame_hdr PT_GNU_EH_FRAME; +} + +/* + * This controls what symbols we export from the DSO. + */ +VERSION +{ + VDSO_VERSION_STRING { + global: + __kernel_get_syscall_map; + __kernel_gettimeofday; + __kernel_clock_gettime; + __kernel_clock_gettime64; + __kernel_clock_getres; + __kernel_time; + __kernel_get_tbfreq; + __kernel_sync_dicache; + __kernel_sigtramp32; + __kernel_sigtramp_rt32; +#if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) + __kernel_getcpu; +#endif + + local: *; + }; +} + +/* + * Make the sigreturn code visible to the kernel. + */ +VDSO_sigtramp32 = __kernel_sigtramp32; +VDSO_sigtramp_rt32 = __kernel_sigtramp_rt32; diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S new file mode 100644 index 000000000000..0288cad428b0 --- /dev/null +++ b/arch/powerpc/kernel/vdso/vdso64.lds.S @@ -0,0 +1,134 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This is the infamous ld script for the 64 bits vdso + * library + */ +#include +#include +#include + +#ifdef __LITTLE_ENDIAN__ +OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle") +#else +OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc") +#endif +OUTPUT_ARCH(powerpc:common64) +ENTRY(_start) + +SECTIONS +{ + PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE); + . = SIZEOF_HEADERS; + + .hash : { *(.hash) } :text + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + + .note : { *(.note.*) } :text :note + + . = ALIGN(16); + .text : { + *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) + *(.sfpr .glink) + } :text + PROVIDE(__etext = .); + PROVIDE(_etext = .); + PROVIDE(etext = .); + + . = ALIGN(8); + VDSO_ftr_fixup_start = .; + __ftr_fixup : { *(__ftr_fixup) } + VDSO_ftr_fixup_end = .; + + . = ALIGN(8); + VDSO_mmu_ftr_fixup_start = .; + __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } + VDSO_mmu_ftr_fixup_end = .; + + . = ALIGN(8); + VDSO_lwsync_fixup_start = .; + __lwsync_fixup : { *(__lwsync_fixup) } + VDSO_lwsync_fixup_end = .; + + . = ALIGN(8); + VDSO_fw_ftr_fixup_start = .; + __fw_ftr_fixup : { *(__fw_ftr_fixup) } + VDSO_fw_ftr_fixup_end = .; + + /* + * Other stuff is appended to the text segment: + */ + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + + .dynamic : { *(.dynamic) } :text :dynamic + + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr + .eh_frame : { KEEP (*(.eh_frame)) } :text + .gcc_except_table : { *(.gcc_except_table) } + .rela.dyn ALIGN(8) : { *(.rela.dyn) } + + .got ALIGN(8) : { *(.got .toc) } + + _end = .; + PROVIDE(end = .); + + STABS_DEBUG + DWARF_DEBUG + ELF_DETAILS + + /DISCARD/ : { + *(.note.GNU-stack) + *(.branch_lt) + *(.data .data.* .gnu.linkonce.d.* .sdata*) + *(.bss .sbss .dynbss .dynsbss) + *(.opd) + } +} + +/* + * Very old versions of ld do not recognize this name token; use the constant. + */ +#define PT_GNU_EH_FRAME 0x6474e550 + +/* + * We must supply the ELF program headers explicitly to get just one + * PT_LOAD segment, and set the flags explicitly to make segments read-only. + */ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ + dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ + note PT_NOTE FLAGS(4); /* PF_R */ + eh_frame_hdr PT_GNU_EH_FRAME; +} + +/* + * This controls what symbols we export from the DSO. + */ +VERSION +{ + VDSO_VERSION_STRING { + global: + __kernel_get_syscall_map; + __kernel_gettimeofday; + __kernel_clock_gettime; + __kernel_clock_getres; + __kernel_get_tbfreq; + __kernel_sync_dicache; + __kernel_sigtramp_rt64; + __kernel_getcpu; + __kernel_time; + + local: *; + }; +} + +/* + * Make the sigreturn code visible to the kernel. + */ +VDSO_sigtramp_rt64 = __kernel_start_sigtramp_rt64; diff --git a/arch/powerpc/kernel/vdso/vgettimeofday.c b/arch/powerpc/kernel/vdso/vgettimeofday.c new file mode 100644 index 000000000000..55a287c9a736 --- /dev/null +++ b/arch/powerpc/kernel/vdso/vgettimeofday.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Powerpc userspace implementations of gettimeofday() and similar. + */ +#include +#include + +#ifdef __powerpc64__ +int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts, + const struct vdso_data *vd) +{ + return __cvdso_clock_gettime_data(vd, clock, ts); +} + +int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res, + const struct vdso_data *vd) +{ + return __cvdso_clock_getres_data(vd, clock_id, res); +} +#else +int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts, + const struct vdso_data *vd) +{ + return __cvdso_clock_gettime32_data(vd, clock, ts); +} + +int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts, + const struct vdso_data *vd) +{ + return __cvdso_clock_gettime_data(vd, clock, ts); +} + +int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res, + const struct vdso_data *vd) +{ + return __cvdso_clock_getres_time32_data(vd, clock_id, res); +} +#endif + +int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz, + const struct vdso_data *vd) +{ + return __cvdso_gettimeofday_data(vd, tv, tz); +} + +__kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso_data *vd) +{ + return __cvdso_time_data(vd, time); +} diff --git a/arch/powerpc/kernel/vdso32/.gitignore b/arch/powerpc/kernel/vdso32/.gitignore deleted file mode 100644 index 824b863ec6bd..000000000000 --- a/arch/powerpc/kernel/vdso32/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -vdso32.lds -vdso32.so.dbg diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile deleted file mode 100644 index 7d7b38d90ca5..000000000000 --- a/arch/powerpc/kernel/vdso32/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -# List of files in the vdso, has to be asm only for now - -ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24 -include $(srctree)/lib/vdso/Makefile - -obj-vdso32 = sigtramp32-32.o gettimeofday-32.o datapage-32.o cacheflush-32.o note-32.o getcpu-32.o - -ifneq ($(c-gettimeofday-y),) - CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc -endif - -# Build rules - -ifdef CROSS32_COMPILE - VDSOCC := $(CROSS32_COMPILE)gcc -else - VDSOCC := $(CC) -endif - -targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o -obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) - -GCOV_PROFILE := n -KCOV_INSTRUMENT := n -UBSAN_SANITIZE := n -KASAN_SANITIZE := n - -ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both - -CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32 -AS32FLAGS := -D__VDSO32__ -s - -targets += vdso32.lds -CPPFLAGS_vdso32.lds += -P -C -Upowerpc - -# link rule for the .so file, .lds has to be first -$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o FORCE - $(call if_changed,vdso32ld_and_check) - -# assembly rules for the .S files -$(obj-vdso32): %-32.o: %.S FORCE - $(call if_changed_dep,vdso32as) -$(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE - $(call if_changed_dep,vdso32cc) - -# Generate VDSO offsets using helper script -gen-vdso32sym := $(srctree)/$(src)/gen_vdso32_offsets.sh -quiet_cmd_vdso32sym = VDSO32SYM $@ - cmd_vdso32sym = $(NM) $< | $(gen-vdso32sym) | LC_ALL=C sort > $@ - -include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE - $(call if_changed,vdso32sym) - -# actual build commands -quiet_cmd_vdso32ld_and_check = VDSO32L $@ - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check) -quiet_cmd_vdso32as = VDSO32A $@ - cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $< -quiet_cmd_vdso32cc = VDSO32C $@ - cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S deleted file mode 100644 index d4e43ab2d5df..000000000000 --- a/arch/powerpc/kernel/vdso32/cacheflush.S +++ /dev/null @@ -1,98 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * vDSO provided cache flush routines - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), - * IBM Corp. - */ -#include -#include -#include -#include -#include -#include - - .text - -/* - * Default "generic" version of __kernel_sync_dicache. - * - * void __kernel_sync_dicache(unsigned long start, unsigned long end) - * - * Flushes the data cache & invalidate the instruction cache for the - * provided range [start, end[ - */ -V_FUNCTION_BEGIN(__kernel_sync_dicache) - .cfi_startproc -BEGIN_FTR_SECTION - b 3f -END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) -#ifdef CONFIG_PPC64 - mflr r12 - .cfi_register lr,r12 - get_datapage r10 - mtlr r12 - .cfi_restore lr -#endif - -#ifdef CONFIG_PPC64 - lwz r7,CFG_DCACHE_BLOCKSZ(r10) - addi r5,r7,-1 -#else - li r5, L1_CACHE_BYTES - 1 -#endif - andc r6,r3,r5 /* round low to line bdy */ - subf r8,r6,r4 /* compute length */ - add r8,r8,r5 /* ensure we get enough */ -#ifdef CONFIG_PPC64 - lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) - PPC_SRL. r8,r8,r9 /* compute line count */ -#else - srwi. r8, r8, L1_CACHE_SHIFT - mr r7, r6 -#endif - crclr cr0*4+so - beqlr /* nothing to do? */ - mtctr r8 -1: dcbst 0,r6 -#ifdef CONFIG_PPC64 - add r6,r6,r7 -#else - addi r6, r6, L1_CACHE_BYTES -#endif - bdnz 1b - sync - -/* Now invalidate the instruction cache */ - -#ifdef CONFIG_PPC64 - lwz r7,CFG_ICACHE_BLOCKSZ(r10) - addi r5,r7,-1 - andc r6,r3,r5 /* round low to line bdy */ - subf r8,r6,r4 /* compute length */ - add r8,r8,r5 - lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) - PPC_SRL. r8,r8,r9 /* compute line count */ - crclr cr0*4+so - beqlr /* nothing to do? */ -#endif - mtctr r8 -#ifdef CONFIG_PPC64 -2: icbi 0,r6 - add r6,r6,r7 -#else -2: icbi 0, r7 - addi r7, r7, L1_CACHE_BYTES -#endif - bdnz 2b - isync - li r3,0 - blr -3: - crclr cr0*4+so - sync - isync - li r3,0 - blr - .cfi_endproc -V_FUNCTION_END(__kernel_sync_dicache) diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S deleted file mode 100644 index db8e167f0166..000000000000 --- a/arch/powerpc/kernel/vdso32/datapage.S +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Access to the shared data page by the vDSO & syscall map - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. - */ - -#include -#include -#include -#include -#include -#include - - .text - -/* - * void *__kernel_get_syscall_map(unsigned int *syscall_count) ; - * - * returns a pointer to the syscall map. the map is agnostic to the - * size of "long", unlike kernel bitops, it stores bits from top to - * bottom so that memory actually contains a linear bitmap - * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of - * 32 bits int at N >> 5. - */ -V_FUNCTION_BEGIN(__kernel_get_syscall_map) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - mr. r4,r3 - get_datapage r3 - mtlr r12 -#ifdef __powerpc64__ - addi r3,r3,CFG_SYSCALL_MAP64 -#else - addi r3,r3,CFG_SYSCALL_MAP32 -#endif - crclr cr0*4+so - beqlr - li r0,NR_syscalls - stw r0,0(r4) - blr - .cfi_endproc -V_FUNCTION_END(__kernel_get_syscall_map) - -/* - * void unsigned long long __kernel_get_tbfreq(void); - * - * returns the timebase frequency in HZ - */ -V_FUNCTION_BEGIN(__kernel_get_tbfreq) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - get_datapage r3 -#ifndef __powerpc64__ - lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) -#endif - PPC_LL r3,CFG_TB_TICKS_PER_SEC(r3) - mtlr r12 - crclr cr0*4+so - blr - .cfi_endproc -V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/arch/powerpc/kernel/vdso32/gen_vdso32_offsets.sh b/arch/powerpc/kernel/vdso32/gen_vdso32_offsets.sh deleted file mode 100755 index c7b54a5dcd3e..000000000000 --- a/arch/powerpc/kernel/vdso32/gen_vdso32_offsets.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -# -# Match symbols in the DSO that look like VDSO_*; produce a header file -# of constant offsets into the shared object. -# -# Doing this inside the Makefile will break the $(filter-out) function, -# causing Kbuild to rebuild the vdso-offsets header file every time. -# -# Author: Will Deacon - */ -#include -#include - - .text -/* - * Exact prototype of getcpu - * - * int __kernel_getcpu(unsigned *cpu, unsigned *node); - * - */ -#if defined(CONFIG_PPC64) -V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - mfspr r5,SPRN_SPRG_VDSO_READ - PPC_LCMPI cr0,r3,0 - PPC_LCMPI cr1,r4,0 - clrlwi r6,r5,16 - rlwinm r7,r5,16,31-15,31-0 - beq cr0,1f - stw r6,0(r3) -1: crclr cr0*4+so - li r3,0 /* always success */ - beqlr cr1 - stw r7,0(r4) - blr - .cfi_endproc -V_FUNCTION_END(__kernel_getcpu) -#elif !defined(CONFIG_SMP) -V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - cmpwi cr0, r3, 0 - cmpwi cr1, r4, 0 - li r5, 0 - beq cr0, 1f - stw r5, 0(r3) -1: li r3, 0 /* always success */ - crclr cr0*4+so - beqlr cr1 - stw r5, 0(r4) - blr - .cfi_endproc -V_FUNCTION_END(__kernel_getcpu) -#endif diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S deleted file mode 100644 index c875312274aa..000000000000 --- a/arch/powerpc/kernel/vdso32/gettimeofday.S +++ /dev/null @@ -1,82 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Userland implementation of gettimeofday() for processes - * for use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org, - * IBM Corp. - */ -#include -#include -#include -#include -#include -#include -#include - - .text -/* - * Exact prototype of gettimeofday - * - * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); - * - */ -V_FUNCTION_BEGIN(__kernel_gettimeofday) - cvdso_call __c_kernel_gettimeofday -V_FUNCTION_END(__kernel_gettimeofday) - -/* - * Exact prototype of clock_gettime() - * - * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_gettime) - cvdso_call __c_kernel_clock_gettime -V_FUNCTION_END(__kernel_clock_gettime) - -/* - * Exact prototype of clock_gettime64() - * - * int __kernel_clock_gettime64(clockid_t clock_id, struct __timespec64 *ts); - * - */ -#ifndef __powerpc64__ -V_FUNCTION_BEGIN(__kernel_clock_gettime64) - cvdso_call __c_kernel_clock_gettime64 -V_FUNCTION_END(__kernel_clock_gettime64) -#endif - -/* - * Exact prototype of clock_getres() - * - * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_getres) - cvdso_call __c_kernel_clock_getres -V_FUNCTION_END(__kernel_clock_getres) - - -/* - * Exact prototype of time() - * - * time_t time(time *t); - * - */ -V_FUNCTION_BEGIN(__kernel_time) - cvdso_call_time __c_kernel_time -V_FUNCTION_END(__kernel_time) - -/* Routines for restoring integer registers, called by the compiler. */ -/* Called with r11 pointing to the stack header word of the caller of the */ -/* function, just beyond the end of the integer restore area. */ -#ifndef __powerpc64__ -_GLOBAL(_restgpr_31_x) -_GLOBAL(_rest32gpr_31_x) - lwz r0,4(r11) - lwz r31,-4(r11) - mtlr r0 - mr r1,r11 - blr -#endif diff --git a/arch/powerpc/kernel/vdso32/note.S b/arch/powerpc/kernel/vdso32/note.S deleted file mode 100644 index 227a7327399e..000000000000 --- a/arch/powerpc/kernel/vdso32/note.S +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text. - * Here we can supply some information useful to userland. - */ - -#include -#include -#include - -#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \ - .section name, flags; \ - .balign 4; \ - .long 1f - 0f; /* name length */ \ - .long 3f - 2f; /* data length */ \ - .long type; /* note type */ \ -0: .asciz vendor; /* vendor name */ \ -1: .balign 4; \ -2: - -#define ASM_ELF_NOTE_END \ -3: .balign 4; /* pad out section */ \ - .previous - - ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0) - .long LINUX_VERSION_CODE - ASM_ELF_NOTE_END - -BUILD_SALT diff --git a/arch/powerpc/kernel/vdso32/sigtramp32.S b/arch/powerpc/kernel/vdso32/sigtramp32.S deleted file mode 100644 index 0bcc5e5fe789..000000000000 --- a/arch/powerpc/kernel/vdso32/sigtramp32.S +++ /dev/null @@ -1,295 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Signal trampolines for 32 bits processes in a ppc64 kernel for - * use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. - * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp. - */ -#include -#include -#include -#include - - .text - -/* The nop here is a hack. The dwarf2 unwind routines subtract 1 from - the return address to get an address in the middle of the presumed - call instruction. Since we don't have a call here, we artificially - extend the range covered by the unwind info by adding a nop before - the real start. */ - nop -V_FUNCTION_BEGIN(__kernel_sigtramp32) -.Lsig_start = . - 4 - li r0,__NR_sigreturn - sc -.Lsig_end: -V_FUNCTION_END(__kernel_sigtramp32) - -.Lsigrt_start: - nop -V_FUNCTION_BEGIN(__kernel_sigtramp_rt32) - li r0,__NR_rt_sigreturn - sc -.Lsigrt_end: -V_FUNCTION_END(__kernel_sigtramp_rt32) - - .section .eh_frame,"a",@progbits - -/* Register r1 can be found at offset 4 of a pt_regs structure. - A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ -#define cfa_save \ - .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x23; .uleb128 RSIZE; /* DW_OP_plus_uconst */ \ - .byte 0x06; /* DW_OP_deref */ \ -9: - -/* Register REGNO can be found at offset OFS of a pt_regs structure. - A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ -#define rsave(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .ifne ofs; \ - .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ - .endif; \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 - of the VMX reg struct. The VMX reg struct is at offset VREGS of - the pt_regs struct. This macro is for REGNO == 0, and contains - 'subroutines' that the other macros jump to. */ -#define vsave_msr0(regno) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x30 + regno; /* DW_OP_lit0 */ \ -2: \ - .byte 0x40; /* DW_OP_lit16 */ \ - .byte 0x1e; /* DW_OP_mul */ \ -3: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x12; /* DW_OP_dup */ \ - .byte 0x23; /* DW_OP_plus_uconst */ \ - .uleb128 33*RSIZE; /* msr offset */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x0c; .long 1 << 25; /* DW_OP_const4u */ \ - .byte 0x1a; /* DW_OP_and */ \ - .byte 0x12; /* DW_OP_dup, ret 0 if bra taken */ \ - .byte 0x30; /* DW_OP_lit0 */ \ - .byte 0x29; /* DW_OP_eq */ \ - .byte 0x28; .short 0x7fff; /* DW_OP_bra to end */ \ - .byte 0x13; /* DW_OP_drop, pop the 0 */ \ - .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ - .byte 0x22; /* DW_OP_plus */ \ - .byte 0x2f; .short 0x7fff; /* DW_OP_skip to end */ \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 - of the VMX reg struct. REGNO is 1 thru 31. */ -#define vsave_msr1(regno) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x30 + regno; /* DW_OP_lit n */ \ - .byte 0x2f; .short 2b - 9f; /* DW_OP_skip */ \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of - the VMX save block. */ -#define vsave_msr2(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x0a; .short ofs; /* DW_OP_const2u */ \ - .byte 0x2f; .short 3b - 9f; /* DW_OP_skip */ \ -9: - -/* VMX register REGNO is at offset OFS of the VMX save area. */ -#define vsave(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ - .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ -9: - -/* This is where the pt_regs pointer can be found on the stack. */ -#define PTREGS 64+28 - -/* Size of regs. */ -#define RSIZE 4 - -/* This is the offset of the VMX regs. */ -#define VREGS 48*RSIZE+34*8 - -/* Describe where general purpose regs are saved. */ -#define EH_FRAME_GEN \ - cfa_save; \ - rsave ( 0, 0*RSIZE); \ - rsave ( 2, 2*RSIZE); \ - rsave ( 3, 3*RSIZE); \ - rsave ( 4, 4*RSIZE); \ - rsave ( 5, 5*RSIZE); \ - rsave ( 6, 6*RSIZE); \ - rsave ( 7, 7*RSIZE); \ - rsave ( 8, 8*RSIZE); \ - rsave ( 9, 9*RSIZE); \ - rsave (10, 10*RSIZE); \ - rsave (11, 11*RSIZE); \ - rsave (12, 12*RSIZE); \ - rsave (13, 13*RSIZE); \ - rsave (14, 14*RSIZE); \ - rsave (15, 15*RSIZE); \ - rsave (16, 16*RSIZE); \ - rsave (17, 17*RSIZE); \ - rsave (18, 18*RSIZE); \ - rsave (19, 19*RSIZE); \ - rsave (20, 20*RSIZE); \ - rsave (21, 21*RSIZE); \ - rsave (22, 22*RSIZE); \ - rsave (23, 23*RSIZE); \ - rsave (24, 24*RSIZE); \ - rsave (25, 25*RSIZE); \ - rsave (26, 26*RSIZE); \ - rsave (27, 27*RSIZE); \ - rsave (28, 28*RSIZE); \ - rsave (29, 29*RSIZE); \ - rsave (30, 30*RSIZE); \ - rsave (31, 31*RSIZE); \ - rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ - rsave (65, 36*RSIZE); /* lr */ \ - rsave (70, 38*RSIZE) /* cr */ - -/* Describe where the FP regs are saved. */ -#define EH_FRAME_FP \ - rsave (32, 48*RSIZE + 0*8); \ - rsave (33, 48*RSIZE + 1*8); \ - rsave (34, 48*RSIZE + 2*8); \ - rsave (35, 48*RSIZE + 3*8); \ - rsave (36, 48*RSIZE + 4*8); \ - rsave (37, 48*RSIZE + 5*8); \ - rsave (38, 48*RSIZE + 6*8); \ - rsave (39, 48*RSIZE + 7*8); \ - rsave (40, 48*RSIZE + 8*8); \ - rsave (41, 48*RSIZE + 9*8); \ - rsave (42, 48*RSIZE + 10*8); \ - rsave (43, 48*RSIZE + 11*8); \ - rsave (44, 48*RSIZE + 12*8); \ - rsave (45, 48*RSIZE + 13*8); \ - rsave (46, 48*RSIZE + 14*8); \ - rsave (47, 48*RSIZE + 15*8); \ - rsave (48, 48*RSIZE + 16*8); \ - rsave (49, 48*RSIZE + 17*8); \ - rsave (50, 48*RSIZE + 18*8); \ - rsave (51, 48*RSIZE + 19*8); \ - rsave (52, 48*RSIZE + 20*8); \ - rsave (53, 48*RSIZE + 21*8); \ - rsave (54, 48*RSIZE + 22*8); \ - rsave (55, 48*RSIZE + 23*8); \ - rsave (56, 48*RSIZE + 24*8); \ - rsave (57, 48*RSIZE + 25*8); \ - rsave (58, 48*RSIZE + 26*8); \ - rsave (59, 48*RSIZE + 27*8); \ - rsave (60, 48*RSIZE + 28*8); \ - rsave (61, 48*RSIZE + 29*8); \ - rsave (62, 48*RSIZE + 30*8); \ - rsave (63, 48*RSIZE + 31*8) - -/* Describe where the VMX regs are saved. */ -#ifdef CONFIG_ALTIVEC -#define EH_FRAME_VMX \ - vsave_msr0 ( 0); \ - vsave_msr1 ( 1); \ - vsave_msr1 ( 2); \ - vsave_msr1 ( 3); \ - vsave_msr1 ( 4); \ - vsave_msr1 ( 5); \ - vsave_msr1 ( 6); \ - vsave_msr1 ( 7); \ - vsave_msr1 ( 8); \ - vsave_msr1 ( 9); \ - vsave_msr1 (10); \ - vsave_msr1 (11); \ - vsave_msr1 (12); \ - vsave_msr1 (13); \ - vsave_msr1 (14); \ - vsave_msr1 (15); \ - vsave_msr1 (16); \ - vsave_msr1 (17); \ - vsave_msr1 (18); \ - vsave_msr1 (19); \ - vsave_msr1 (20); \ - vsave_msr1 (21); \ - vsave_msr1 (22); \ - vsave_msr1 (23); \ - vsave_msr1 (24); \ - vsave_msr1 (25); \ - vsave_msr1 (26); \ - vsave_msr1 (27); \ - vsave_msr1 (28); \ - vsave_msr1 (29); \ - vsave_msr1 (30); \ - vsave_msr1 (31); \ - vsave_msr2 (33, 32*16+12); \ - vsave (32, 32*16) -#else -#define EH_FRAME_VMX -#endif - -.Lcie: - .long .Lcie_end - .Lcie_start -.Lcie_start: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zRS" /* NUL-terminated augmentation string */ - .uleb128 4 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 67 /* Return address register column, ap */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel | DW_EH_PE_sdata4. */ - .byte 0x0c,1,0 /* DW_CFA_def_cfa: r1 ofs 0 */ - .balign 4 -.Lcie_end: - - .long .Lfde0_end - .Lfde0_start -.Lfde0_start: - .long .Lfde0_start - .Lcie /* CIE pointer. */ - .long .Lsig_start - . /* PC start, length */ - .long .Lsig_end - .Lsig_start - .uleb128 0 /* Augmentation */ - EH_FRAME_GEN - EH_FRAME_FP - EH_FRAME_VMX - .balign 4 -.Lfde0_end: - -/* We have a different stack layout for rt_sigreturn. */ -#undef PTREGS -#define PTREGS 64+16+128+20+28 - - .long .Lfde1_end - .Lfde1_start -.Lfde1_start: - .long .Lfde1_start - .Lcie /* CIE pointer. */ - .long .Lsigrt_start - . /* PC start, length */ - .long .Lsigrt_end - .Lsigrt_start - .uleb128 0 /* Augmentation */ - EH_FRAME_GEN - EH_FRAME_FP - EH_FRAME_VMX - .balign 4 -.Lfde1_end: diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S deleted file mode 100644 index 58e0099f70f4..000000000000 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ /dev/null @@ -1,140 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * This is the infamous ld script for the 32 bits vdso - * library - */ -#include -#include -#include - -#ifdef __LITTLE_ENDIAN__ -OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle") -#else -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") -#endif -OUTPUT_ARCH(powerpc:common) -ENTRY(_start) - -SECTIONS -{ - PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE); - . = SIZEOF_HEADERS; - - .hash : { *(.hash) } :text - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - - .note : { *(.note.*) } :text :note - - . = ALIGN(16); - .text : { - *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) - } :text - PROVIDE(__etext = .); - PROVIDE(_etext = .); - PROVIDE(etext = .); - - . = ALIGN(8); - VDSO_ftr_fixup_start = .; - __ftr_fixup : { *(__ftr_fixup) } - VDSO_ftr_fixup_end = .; - - . = ALIGN(8); - VDSO_mmu_ftr_fixup_start = .; - __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } - VDSO_mmu_ftr_fixup_end = .; - - . = ALIGN(8); - VDSO_lwsync_fixup_start = .; - __lwsync_fixup : { *(__lwsync_fixup) } - VDSO_lwsync_fixup_end = .; - -#ifdef CONFIG_PPC64 - . = ALIGN(8); - VDSO_fw_ftr_fixup_start = .; - __fw_ftr_fixup : { *(__fw_ftr_fixup) } - VDSO_fw_ftr_fixup_end = .; -#endif - - /* - * Other stuff is appended to the text segment: - */ - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr - .eh_frame : { KEEP (*(.eh_frame)) } :text - .gcc_except_table : { *(.gcc_except_table) } - .fixup : { *(.fixup) } - - .dynamic : { *(.dynamic) } :text :dynamic - .got : { *(.got) } :text - .plt : { *(.plt) } - - _end = .; - __end = .; - PROVIDE(end = .); - - STABS_DEBUG - DWARF_DEBUG - ELF_DETAILS - - /DISCARD/ : { - *(.note.GNU-stack) - *(.data .data.* .gnu.linkonce.d.* .sdata*) - *(.bss .sbss .dynbss .dynsbss) - *(.got1) - } -} - -/* - * Very old versions of ld do not recognize this name token; use the constant. - */ -#define PT_GNU_EH_FRAME 0x6474e550 - -/* - * We must supply the ELF program headers explicitly to get just one - * PT_LOAD segment, and set the flags explicitly to make segments read-only. - */ -PHDRS -{ - text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ - dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ - note PT_NOTE FLAGS(4); /* PF_R */ - eh_frame_hdr PT_GNU_EH_FRAME; -} - -/* - * This controls what symbols we export from the DSO. - */ -VERSION -{ - VDSO_VERSION_STRING { - global: - __kernel_get_syscall_map; - __kernel_gettimeofday; - __kernel_clock_gettime; - __kernel_clock_gettime64; - __kernel_clock_getres; - __kernel_time; - __kernel_get_tbfreq; - __kernel_sync_dicache; - __kernel_sigtramp32; - __kernel_sigtramp_rt32; -#if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) - __kernel_getcpu; -#endif - - local: *; - }; -} - -/* - * Make the sigreturn code visible to the kernel. - */ -VDSO_sigtramp32 = __kernel_sigtramp32; -VDSO_sigtramp_rt32 = __kernel_sigtramp_rt32; diff --git a/arch/powerpc/kernel/vdso32/vgettimeofday.c b/arch/powerpc/kernel/vdso32/vgettimeofday.c deleted file mode 100644 index 55a287c9a736..000000000000 --- a/arch/powerpc/kernel/vdso32/vgettimeofday.c +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Powerpc userspace implementations of gettimeofday() and similar. - */ -#include -#include - -#ifdef __powerpc64__ -int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts, - const struct vdso_data *vd) -{ - return __cvdso_clock_gettime_data(vd, clock, ts); -} - -int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res, - const struct vdso_data *vd) -{ - return __cvdso_clock_getres_data(vd, clock_id, res); -} -#else -int __c_kernel_clock_gettime(clockid_t clock, struct old_timespec32 *ts, - const struct vdso_data *vd) -{ - return __cvdso_clock_gettime32_data(vd, clock, ts); -} - -int __c_kernel_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts, - const struct vdso_data *vd) -{ - return __cvdso_clock_gettime_data(vd, clock, ts); -} - -int __c_kernel_clock_getres(clockid_t clock_id, struct old_timespec32 *res, - const struct vdso_data *vd) -{ - return __cvdso_clock_getres_time32_data(vd, clock_id, res); -} -#endif - -int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz, - const struct vdso_data *vd) -{ - return __cvdso_gettimeofday_data(vd, tv, tz); -} - -__kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso_data *vd) -{ - return __cvdso_time_data(vd, time); -} diff --git a/arch/powerpc/kernel/vdso32_wrapper.S b/arch/powerpc/kernel/vdso32_wrapper.S index 3f5ef035b0a9..10f92f265d51 100644 --- a/arch/powerpc/kernel/vdso32_wrapper.S +++ b/arch/powerpc/kernel/vdso32_wrapper.S @@ -7,7 +7,7 @@ .globl vdso32_start, vdso32_end .balign PAGE_SIZE vdso32_start: - .incbin "arch/powerpc/kernel/vdso32/vdso32.so.dbg" + .incbin "arch/powerpc/kernel/vdso/vdso32.so.dbg" .balign PAGE_SIZE vdso32_end: diff --git a/arch/powerpc/kernel/vdso64/.gitignore b/arch/powerpc/kernel/vdso64/.gitignore deleted file mode 100644 index 84151a7ba31d..000000000000 --- a/arch/powerpc/kernel/vdso64/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -vdso64.lds -vdso64.so.dbg diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile deleted file mode 100644 index 3c5baaa6f1e7..000000000000 --- a/arch/powerpc/kernel/vdso64/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# List of files in the vdso, has to be asm only for now - -ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24 -include $(srctree)/lib/vdso/Makefile - -obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o - -ifneq ($(c-gettimeofday-y),) - CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -endif - -# Build rules - -targets := $(obj-vdso64) vdso64.so.dbg vgettimeofday.o -obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) - -GCOV_PROFILE := n -KCOV_INSTRUMENT := n -UBSAN_SANITIZE := n -KASAN_SANITIZE := n - -ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ - -Wl,-soname=linux-vdso64.so.1 -Wl,--hash-style=both - -# Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true -# by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is -# compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code -# generation is minimal, it will just use r29 instead. -ccflags-y += $(call cc-option, -ffixed-r30) - -asflags-y := -D__VDSO64__ -s - -targets += vdso64.lds -CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) - -# link rule for the .so file, .lds has to be first -$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE - $(call if_changed,vdso64ld_and_check) - -# Generate VDSO offsets using helper script -gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh -quiet_cmd_vdsosym = VDSOSYM $@ - cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ - -include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE - $(call if_changed,vdsosym) - -# actual build commands -quiet_cmd_vdso64ld_and_check = VDSO64L $@ - cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check) diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S deleted file mode 100644 index 76c3c8cf8ece..000000000000 --- a/arch/powerpc/kernel/vdso64/cacheflush.S +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * vDSO provided cache flush routines - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), - * IBM Corp. - */ -#include -#include -#include -#include -#include - - .text - -/* - * Default "generic" version of __kernel_sync_dicache. - * - * void __kernel_sync_dicache(unsigned long start, unsigned long end) - * - * Flushes the data cache & invalidate the instruction cache for the - * provided range [start, end[ - */ -V_FUNCTION_BEGIN(__kernel_sync_dicache) - .cfi_startproc -BEGIN_FTR_SECTION - b 3f -END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) - mflr r12 - .cfi_register lr,r12 - get_datapage r10 - mtlr r12 - .cfi_restore lr - - lwz r7,CFG_DCACHE_BLOCKSZ(r10) - addi r5,r7,-1 - andc r6,r3,r5 /* round low to line bdy */ - subf r8,r6,r4 /* compute length */ - add r8,r8,r5 /* ensure we get enough */ - lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) - srd. r8,r8,r9 /* compute line count */ - crclr cr0*4+so - beqlr /* nothing to do? */ - mtctr r8 -1: dcbst 0,r6 - add r6,r6,r7 - bdnz 1b - sync - -/* Now invalidate the instruction cache */ - - lwz r7,CFG_ICACHE_BLOCKSZ(r10) - addi r5,r7,-1 - andc r6,r3,r5 /* round low to line bdy */ - subf r8,r6,r4 /* compute length */ - add r8,r8,r5 - lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) - srd. r8,r8,r9 /* compute line count */ - crclr cr0*4+so - beqlr /* nothing to do? */ - mtctr r8 -2: icbi 0,r6 - add r6,r6,r7 - bdnz 2b - isync - li r3,0 - blr -3: - crclr cr0*4+so - sync - isync - li r3,0 - blr - .cfi_endproc -V_FUNCTION_END(__kernel_sync_dicache) diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S deleted file mode 100644 index 00760dc69d68..000000000000 --- a/arch/powerpc/kernel/vdso64/datapage.S +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Access to the shared data page by the vDSO & syscall map - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. - */ - -#include -#include -#include -#include -#include -#include - - .text - -/* - * void *__kernel_get_syscall_map(unsigned int *syscall_count) ; - * - * returns a pointer to the syscall map. the map is agnostic to the - * size of "long", unlike kernel bitops, it stores bits from top to - * bottom so that memory actually contains a linear bitmap - * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of - * 32 bits int at N >> 5. - */ -V_FUNCTION_BEGIN(__kernel_get_syscall_map) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - mr r4,r3 - get_datapage r3 - mtlr r12 - addi r3,r3,CFG_SYSCALL_MAP64 - cmpldi cr0,r4,0 - crclr cr0*4+so - beqlr - li r0,NR_syscalls - stw r0,0(r4) - blr - .cfi_endproc -V_FUNCTION_END(__kernel_get_syscall_map) - - -/* - * void unsigned long __kernel_get_tbfreq(void); - * - * returns the timebase frequency in HZ - */ -V_FUNCTION_BEGIN(__kernel_get_tbfreq) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - get_datapage r3 - ld r3,CFG_TB_TICKS_PER_SEC(r3) - mtlr r12 - crclr cr0*4+so - blr - .cfi_endproc -V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh b/arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh deleted file mode 100755 index 4bf15ffd5933..000000000000 --- a/arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -# -# Match symbols in the DSO that look like VDSO_*; produce a header file -# of constant offsets into the shared object. -# -# Doing this inside the Makefile will break the $(filter-out) function, -# causing Kbuild to rebuild the vdso-offsets header file every time. -# -# Author: Will Deacon - */ -#include -#include - - .text -/* - * Exact prototype of getcpu - * - * int __kernel_getcpu(unsigned *cpu, unsigned *node); - * - */ -V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - mfspr r5,SPRN_SPRG_VDSO_READ - cmpdi cr0,r3,0 - cmpdi cr1,r4,0 - clrlwi r6,r5,16 - rlwinm r7,r5,16,31-15,31-0 - beq cr0,1f - stw r6,0(r3) -1: beq cr1,2f - stw r7,0(r4) -2: crclr cr0*4+so - li r3,0 /* always success */ - blr - .cfi_endproc -V_FUNCTION_END(__kernel_getcpu) diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S deleted file mode 100644 index d7a7bfb51081..000000000000 --- a/arch/powerpc/kernel/vdso64/gettimeofday.S +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Userland implementation of gettimeofday() for 64 bits processes in a - * ppc64 kernel for use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), - * IBM Corp. - */ -#include -#include -#include -#include -#include -#include -#include - - .text -/* - * Exact prototype of gettimeofday - * - * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); - * - */ -V_FUNCTION_BEGIN(__kernel_gettimeofday) - cvdso_call __c_kernel_gettimeofday -V_FUNCTION_END(__kernel_gettimeofday) - - -/* - * Exact prototype of clock_gettime() - * - * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_gettime) - cvdso_call __c_kernel_clock_gettime -V_FUNCTION_END(__kernel_clock_gettime) - - -/* - * Exact prototype of clock_getres() - * - * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_getres) - cvdso_call __c_kernel_clock_getres -V_FUNCTION_END(__kernel_clock_getres) - -/* - * Exact prototype of time() - * - * time_t time(time *t); - * - */ -V_FUNCTION_BEGIN(__kernel_time) - cvdso_call_time __c_kernel_time -V_FUNCTION_END(__kernel_time) diff --git a/arch/powerpc/kernel/vdso64/note.S b/arch/powerpc/kernel/vdso64/note.S deleted file mode 100644 index dc2a509f7e8a..000000000000 --- a/arch/powerpc/kernel/vdso64/note.S +++ /dev/null @@ -1 +0,0 @@ -#include "../vdso32/note.S" diff --git a/arch/powerpc/kernel/vdso64/sigtramp.S b/arch/powerpc/kernel/vdso64/sigtramp.S deleted file mode 100644 index 2d4067561293..000000000000 --- a/arch/powerpc/kernel/vdso64/sigtramp.S +++ /dev/null @@ -1,313 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Signal trampoline for 64 bits processes in a ppc64 kernel for - * use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. - * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp. - */ -#include /* IFETCH_ALIGN_BYTES */ -#include -#include -#include -#include -#include /* XXX for __SIGNAL_FRAMESIZE */ - - .text - -/* - * __kernel_start_sigtramp_rt64 and __kernel_sigtramp_rt64 together - * are one function split in two parts. The kernel jumps to the former - * and the signal handler indirectly (by blr) returns to the latter. - * __kernel_sigtramp_rt64 needs to point to the return address so - * glibc can correctly identify the trampoline stack frame. - */ - .balign 8 - .balign IFETCH_ALIGN_BYTES -V_FUNCTION_BEGIN(__kernel_start_sigtramp_rt64) -.Lsigrt_start: - bctrl /* call the handler */ -V_FUNCTION_END(__kernel_start_sigtramp_rt64) -V_FUNCTION_BEGIN(__kernel_sigtramp_rt64) - addi r1, r1, __SIGNAL_FRAMESIZE - li r0,__NR_rt_sigreturn - sc -.Lsigrt_end: -V_FUNCTION_END(__kernel_sigtramp_rt64) -/* The .balign 8 above and the following zeros mimic the old stack - trampoline layout. The last magic value is the ucontext pointer, - chosen in such a way that older libgcc unwind code returns a zero - for a sigcontext pointer. */ - .long 0,0,0 - .quad 0,-21*8 - -/* Register r1 can be found at offset 8 of a pt_regs structure. - A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ -#define cfa_save \ - .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x23; .uleb128 RSIZE; /* DW_OP_plus_uconst */ \ - .byte 0x06; /* DW_OP_deref */ \ -9: - -/* Register REGNO can be found at offset OFS of a pt_regs structure. - A pointer to the pt_regs is stored in memory at the old sp plus PTREGS. */ -#define rsave(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .ifne ofs; \ - .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ - .endif; \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 - of the VMX reg struct. A pointer to the VMX reg struct is at VREGS in - the pt_regs struct. This macro is for REGNO == 0, and contains - 'subroutines' that the other macros jump to. */ -#define vsave_msr0(regno) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x30 + regno; /* DW_OP_lit0 */ \ -2: \ - .byte 0x40; /* DW_OP_lit16 */ \ - .byte 0x1e; /* DW_OP_mul */ \ -3: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x12; /* DW_OP_dup */ \ - .byte 0x23; /* DW_OP_plus_uconst */ \ - .uleb128 33*RSIZE; /* msr offset */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x0c; .long 1 << 25; /* DW_OP_const4u */ \ - .byte 0x1a; /* DW_OP_and */ \ - .byte 0x12; /* DW_OP_dup, ret 0 if bra taken */ \ - .byte 0x30; /* DW_OP_lit0 */ \ - .byte 0x29; /* DW_OP_eq */ \ - .byte 0x28; .short 0x7fff; /* DW_OP_bra to end */ \ - .byte 0x13; /* DW_OP_drop, pop the 0 */ \ - .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x22; /* DW_OP_plus */ \ - .byte 0x2f; .short 0x7fff; /* DW_OP_skip to end */ \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16 - of the VMX reg struct. REGNO is 1 thru 31. */ -#define vsave_msr1(regno) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x30 + regno; /* DW_OP_lit n */ \ - .byte 0x2f; .short 2b - 9f; /* DW_OP_skip */ \ -9: - -/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of - the VMX save block. */ -#define vsave_msr2(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x0a; .short ofs; /* DW_OP_const2u */ \ - .byte 0x2f; .short 3b - 9f; /* DW_OP_skip */ \ -9: - -/* VMX register REGNO is at offset OFS of the VMX save area. */ -#define vsave(regno, ofs) \ - .byte 0x10; /* DW_CFA_expression */ \ - .uleb128 regno + 77; /* regno */ \ - .uleb128 9f - 1f; /* length */ \ -1: \ - .byte 0x71; .sleb128 PTREGS; /* DW_OP_breg1 */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x23; .uleb128 VREGS; /* DW_OP_plus_uconst */ \ - .byte 0x06; /* DW_OP_deref */ \ - .byte 0x23; .uleb128 ofs; /* DW_OP_plus_uconst */ \ -9: - -/* This is where the pt_regs pointer can be found on the stack. */ -#define PTREGS 128+168+56 - -/* Size of regs. */ -#define RSIZE 8 - -/* Size of CR reg in DWARF unwind info. */ -#define CRSIZE 4 - -/* Offset of CR reg within a full word. */ -#ifdef __LITTLE_ENDIAN__ -#define CROFF 0 -#else -#define CROFF (RSIZE - CRSIZE) -#endif - -/* This is the offset of the VMX reg pointer. */ -#define VREGS 48*RSIZE+33*8 - -/* Describe where general purpose regs are saved. */ -#define EH_FRAME_GEN \ - cfa_save; \ - rsave ( 0, 0*RSIZE); \ - rsave ( 2, 2*RSIZE); \ - rsave ( 3, 3*RSIZE); \ - rsave ( 4, 4*RSIZE); \ - rsave ( 5, 5*RSIZE); \ - rsave ( 6, 6*RSIZE); \ - rsave ( 7, 7*RSIZE); \ - rsave ( 8, 8*RSIZE); \ - rsave ( 9, 9*RSIZE); \ - rsave (10, 10*RSIZE); \ - rsave (11, 11*RSIZE); \ - rsave (12, 12*RSIZE); \ - rsave (13, 13*RSIZE); \ - rsave (14, 14*RSIZE); \ - rsave (15, 15*RSIZE); \ - rsave (16, 16*RSIZE); \ - rsave (17, 17*RSIZE); \ - rsave (18, 18*RSIZE); \ - rsave (19, 19*RSIZE); \ - rsave (20, 20*RSIZE); \ - rsave (21, 21*RSIZE); \ - rsave (22, 22*RSIZE); \ - rsave (23, 23*RSIZE); \ - rsave (24, 24*RSIZE); \ - rsave (25, 25*RSIZE); \ - rsave (26, 26*RSIZE); \ - rsave (27, 27*RSIZE); \ - rsave (28, 28*RSIZE); \ - rsave (29, 29*RSIZE); \ - rsave (30, 30*RSIZE); \ - rsave (31, 31*RSIZE); \ - rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ - rsave (65, 36*RSIZE); /* lr */ \ - rsave (68, 38*RSIZE + CROFF); /* cr fields */ \ - rsave (69, 38*RSIZE + CROFF); \ - rsave (70, 38*RSIZE + CROFF); \ - rsave (71, 38*RSIZE + CROFF); \ - rsave (72, 38*RSIZE + CROFF); \ - rsave (73, 38*RSIZE + CROFF); \ - rsave (74, 38*RSIZE + CROFF); \ - rsave (75, 38*RSIZE + CROFF) - -/* Describe where the FP regs are saved. */ -#define EH_FRAME_FP \ - rsave (32, 48*RSIZE + 0*8); \ - rsave (33, 48*RSIZE + 1*8); \ - rsave (34, 48*RSIZE + 2*8); \ - rsave (35, 48*RSIZE + 3*8); \ - rsave (36, 48*RSIZE + 4*8); \ - rsave (37, 48*RSIZE + 5*8); \ - rsave (38, 48*RSIZE + 6*8); \ - rsave (39, 48*RSIZE + 7*8); \ - rsave (40, 48*RSIZE + 8*8); \ - rsave (41, 48*RSIZE + 9*8); \ - rsave (42, 48*RSIZE + 10*8); \ - rsave (43, 48*RSIZE + 11*8); \ - rsave (44, 48*RSIZE + 12*8); \ - rsave (45, 48*RSIZE + 13*8); \ - rsave (46, 48*RSIZE + 14*8); \ - rsave (47, 48*RSIZE + 15*8); \ - rsave (48, 48*RSIZE + 16*8); \ - rsave (49, 48*RSIZE + 17*8); \ - rsave (50, 48*RSIZE + 18*8); \ - rsave (51, 48*RSIZE + 19*8); \ - rsave (52, 48*RSIZE + 20*8); \ - rsave (53, 48*RSIZE + 21*8); \ - rsave (54, 48*RSIZE + 22*8); \ - rsave (55, 48*RSIZE + 23*8); \ - rsave (56, 48*RSIZE + 24*8); \ - rsave (57, 48*RSIZE + 25*8); \ - rsave (58, 48*RSIZE + 26*8); \ - rsave (59, 48*RSIZE + 27*8); \ - rsave (60, 48*RSIZE + 28*8); \ - rsave (61, 48*RSIZE + 29*8); \ - rsave (62, 48*RSIZE + 30*8); \ - rsave (63, 48*RSIZE + 31*8) - -/* Describe where the VMX regs are saved. */ -#ifdef CONFIG_ALTIVEC -#define EH_FRAME_VMX \ - vsave_msr0 ( 0); \ - vsave_msr1 ( 1); \ - vsave_msr1 ( 2); \ - vsave_msr1 ( 3); \ - vsave_msr1 ( 4); \ - vsave_msr1 ( 5); \ - vsave_msr1 ( 6); \ - vsave_msr1 ( 7); \ - vsave_msr1 ( 8); \ - vsave_msr1 ( 9); \ - vsave_msr1 (10); \ - vsave_msr1 (11); \ - vsave_msr1 (12); \ - vsave_msr1 (13); \ - vsave_msr1 (14); \ - vsave_msr1 (15); \ - vsave_msr1 (16); \ - vsave_msr1 (17); \ - vsave_msr1 (18); \ - vsave_msr1 (19); \ - vsave_msr1 (20); \ - vsave_msr1 (21); \ - vsave_msr1 (22); \ - vsave_msr1 (23); \ - vsave_msr1 (24); \ - vsave_msr1 (25); \ - vsave_msr1 (26); \ - vsave_msr1 (27); \ - vsave_msr1 (28); \ - vsave_msr1 (29); \ - vsave_msr1 (30); \ - vsave_msr1 (31); \ - vsave_msr2 (33, 32*16+12); \ - vsave (32, 33*16) -#else -#define EH_FRAME_VMX -#endif - - .section .eh_frame,"a",@progbits -.Lcie: - .long .Lcie_end - .Lcie_start -.Lcie_start: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zRS" /* NUL-terminated augmentation string */ - .uleb128 4 /* Code alignment factor */ - .sleb128 -8 /* Data alignment factor */ - .byte 67 /* Return address register column, ap */ - .uleb128 1 /* Augmentation value length */ - .byte 0x14 /* DW_EH_PE_pcrel | DW_EH_PE_udata8. */ - .byte 0x0c,1,0 /* DW_CFA_def_cfa: r1 ofs 0 */ - .balign 8 -.Lcie_end: - - .long .Lfde0_end - .Lfde0_start -.Lfde0_start: - .long .Lfde0_start - .Lcie /* CIE pointer. */ - .quad .Lsigrt_start - . /* PC start, length */ - .quad .Lsigrt_end - .Lsigrt_start - .uleb128 0 /* Augmentation */ - EH_FRAME_GEN - EH_FRAME_FP - EH_FRAME_VMX -# Do we really need to describe the frame at this point? ie. will -# we ever have some call chain that returns somewhere past the addi? -# I don't think so, since gcc doesn't support async signals. -# .byte 0x41 /* DW_CFA_advance_loc 1*4 */ -#undef PTREGS -#define PTREGS 168+56 -# EH_FRAME_GEN -# EH_FRAME_FP -# EH_FRAME_VMX - .balign 8 -.Lfde0_end: diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S deleted file mode 100644 index 0288cad428b0..000000000000 --- a/arch/powerpc/kernel/vdso64/vdso64.lds.S +++ /dev/null @@ -1,134 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * This is the infamous ld script for the 64 bits vdso - * library - */ -#include -#include -#include - -#ifdef __LITTLE_ENDIAN__ -OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle") -#else -OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc") -#endif -OUTPUT_ARCH(powerpc:common64) -ENTRY(_start) - -SECTIONS -{ - PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE); - . = SIZEOF_HEADERS; - - .hash : { *(.hash) } :text - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - - .note : { *(.note.*) } :text :note - - . = ALIGN(16); - .text : { - *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) - *(.sfpr .glink) - } :text - PROVIDE(__etext = .); - PROVIDE(_etext = .); - PROVIDE(etext = .); - - . = ALIGN(8); - VDSO_ftr_fixup_start = .; - __ftr_fixup : { *(__ftr_fixup) } - VDSO_ftr_fixup_end = .; - - . = ALIGN(8); - VDSO_mmu_ftr_fixup_start = .; - __mmu_ftr_fixup : { *(__mmu_ftr_fixup) } - VDSO_mmu_ftr_fixup_end = .; - - . = ALIGN(8); - VDSO_lwsync_fixup_start = .; - __lwsync_fixup : { *(__lwsync_fixup) } - VDSO_lwsync_fixup_end = .; - - . = ALIGN(8); - VDSO_fw_ftr_fixup_start = .; - __fw_ftr_fixup : { *(__fw_ftr_fixup) } - VDSO_fw_ftr_fixup_end = .; - - /* - * Other stuff is appended to the text segment: - */ - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - - .dynamic : { *(.dynamic) } :text :dynamic - - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr - .eh_frame : { KEEP (*(.eh_frame)) } :text - .gcc_except_table : { *(.gcc_except_table) } - .rela.dyn ALIGN(8) : { *(.rela.dyn) } - - .got ALIGN(8) : { *(.got .toc) } - - _end = .; - PROVIDE(end = .); - - STABS_DEBUG - DWARF_DEBUG - ELF_DETAILS - - /DISCARD/ : { - *(.note.GNU-stack) - *(.branch_lt) - *(.data .data.* .gnu.linkonce.d.* .sdata*) - *(.bss .sbss .dynbss .dynsbss) - *(.opd) - } -} - -/* - * Very old versions of ld do not recognize this name token; use the constant. - */ -#define PT_GNU_EH_FRAME 0x6474e550 - -/* - * We must supply the ELF program headers explicitly to get just one - * PT_LOAD segment, and set the flags explicitly to make segments read-only. - */ -PHDRS -{ - text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ - dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ - note PT_NOTE FLAGS(4); /* PF_R */ - eh_frame_hdr PT_GNU_EH_FRAME; -} - -/* - * This controls what symbols we export from the DSO. - */ -VERSION -{ - VDSO_VERSION_STRING { - global: - __kernel_get_syscall_map; - __kernel_gettimeofday; - __kernel_clock_gettime; - __kernel_clock_getres; - __kernel_get_tbfreq; - __kernel_sync_dicache; - __kernel_sigtramp_rt64; - __kernel_getcpu; - __kernel_time; - - local: *; - }; -} - -/* - * Make the sigreturn code visible to the kernel. - */ -VDSO_sigtramp_rt64 = __kernel_start_sigtramp_rt64; diff --git a/arch/powerpc/kernel/vdso64/vgettimeofday.c b/arch/powerpc/kernel/vdso64/vgettimeofday.c deleted file mode 100644 index 5b5500058344..000000000000 --- a/arch/powerpc/kernel/vdso64/vgettimeofday.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Powerpc userspace implementations of gettimeofday() and similar. - */ -#include -#include - -int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts, - const struct vdso_data *vd) -{ - return __cvdso_clock_gettime_data(vd, clock, ts); -} - -int __c_kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz, - const struct vdso_data *vd) -{ - return __cvdso_gettimeofday_data(vd, tv, tz); -} - -int __c_kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res, - const struct vdso_data *vd) -{ - return __cvdso_clock_getres_data(vd, clock_id, res); -} - -__kernel_old_time_t __c_kernel_time(__kernel_old_time_t *time, const struct vdso_data *vd) -{ - return __cvdso_time_data(vd, time); -} diff --git a/arch/powerpc/kernel/vdso64_wrapper.S b/arch/powerpc/kernel/vdso64_wrapper.S index 1d56d81fe3b3..839d1a61411d 100644 --- a/arch/powerpc/kernel/vdso64_wrapper.S +++ b/arch/powerpc/kernel/vdso64_wrapper.S @@ -7,7 +7,7 @@ .globl vdso64_start, vdso64_end .balign PAGE_SIZE vdso64_start: - .incbin "arch/powerpc/kernel/vdso64/vdso64.so.dbg" + .incbin "arch/powerpc/kernel/vdso/vdso64.so.dbg" .balign PAGE_SIZE vdso64_end: -- cgit