Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2003-06-15 20:29:03 +1000
committerAnton Blanchard <anton@samba.org>2003-06-15 20:29:03 +1000
commit0aff9b5758d0835a0c66cd2bab072ee3910500fd (patch)
treefe6eefed5baa8baca309202dada66f02760e6100
parent9a1a077bbae04c9d5ac24f00d012396d6ec8cf1b (diff)
ppc64: various fixes to sys32_sysinfo, from Will Schmidt
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index ad742b3b0019..ff5ae46642c1 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -1136,7 +1136,11 @@ struct sysinfo32 {
u32 totalswap;
u32 freeswap;
unsigned short procs;
- char _f[22];
+ unsigned short pad;
+ u32 totalhigh;
+ u32 freehigh;
+ u32 mem_unit;
+ char _f[20-2*sizeof(long)-sizeof(int)];
};
extern asmlinkage long sys_sysinfo(struct sysinfo *info);
@@ -1145,11 +1149,30 @@ asmlinkage long sys32_sysinfo(struct sysinfo32 *info)
{
struct sysinfo s;
int ret, err;
+ int bitcount=0;
mm_segment_t old_fs = get_fs ();
set_fs (KERNEL_DS);
ret = sys_sysinfo(&s);
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.loads[0], &info->loads[0]);
err |= __put_user (s.loads[1], &info->loads[1]);
@@ -1161,6 +1184,9 @@ asmlinkage long sys32_sysinfo(struct sysinfo32 *info)
err |= __put_user (s.totalswap, &info->totalswap);
err |= __put_user (s.freeswap, &info->freeswap);
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)
return -EFAULT;