lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200608280000.50961.arnd@arndb.de>
Date:	Mon, 28 Aug 2006 00:00:49 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	linux-kernel@...r.kernel.org
Cc:	linux-arch@...r.kernel.org, Jeff Dike <jdike@...toit.com>,
	Bjoern Steinbrink <B.Steinbrink@....de>,
	Arjan van de Ven <arjan@...radead.org>,
	Chase Venters <chase.venters@...entec.com>,
	Andrew Morton <akpm@...l.org>,
	Russell King <rmk+lkml@....linux.org.uk>,
	rusty@...tcorp.com.au, linuxsh-shmedia-dev@...ts.sourceforge.net,
	lethal@...ux-sh.org, rc@....org.uk
Subject: [PATCH 5/7] sh64: remove the use of kernel syscalls

sh64 is using system call macros to call some functions
from the kernel. Remove those so we can get rid of
kernel syscalls.

This is probably not the best implementation and may
need to be redone.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
Index: linux-cg/arch/sh64/kernel/process.c
===================================================================
--- linux-cg.orig/arch/sh64/kernel/process.c	2006-08-27 23:36:34.000000000 +0200
+++ linux-cg/arch/sh64/kernel/process.c	2006-08-27 23:40:13.000000000 +0200
@@ -32,7 +32,6 @@
 #undef IDLE_TRACE
 /* Temporary flags/tests. All to be removed/undefined. END */
 
-#define __KERNEL_SYSCALLS__
 #include <stdarg.h>
 
 #include <linux/kernel.h>
@@ -230,13 +229,10 @@
 void idle_trace(void)
 {
 
-	_syscall0(int, getpid)
-	_syscall1(int, getpgid, int, pid)
-
 	if (!once) {
         	/* VM allocation/deallocation simple test */
 		test_VM();
-		pid = getpid();
+		pid = sys_getpid();
 
         	printk("Got all through to Idle !!\n");
         	printk("I'm now going to loop forever ...\n");
@@ -268,7 +264,7 @@
 		}
 		old_jiffies = jiffies;
 	}
-	pgid = getpgid(pid);
+	pgid = sys_getpgid(pid);
 	printk(".");
 }
 #else
@@ -628,18 +624,23 @@
  * a system call from a "real" process, but the process memory space will
  * not be free'd until both the parent and the child have exited.
  */
+#error please implement a working kernel_thread function like the other architectures
+/* _syscallN() does not work any more. this probably needs to call
+ * do_fork directly */
 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 {
-	/* A bit less processor dependent than older sh ... */
-	unsigned int reply;
-
-static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp)
-static __inline__ _syscall1(int,exit,int,ret)
+	register unsigned long reply asm ("r9") = ((0x13 << 16) | __NR_clone);
+	register unsigned long __flags asm ("r2") = flags | CLONE_VM;
+	register unsigned long __newsp asm ("r3") = 0;
+
+	__asm__ __volatile__ ("trapa	%1 !\t\t\t clone(%2,%3)"
+	: "=r" (__sc0) : "r" (__sc0), "r" (__sc2), "r" (__sc3));
+	__asm__ __volatile__ ("!dummy	%0 %1"
+	: : "r" (__sc0), "r" (__sc2), "r" (__sc3) : "memory");
 
-	reply = clone(flags | CLONE_VM, 0);
 	if (!reply) {
 		/* Child */
-		reply = exit(fn(arg));
+		reply = sys_exit(fn(arg));
 	}
 
 	return reply;

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ