linux-mips
[Top] [All Lists]

Yet another 64-bit conversion patch

To: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Yet another 64-bit conversion patch
From: Carsten Langgaard <carstenl@mips.com>
Date: Fri, 25 Oct 2002 15:10:13 +0200
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Here is a conversion patch for the sysinfo syscall.

/Carsten


--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com


Index: arch/mips64/kernel/linux32.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/linux32.c,v
retrieving revision 1.42.2.18
diff -u -r1.42.2.18 linux32.c
--- arch/mips64/kernel/linux32.c        21 Oct 2002 12:57:58 -0000      
1.42.2.18
+++ arch/mips64/kernel/linux32.c        25 Oct 2002 09:54:17 -0000
@@ -661,6 +661,46 @@
        return sys32_wait4(pid, stat_addr, options, NULL);
 }
 
+struct sysinfo32 {
+        s32 uptime;
+        u32 loads[3];
+        u32 totalram;
+        u32 freeram;
+        u32 sharedram;
+        u32 bufferram;
+        u32 totalswap;
+        u32 freeswap;
+        unsigned short procs;
+        char _f[22];
+};
+
+extern asmlinkage int sys_sysinfo(struct sysinfo *info);
+
+asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+{
+       struct sysinfo s;
+       int ret, err;
+       mm_segment_t old_fs = get_fs ();
+       
+       set_fs (KERNEL_DS);
+       ret = sys_sysinfo(&s);
+       set_fs (old_fs);
+       err = put_user (s.uptime, &info->uptime);
+       err |= __put_user (s.loads[0], &info->loads[0]);
+       err |= __put_user (s.loads[1], &info->loads[1]);
+       err |= __put_user (s.loads[2], &info->loads[2]);
+       err |= __put_user (s.totalram, &info->totalram);
+       err |= __put_user (s.freeram, &info->freeram);
+       err |= __put_user (s.sharedram, &info->sharedram);
+       err |= __put_user (s.bufferram, &info->bufferram);
+       err |= __put_user (s.totalswap, &info->totalswap);
+       err |= __put_user (s.freeswap, &info->freeswap);
+       err |= __put_user (s.procs, &info->procs);
+       if (err)
+               return -EFAULT;
+       return ret;
+}
+
 #define RLIM_INFINITY32        0x7fffffff
 #define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
 
Index: arch/mips64/kernel/scall_o32.S
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/scall_o32.S,v
retrieving revision 1.48.2.17
diff -u -r1.48.2.17 scall_o32.S
--- arch/mips64/kernel/scall_o32.S      3 Oct 2002 09:38:26 -0000       
1.48.2.17
+++ arch/mips64/kernel/scall_o32.S      25 Oct 2002 09:54:17 -0000
@@ -428,7 +428,7 @@
        sys     sys_ni_syscall  0       /* sys_vm86 */
        sys     sys32_wait4     4
        sys     sys_swapoff     1                       /* 4115 */
-       sys     sys_sysinfo     1
+       sys     sys32_sysinfo   1
        sys     sys32_ipc               6
        sys     sys_fsync       1
        sys     sys32_sigreturn 0
<Prev in Thread] Current Thread [Next in Thread>
  • Yet another 64-bit conversion patch, Carsten Langgaard <=