From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4d2a523d8271df64fc8faaf5314d3263@terzarima.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] bug in asm.ps From: Charles Forsyth Date: Mon, 6 Mar 2006 16:56:10 +0000 In-Reply-To: <599f06db0603060833i2b1a994dr3f62c9dd18800cec@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 0cf3518e-ead1-11e9-9d60-3106f5b1d025 > For me the first is the first declared in C. First as in 1st. > This is wrong taking all this assumptions. there is no guarantee in C that variables outside structs are allocated in order of declaration, and indeed, storage might not be allocated at all if entirely contained in a register. for instance, in the plan 9 implementation, external values are allocated out of order by several ?l, allocating bigger things last, to give smaller offsets from SB for other values (when SB is a real register). automatic variables might or might not be allocated a register. asm.ms describes things from the point of view of the loader, or object code, not a compiler, but what it doesn't say (i think) is what the negative offsets mean (they index from the other end of the space used for automatic variables, allowing for pushes and pops where those exist, and a few other peculiar constructions).