From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30172 invoked by alias); 2 Jun 2003 05:53:45 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30089 invoked from network); 2 Jun 2003 05:53:44 -0000 Received: from unknown (HELO are.twiddle.net) (64.81.246.98) by sources.redhat.com with SMTP; 2 Jun 2003 05:53:44 -0000 Received: from are.twiddle.net (localhost.localdomain [127.0.0.1]) by are.twiddle.net (8.12.8/8.12.8) with ESMTP id h525rhLH007606 for ; Sun, 1 Jun 2003 22:53:43 -0700 Received: (from rth@localhost) by are.twiddle.net (8.12.8/8.12.8/Submit) id h525rhjj007604 for gdb-patches@sources.redhat.com; Sun, 1 Jun 2003 22:53:43 -0700 X-Authentication-Warning: are.twiddle.net: rth set sender to rth@twiddle.net using -f Date: Mon, 02 Jun 2003 05:53:00 -0000 From: Richard Henderson To: gdb-patches@sources.redhat.com Subject: [RFA] fix calling conventions wrt 32-bit values Message-ID: <20030602055343.GA7598@twiddle.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-06/txt/msg00059.txt.bz2 Ok? r~ * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated sign-extension of 32-bit values. (alpha_store_return_value): Similarly. --- alpha-tdep.c.5 2003-06-01 22:34:01.000000000 -0700 +++ alpha-tdep.c 2003-06-01 22:42:32.000000000 -0700 @@ -276,9 +276,16 @@ alpha_push_dummy_call (struct gdbarch *g case TYPE_CODE_CHAR: case TYPE_CODE_RANGE: case TYPE_CODE_ENUM: - if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long)) + if (TYPE_LENGTH (arg_type) == 4) { - arg_type = builtin_type_long; + /* 32-bit values must be sign-extended to 64 bits + even if the base data type is unsigned. */ + arg_type = builtin_type_int32; + arg = value_cast (arg_type, arg); + } + if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE) + { + arg_type = builtin_type_int64; arg = value_cast (arg_type, arg); } break; @@ -541,6 +548,10 @@ alpha_store_return_value (struct type *v default: /* Assume everything else degenerates to an integer. */ + /* 32-bit values must be sign-extended to 64 bits + even if the base data type is unsigned. */ + if (length == 4) + valtype = builtin_type_int32; l = unpack_long (valtype, valbuf); regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l); break;