[Cbe-oss-dev] [PATCH] powerpc: cell: Add sys_tee to spu_syscall_table

Arnd Bergmann arnd.bergmann at de.ibm.com
Tue Apr 18 23:24:16 EST 2006


On Tuesday 18 April 2006 15:01, Christoph Hellwig wrote:
> 
> On Tue, Apr 18, 2006 at 02:39:13PM +0200, Jeremy Kerr wrote:
> > Looks like there's been a recent syscall (sys_tee) added to unistd.h in
> > Linus' current git tree, causing a BUILD_BUG_ON at spu_callbacks.c:327.
> > This patch adds the syscall to the spu_syscall_table.
> > 
> > Built & booted on cell.
> 
> Arnd, what's the reason for these BUILD_BUG_ONs, there's a bit annnoying
> to say at least :)  Is there any problem if a new calls is added an
> spu programs can't call it yet?

Not really. I think the idea was originally to avoid overflowing the
table since we are checking against __NR_syscalls there.
However, the current code has the check in the same file, so we can
simply compare against ARRAY_SIZE(spu_syscall_table).

How about this one?

	Arnd <><

--- linus-2.6.orig/arch/powerpc/platforms/cell/spu_callbacks.c
+++ linus-2.6/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -317,17 +317,16 @@ void *spu_syscall_table[] = {
 	[__NR_ppoll]			sys_ni_syscall, /* sys_ppoll */
 	[__NR_unshare]			sys_unshare,
 	[__NR_splice]			sys_splice,
+	[__NR_tee]			sys_tee,
 };
 
 long spu_sys_callback(struct spu_syscall_block *s)
 {
 	long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
 
-	BUILD_BUG_ON(ARRAY_SIZE(spu_syscall_table) != __NR_syscalls);
-
 	syscall = spu_syscall_table[s->nr_ret];
 
-	if (s->nr_ret >= __NR_syscalls) {
+	if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
 		pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret);
 		return -ENOSYS;
 	}
Index: linus-2.6/arch/powerpc/kernel/systbl.S
===================================================================
--- linus-2.6.orig/arch/powerpc/kernel/systbl.S
+++ linus-2.6/arch/powerpc/kernel/systbl.S
@@ -324,3 +324,8 @@ COMPAT_SYS(ppoll)
 SYSCALL(unshare)
 SYSCALL(splice)
 SYSCALL(tee)
+
+/*
+ * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
+ * as well when appropriate.
+ */



More information about the cbe-oss-dev mailing list