Subject: Re: format_bytes() horrior, or where has my memory gone.
To: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
From: Luke Mewburn <lukem@cs.rmit.edu.au>
List: port-mips
Date: 06/02/1999 15:21:53
Toru Nishimura writes:
> Hi, Luke. I have a question about format_bytes().
> What's the expected output when a value 41943040 is supplied? Like this?
>
> total memory = 40960 K
> avail memory = 36088 K
>
> rather than like;
>
> real mem = 41943040
> avail mem = 34418688
It depends upon the value of `len', but with a len of 9 (the default
used by most of the code), the `40960 KB' is the expected output.
> If so, your format_bytes() is not guilty. snprintf produces bogus
> output for "%qd" when the coresponding (long long) is supplied as its
> 4th argument.
>
> I guess MIPS varargs mistakenly takes a3 register value even when
> (long long) values aligned to onstack storage 16(sp) and 20(sp).