* Re: ia64 sys32_sysinfo problem/fix
@ 2003-07-08 22:18 Gary Hade
0 siblings, 0 replies; only message in thread
From: Gary Hade @ 2003-07-08 22:18 UTC (permalink / raw)
To: linux-ia64
> Could you send a patch, please? Arun Sharma is the ia32 subsystem
> maintainer, so it would require his approval anyhow... (I assume it's
> OK, given that it has made it into 2.4.)
David/Arun,
The below patch applies cleanly to the ia64-030619 patched 2.5.72.
Thanks,
Gary
--
Gary Hade
IBM Linux Technology Center
503-578-4503 IBM T/L: 775-4503
garyhade@us.ibm.com
http://www.ibm.com/linux/ltc
--- linux-2.5.72/arch/ia64/ia32/sys_ia32.c.orig 2003-07-08 13:54:36.000000000 -0700
+++ linux-2.5.72/arch/ia64/ia32/sys_ia32.c 2003-07-08 13:57:44.000000000 -0700
@@ -2542,13 +2542,31 @@
sys32_sysinfo (struct sysinfo32 *info)
{
extern asmlinkage long sys_sysinfo (struct sysinfo *);
- mm_segment_t old_fs = get_fs();
struct sysinfo s;
long 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;
+ }
if (!access_ok(VERIFY_WRITE, info, sizeof(*info)))
return -EFAULT;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-08 22:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-08 22:18 ia64 sys32_sysinfo problem/fix Gary Hade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox