Commit baf9ff74 authored by Ralf Baechle's avatar Ralf Baechle Committed by Al Viro
Browse files

MIPS: Switch over to generic sys_execve and kernel_execve.



This version contains a few updates by David Daney, in particular it's
now using __builtin_frame_address() instead of asm() which depending
on personal taste, is slightly more appealing.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 8f54bcac
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -61,4 +61,10 @@ static inline void die_if_kernel(const char *str, struct pt_regs *regs)
		die(str, regs);
}

#define current_pt_regs()						\
({									\
	unsigned long sp = (unsigned long)__builtin_frame_address(0);	\
	(struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1;	\
})

#endif /* _ASM_PTRACE_H */
+2 −0
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@
#ifndef __ASSEMBLY__

#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
#define __ARCH_WANT_KERNEL_EXECVE
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_SYS_ALARM
#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_GETHOSTNAME
#define __ARCH_WANT_SYS_IPC
#define __ARCH_WANT_SYS_PAUSE
+9 −0
Original line number Diff line number Diff line
@@ -192,6 +192,15 @@ syscall_exit_work:
	jal	syscall_trace_leave
	b	resume_userspace

LEAF(ret_from_kernel_execve)
	move	sp, a0
	ori	$28,  sp, _THREAD_SIZE - 1
	xori	$28, $28, _THREAD_SIZE - 1
	li	v0, 0
	li	a3, 0
	j	syscall_exit_partial
	END(ret_from_kernel_execve)

#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT)

/*
+0 −21
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
 *
 * Copyright (C) 2000 Silicon Graphics, Inc.
 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
 * sys32_execve from ia64/ia32 code, Feb 2000, Kanoj Sarcar (kanoj@sgi.com)
 */
#include <linux/compiler.h>
#include <linux/mm.h>
@@ -77,26 +76,6 @@ out:
	return error;
}

/*
 * sys_execve() executes a new program.
 */
asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs)
{
	int error;
	struct filename *filename;

	filename = getname(compat_ptr(regs.regs[4]));
	error = PTR_ERR(filename);
	if (IS_ERR(filename))
		goto out;
	error = compat_do_execve(filename->name, compat_ptr(regs.regs[5]),
				 compat_ptr(regs.regs[6]), &regs);
	putname(filename);

out:
	return error;
}

#define RLIM_INFINITY32	0x7fffffff
#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)

+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ EXPORT(sysn32_call_table)
	PTR	sys_getsockopt
	PTR	sys_clone			/* 6055 */
	PTR	sys_fork
	PTR	sys32_execve
	PTR	compat_sys_execve
	PTR	sys_exit
	PTR	compat_sys_wait4
	PTR	sys_kill			/* 6060 */
Loading