From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 25 Sep 2009 14:18:33 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <0394dacaee5cc8e182b6c87f23bd1c8f@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] segattach off-by-one? Topicbox-Message-UUID: 7785ce92-ead5-11e9-9d60-3106f5b1d025 On Fri Sep 25 14:11:03 EDT 2009, me@acm.jhu.edu wrote: > So in my example, va = 0x10001001, len = 0x1000. I understood that to > mean [0x10001001, 0x10002001) was the newly-valid interval, which > would mean 0x10002000 was a valid address... i think you're misreading the man page. from the man page Segattach creates a new memory segment, adds it to the call- ing process's address space, and returns its lowest address. so you need to use the value returned, not the value you gave it. in this case 0x10001000 not 0x0001001. also from the man page Va and len specify the position of the segment in the process's address space. Va is rounded down to the nearest page boundary and va+len is rounded up. The system does not so va is rounded down (as you see) and the length is rounded up, also as you see. - erik