fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / m68knommu / kernel / sys_m68k.c
index d87e1e0..3265b2d 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/traps.h>
 #include <asm/ipc.h>
 #include <asm/cacheflush.h>
+#include <asm/unistd.h>
 
 /*
  * sys_pipe() is the normal C calling standard for creating
@@ -136,7 +137,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
 asmlinkage int sys_ipc (uint call, int first, int second,
                        int third, void *ptr, long fifth)
 {
-       int version;
+       int version, ret;
 
        version = call >> 16; /* hack for backward compatibility */
        call &= 0xffff;
@@ -189,6 +190,27 @@ asmlinkage int sys_ipc (uint call, int first, int second,
                default:
                        return -EINVAL;
                }
+       if (call <= SHMCTL)
+               switch (call) {
+               case SHMAT:
+                       switch (version) {
+                       default: {
+                               ulong raddr;
+                               ret = do_shmat (first, ptr, second, &raddr);
+                               if (ret)
+                                       return ret;
+                               return put_user (raddr, (ulong __user *) third);
+                       }
+                       }
+               case SHMDT:
+                       return sys_shmdt (ptr);
+               case SHMGET:
+                       return sys_shmget (first, second, third);
+               case SHMCTL:
+                       return sys_shmctl (first, second, ptr);
+               default:
+                       return -ENOSYS;
+               }
 
        return -EINVAL;
 }
@@ -206,3 +228,17 @@ asmlinkage int sys_getpagesize(void)
        return PAGE_SIZE;
 }
 
+/*
+ * Do a system call from kernel instead of calling sys_execve so we
+ * end up with proper pt_regs.
+ */
+int kernel_execve(const char *filename, char *const argv[], char *const envp[])
+{
+       register long __res asm ("%d0") = __NR_execve;
+       register long __a asm ("%d1") = (long)(filename);
+       register long __b asm ("%d2") = (long)(argv);
+       register long __c asm ("%d3") = (long)(envp);
+       asm volatile ("trap  #0" : "+d" (__res)
+                       : "d" (__a), "d" (__b), "d" (__c));
+       return __res;
+}