From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net Date: Tue, 1 Sep 2009 18:52:11 +0200 From: cinap_lenrek@gmx.de In-Reply-To: <0662c118779db0f0ac85f3ce711dcbb9@quanstro.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-ronvwydebpnqusxfryuarbzblz" Subject: Re: [9fans] lowest valid stack address Topicbox-Message-UUID: 5ddf8082-ead5-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-ronvwydebpnqusxfryuarbzblz Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit read /proc/$pid/segment -- cinap --upas-ronvwydebpnqusxfryuarbzblz Content-Type: message/rfc822 Content-Disposition: inline Return-Path: <9fans-bounces+cinap_lenrek=gmx.de@9fans.net> X-Flags: 0000 Delivered-To: GMX delivery to cinap_lenrek@gmx.de Received: (qmail invoked by alias); 01 Sep 2009 15:15:44 -0000 Received: from gouda.swtch.com (EHLO gouda.swtch.com) [67.207.142.3] by mx0.gmx.net (mx101) with SMTP; 01 Sep 2009 17:15:44 +0200 Received: from localhost ([127.0.0.1] helo=gouda.swtch.com) by gouda.swtch.com with esmtp (Exim 4.69) (envelope-from <9fans-bounces@9fans.net>) id 1MiUxt-0008GB-Uq; Tue, 01 Sep 2009 15:08:09 +0000 Received: from ladd.quanstro.net ([69.55.170.73]) by gouda.swtch.com with esmtp (Exim 4.69) (envelope-from ) id 1MiUxr-0008G6-4Y for 9fans@9fans.net; Tue, 01 Sep 2009 15:08:07 +0000 Message-ID: <0662c118779db0f0ac85f3ce711dcbb9@quanstro.net> From: erik quanstrom Date: Tue, 1 Sep 2009 11:08:06 -0400 To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] lowest valid stack address X-BeenThere: 9fans@9fans.net X-Mailman-Version: 2.1.10 Precedence: list Reply-To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.9fans.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: 9fans-bounces@9fans.net Errors-To: 9fans-bounces+cinap_lenrek=gmx.de@9fans.net X-GMX-Antivirus: 0 (no virus found) X-GMX-Antispam: 0 (Sender is in whitelist: quanstro@quanstro.net) X-GMX-UID: lAiveR8jPTRtaMh0kjIw3hUxc2tpZEuN assuming no thread library, is there a way of determining the lowest valid stack address from userspace? the purpose is to create a test onstack() so that it can be asserted that a given pointer is !onstack. thread library knows. is it fair to assume that the stack can be up to 256mb? how does this generalize to 64 bits? how bogus is this code, and why? void initbos(int x) { uint m; uintptr p; p = (uintptr)&x; m = 1 << sizeof p*8 - 4; m -= 1; p &= ~m; print("%p\n", p); } uintptr bos; #define onstack(x) ((uintptr)(x) >= bos) #define threadonstack(x) /* thread library knows */ - erik --upas-ronvwydebpnqusxfryuarbzblz--