From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24746 invoked by alias); 19 Dec 2002 11:02:41 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 24735 invoked from network); 19 Dec 2002 11:02:40 -0000 Received: from unknown (HELO stardust.solidas.com) (217.13.28.68) by 209.249.29.67 with SMTP; 19 Dec 2002 11:02:40 -0000 Received: from solidas.com ([62.92.119.150]) (authenticated) by stardust.solidas.com (8.11.6/8.11.6) with ESMTP id gBJB29E12962; Thu, 19 Dec 2002 12:02:10 +0100 Message-ID: <3E01A731.3060800@solidas.com> Date: Thu, 19 Dec 2002 06:07:00 -0000 From: "Svein E. Seldal" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Denis Chertykov CC: gcc@gcc.gnu.org Subject: Re: [RFC] Gcc and harvard architectures (towards AVR) References: <3DFF4948.3060009@solidas.com> <8yyo5t8f.fsf@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-12/txt/msg01200.txt.bz2 Denis Chertykov wrote: >>I have a technical suggestion for how to implement this, but I would >>like to discuss the issue in a general basis before entering the >>detailed discussion. > > > Look to archive. > Subject: Segment register support for the i386 > Date: 31 Dec 1999 Yes, I've seen this before. But it still is an unresolved issue IMHO. For the avr-gcc this is a obvious limiation, as it required more resources to do something that is simpler if gcc had the page support. My suggestion is as follows: A target has two address-spaces; the data (the default) and the code. Consider the following example: Accesses to the data-space is done as normal: int a = 1234; // Declares a data storeage in data-space int *p = &a; // Declare a pointer (in data-space) to a data-space // storeage x = *p; // Will fill x with 1234 Accesses using the code-space can be done as follows: (Please note that code-space is usually read-only, and for this to work you'd have to declare the variables and pointers as const - but I'll skip this for now) // Declare a datastoreage in code-space int __attribute__((codespace)) b = 5678; // Declare a pointer in data-space which points to a code-space // address int __attribute__((codespace)) * q = &b; // Declare a pointer in code-space which points to a code-space // address int __attribute__((codespace)) * __attribute__((codespace)) r = &b; // Will read the contents of the code-space datastorage 'b' and // place it into x, which in this example is 5678 x = *q; // This will fail because 'q' is a codespace pointer, while 'p' is // dataspace pointer q = p; *) For those familiar with the avr target this is the same as the 'progmem' attribute. I just want to use the codespace name as a demostration of how to do it. Would this be a feasable implemenation of address-spaces? What global (gcc) changes would a implementation like this imply? Svein