From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7552 invoked by alias); 11 Mar 2007 06:22:39 -0000 Received: (qmail 7542 invoked by uid 22791); 11 Mar 2007 06:22:38 -0000 X-Spam-Check-By: sourceware.org Received: from web38906.mail.mud.yahoo.com (HELO web38906.mail.mud.yahoo.com) (209.191.125.112) by sourceware.org (qpsmtpd/0.31) with SMTP; Sun, 11 Mar 2007 06:22:30 +0000 Received: (qmail 89393 invoked by uid 60001); 11 Mar 2007 06:22:28 -0000 X-YMail-OSG: _WvWyxoVM1kPF4JxhsIbfBroorxW1fk2EouyjUEL5JDKVtnQJaRVbcGIoF9rmBphXCk0PjoQQomBh0JujX0xGDXKKWtZshYBuPiZDepRrJDQyUcKr9OGLM3Ei_5GfqhSFFlnETJESZv1LSA- Received: from [202.156.9.1] by web38906.mail.mud.yahoo.com via HTTP; Sat, 10 Mar 2007 22:22:28 PST Date: Sun, 11 Mar 2007 14:46:00 -0000 From: Vishnu M Menon Subject: Reserving the same virtual address space range in several programs To: gcc-help@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <803480.85995.qm@web38906.mail.mud.yahoo.com> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg00141.txt.bz2 Hi, I am trying to solve this problem: reserve the same virtual memory address range in a given set of programs so that no addresses falling within this range will be used by the processes for any other purpose. Later I'll map a shared memory region to this address using mmap(.) or shmat(.). My question is: is there a way I can use GCC to achieve this VM address reservation? The programs are fully in my control and are extremely specialized, so I am at liberty to use techniques sane people would balk at. To give a clearer idea of what I'm getting at, reserving 10 MB of memory space might be achieved through something like: char g_MemArray[ 10 * ( 1 << 20 ) ]; int main() { printf("Starts at %p\n", g_MemArray ); return 0; } But of course, layout of global variables will vary from program to program. I am trying to see if somehow the layout can be specified so that VM addresses are guaranteed to be the same. TIA for the replies. I would also welcome any solutions that do not involve gcc, though I realize this would be off-topic (for which I apologize in advance!). Regards, Vishnu