From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13814 invoked by alias); 14 Apr 2005 22:08:37 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 13665 invoked from network); 14 Apr 2005 22:08:12 -0000 Received: from unknown (HELO sj-iport-3.cisco.com) (171.71.176.72) by sourceware.org with SMTP; 14 Apr 2005 22:08:12 -0000 Received: from sj-core-5.cisco.com (171.71.177.238) by sj-iport-3.cisco.com with ESMTP; 14 Apr 2005 15:05:50 -0700 X-IronPort-AV: i="3.92,103,1112598000"; d="scan'208"; a="249863221:sNHT1011061082" Received: from beasley.cisco.com (beasley.cisco.com [171.71.180.166]) by sj-core-5.cisco.com (8.12.10/8.12.6) with ESMTP id j3EM5lfk003485; Thu, 14 Apr 2005 15:05:48 -0700 (PDT) Received: from dhcp-128-107-165-110.cisco.com (dhcp-128-107-165-110.cisco.com [128.107.165.110]) by beasley.cisco.com (8.8.6 (PHNE_14041)/CISCO.SERVER.1.2) with ESMTP id PAA22911; Thu, 14 Apr 2005 15:05:48 -0700 (PDT) Subject: [patch] adjust libgloss addresses for 64-bit From: Eric Christopher To: newlib@sources.redhat.com, binutils@sources.redhat.com Cc: cgd@broadcom.com Content-Type: text/plain Date: Thu, 14 Apr 2005 22:08:00 -0000 Message-Id: <1113516346.4591.39.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-04/txt/msg00395.txt.bz2 Here's another shot at this. The problem that we encounter is that for 64-bit addresses "la" (or dla for that matter) does not sign extend the constant passed in the case of: la $2,0x80000000 leaving us with a zero-extended value in a register which is unpredictable as far as the standard (and at least one chip out there) is concerned. One option would be to modify the assembler to automatically sign-extend when in the presence of constants that are smaller than a single register. Not a bad idea, but we should also just be precise in what we pass as well. Since gas will accept sign extended constants from la when we're using a 64-bit pointers we can probably get by with this patch as well. The issue of whether or not to automagically sign extend when we load addresses is a separate one I think really in this case. Thoughts? -eric 2005-04-12 Eric Christopher * mips/regs.S: For __mips64 sign-extend K0BASE. Clean up K1BASE_ADDR handling. Index: mips/regs.S =================================================================== RCS file: /cvs/src/src/libgloss/mips/regs.S,v retrieving revision 1.3 diff -u -p -r1.3 regs.S --- mips/regs.S 3 Apr 2004 01:02:51 -0000 1.3 +++ mips/regs.S 14 Apr 2005 22:04:32 -0000 @@ -53,15 +53,16 @@ #define fp1 $f1 /* Useful memory constants: */ -#define K0BASE 0x80000000 #ifndef __mips64 +#define K0BASE 0x80000000 #define K1BASE 0xA0000000 #define K0BASE_ADDR ((char *)K0BASE) #define K1BASE_ADDR ((char *)K1BASE) #else -#define K1BASE 0xFFFFFFFFA0000000LL +#define K0BASE 0xFFFFFFFF80000000 +#define K1BASE 0xFFFFFFFFA0000000 #define K0BASE_ADDR ((char *)0xFFFFFFFF80000000LL) -#define K1BASE_ADDR ((char *)K1BASE) +#define K1BASE_ADDR ((char *)0xFFFFFFFFA0000000LL) #endif #define PHYS_TO_K1(a) ((unsigned)(a) | K1BASE)