Commit 87f3248c authored by Guo Ren's avatar Guo Ren
Browse files

csky: Reconstruct VDSO framework



Reconstruct vdso framework to support future vsyscall,
vgettimeofday features. These are very important features to reduce
system calls into the kernel for performance improvement.

The patch is reference RISC-V's

Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
Cc: Palmer Dabbelt <palmerdabbelt@google.com>
parent e26db7ad
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */

#include <linux/uaccess.h>
#ifndef __ABI_CSKY_VDSO_H
#define __ABI_CSKY_VDSO_H

static inline int setup_vdso_page(unsigned short *ptr)
{
	int err = 0;
/* movi r1, 127; addi r1, (139 - 127) */
#define SET_SYSCALL_ID	.long 0x20b167f1

	/* movi r1, 127 */
	err |= __put_user(0x67f1, ptr + 0);
	/* addi r1, (139 - 127) */
	err |= __put_user(0x20b1, ptr + 1);
	/* trap 0 */
	err |= __put_user(0x0008, ptr + 2);

	return err;
}
#endif /* __ABI_CSKY_VDSO_H */
+3 −17
Original line number Diff line number Diff line
@@ -3,21 +3,7 @@
#ifndef __ABI_CSKY_VDSO_H
#define __ABI_CSKY_VDSO_H

#include <linux/uaccess.h>

static inline int setup_vdso_page(unsigned short *ptr)
{
	int err = 0;

/* movi r7, 173 */
	err |= __put_user(0xea07, ptr);
	err |= __put_user(0x008b,      ptr+1);

	/* trap 0 */
	err |= __put_user(0xc000,   ptr+2);
	err |= __put_user(0x2020,   ptr+3);

	return err;
}
#define SET_SYSCALL_ID	.long 0x008bea07

#endif /* __ABI_CSKY_STRING_H */
#endif /* __ABI_CSKY_VDSO_H */
+16 −3
Original line number Diff line number Diff line
@@ -3,10 +3,23 @@
#ifndef __ASM_CSKY_VDSO_H
#define __ASM_CSKY_VDSO_H

#include <abi/vdso.h>
#include <linux/types.h>

struct csky_vdso {
	unsigned short rt_signal_retcode[4];
struct vdso_data {
};

/*
 * The VDSO symbols are mapped into Linux so we can just use regular symbol
 * addressing to get their offsets in userspace.  The symbols are mapped at an
 * offset of 0, but since the linker must support setting weak undefined
 * symbols to the absolute address 0 it also happens to support other low
 * addresses even when the code model suggests those low addresses would not
 * otherwise be availiable.
 */
#define VDSO_SYMBOL(base, name)							\
({										\
	extern const char __vdso_##name[];					\
	(void __user *)((unsigned long)(base) + __vdso_##name);			\
})

#endif /* __ASM_CSKY_VDSO_H */
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
extra-y := head.o vmlinux.lds

obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o
obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/
obj-y += power.o syscall.o syscall_table.o setup.o
obj-y += process.o cpu-probe.o ptrace.o stacktrace.o
obj-y += probes/
+2 −2
Original line number Diff line number Diff line
@@ -134,7 +134,6 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
{
	struct rt_sigframe *frame;
	int err = 0;
	struct csky_vdso *vdso = current->mm->context.vdso;

	frame = get_sigframe(ksig, regs, sizeof(*frame));
	if (!access_ok(frame, sizeof(*frame)))
@@ -152,7 +151,8 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
		return -EFAULT;

	/* Set up to return from userspace. */
	regs->lr = (unsigned long)(vdso->rt_signal_retcode);
	regs->lr = (unsigned long)VDSO_SYMBOL(
		current->mm->context.vdso, rt_sigreturn);

	/*
	 * Set up registers for signal handler.
Loading