Commit 25ca047b authored by David S. Miller's avatar David S. Miller

[SPARC64]: Merge sysinfo32 corrections from ppc64 port.

parent eaaaa304
...@@ -1531,7 +1531,11 @@ struct sysinfo32 { ...@@ -1531,7 +1531,11 @@ struct sysinfo32 {
u32 totalswap; u32 totalswap;
u32 freeswap; u32 freeswap;
unsigned short procs; unsigned short procs;
char _f[22]; unsigned short pad;
u32 totalhigh;
u32 freehigh;
u32 mem_unit;
char _f[20-2*sizeof(int)-sizeof(int)];
}; };
extern asmlinkage int sys_sysinfo(struct sysinfo *info); extern asmlinkage int sys_sysinfo(struct sysinfo *info);
...@@ -1540,11 +1544,30 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info) ...@@ -1540,11 +1544,30 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
{ {
struct sysinfo s; struct sysinfo s;
int ret, err; int ret, err;
int bitcount = 0;
mm_segment_t old_fs = get_fs (); mm_segment_t old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sysinfo(&s); ret = sys_sysinfo(&s);
set_fs (old_fs); set_fs(old_fs);
/* Check to see if any memory value is too large for 32-bit and
* scale down if needed.
*/
if ((s.totalram >> 32) || (s.totalswap >> 32)) {
while (s.mem_unit < PAGE_SIZE) {
s.mem_unit <<= 1;
bitcount++;
}
s.totalram >>= bitcount;
s.freeram >>= bitcount;
s.sharedram >>= bitcount;
s.bufferram >>= bitcount;
s.totalswap >>= bitcount;
s.freeswap >>= bitcount;
s.totalhigh >>= bitcount;
s.freehigh >>= bitcount;
}
err = put_user (s.uptime, &info->uptime); err = put_user (s.uptime, &info->uptime);
err |= __put_user (s.loads[0], &info->loads[0]); err |= __put_user (s.loads[0], &info->loads[0]);
err |= __put_user (s.loads[1], &info->loads[1]); err |= __put_user (s.loads[1], &info->loads[1]);
...@@ -1556,6 +1579,9 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info) ...@@ -1556,6 +1579,9 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
err |= __put_user (s.totalswap, &info->totalswap); err |= __put_user (s.totalswap, &info->totalswap);
err |= __put_user (s.freeswap, &info->freeswap); err |= __put_user (s.freeswap, &info->freeswap);
err |= __put_user (s.procs, &info->procs); err |= __put_user (s.procs, &info->procs);
err |= __put_user (s.totalhigh, &info->totalhigh);
err |= __put_user (s.freehigh, &info->freehigh);
err |= __put_user (s.mem_unit, &info->mem_unit);
if (err) if (err)
return -EFAULT; return -EFAULT;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment