From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8EHSI+xTrF8PNwAAWB0awg (envelope-from ) for ; Wed, 11 Nov 2020 16:13:16 -0500 Received: by simark.ca (Postfix, from userid 112) id 907491F08B; Wed, 11 Nov 2020 16:13:16 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B28BC1E552 for ; Wed, 11 Nov 2020 16:13:15 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 721EB3833028; Wed, 11 Nov 2020 21:13:15 +0000 (GMT) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 7180C3833026 for ; Wed, 11 Nov 2020 21:13:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7180C3833026 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x434.google.com with SMTP id k2so3918563wrx.2 for ; Wed, 11 Nov 2020 13:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=C8N2j60udEAsQbaKgimcGnufJtxhYB4qgLUXgQc/t5s=; b=Yq8hlANLD5d/eUPqgfsyXeQIS50ZQAMiNQlNBhYnPC6keu3KwKjl9PP1M/Vr+iPw1+ AhfyO6o70zCs1584Qz6kFtAgTJq2hwfI7PHE0XxUBoXo8fbPyP+UmKz/baXM1HKaIp+I LeEiWGjZhzq1UIRJMsLP3sjFARMJb5iNMvArh2dPSvc9os0bY5PD0MSqJhDHMlL/nYEW rpv4ECFDjnwwsMlzx/XVLH8mYIz92IGMf2qPNz7a2R+Q2jqNZO7chn3PcuaY+RkgW/zs YzBvi5zn4QLxCeRjQPhKWg+HZFX2ossOfkMY5NgY83Mf3Ash0rqe3HV8C+pbZTF4Dhsv AYlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=C8N2j60udEAsQbaKgimcGnufJtxhYB4qgLUXgQc/t5s=; b=CigZTgRPEfTeYqKoBjFdudu12eQn2nFDN7JerQKZtjGbcCD47Bx56vFtuMI5Uyuzim OKokDN9YkejcfMAvKo+7+QYQwQ6D54uLmLsZ6LasJ306e2qKGjaD53Pu8vhH11KbWRMr bLa3D2tLU9qviFp5P6/bhXm8hRRcoyW/khHXscnPrGeVnGnDVSmtzVhLqutf96qCzoz5 A8SS23cttw+0UDNfqtop+A+jcxHrI2MifM6gcbmik/T5XejbcZoajUA8pJvU2BfrYN6G 4JBeO/cw1pI9LT88M5TH37KvE1z+Y6kvCiEySb3yuBbbdzJDKH6Jq1ZsLZMtoWeEWFbK T8VA== X-Gm-Message-State: AOAM531uQ6ELmF9en9M066CvSFW3dK2NuDUEbl+X2hQjzUWkOVIeJoqz a1blQd2Kom6D6+L83SO0WjTe1Q== X-Google-Smtp-Source: ABdhPJzU/hIEmXNu2/RPSqqsDFq5NHCWtuVolec8cbypsYr7lLWIQuKWg+v1SvhRKai1s/6NNpkYaw== X-Received: by 2002:adf:f146:: with SMTP id y6mr10040916wro.298.1605129192554; Wed, 11 Nov 2020 13:13:12 -0800 (PST) Received: from localhost (host212-140-123-128.range212-140.btcentralplus.com. [212.140.123.128]) by smtp.gmail.com with ESMTPSA id z3sm3303020wrw.87.2020.11.11.13.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 13:13:11 -0800 (PST) Date: Wed, 11 Nov 2020 21:13:11 +0000 From: Andrew Burgess To: Nick Clifton Subject: Re: RFA: m32r sim: Add prototypes for functions that pass/return DI values Message-ID: <20201111211311.GM2729@embecosm.com> References: <87ft5hhzwo.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ft5hhzwo.fsf@redhat.com> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 21:11:56 up 17 days, 12:15, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org, dje@sebabeach.org, law@redhat.com Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Nick Clifton [2020-11-10 17:42:15 +0000]: > Hi Doug, Hi Andrew, > > Jeff Law has tracked down a set of problems with the m32r simulator > which turned out to be because the m32rbf_h_accum_get_handler() > function returns a DI value, but it was not prototyped. So callers > would assume that it returned an int, and happiness ensued... > > I am proposing the attached patch as a workaround for the problem. A > proper fix would be to update the scheme files used to generate the > cpu headers. But I am not a scheme programmer, and besides getting > cgen to work with modern versions of guile seems to be quite > difficult. So instead the patch adds prototypes into one of the m32r > sim header files that is not auto-generated. > > OK to apply ? > > Cheers > Nick > > sim/m32r/ChangeLog > 2020-11-10 Nick Clifton > > * m32r-sim.h (m32rbf_h_accum_get_handler): Always provide a > prototype for this function. > (m32rbf_h_accum_set_handler): Likewise. > (m32r2f_h_accums_get_handler): Prototype. > (m32r2f_h_accums_set_handler): Prototype. > > diff --git a/sim/m32r/m32r-sim.h b/sim/m32r/m32r-sim.h > index 9f3e270f39..6f9f4610c0 100644 > --- a/sim/m32r/m32r-sim.h > +++ b/sim/m32r/m32r-sim.h > @@ -61,10 +61,19 @@ extern void m32rbf_h_psw_set_handler (SIM_CPU *, UQI); > XCONCAT2 (WANT_CPU,_h_psw_set_handler) (current_cpu, (val)) > #endif > > -#ifndef GET_H_ACCUM > +/* FIXME: These prototypes are necessary because the cgen generated > + cpu.h, cpux.h and cpu2.h headers do not provide them, and functions > + which take or return parameters that are larger than an int must be > + prototyed in order for them to work correctly. > + > + The correct solution is to fix the code in cgen/sim.scm to generate > + prototypes for each of the functions it generates. */ > extern DI m32rbf_h_accum_get_handler (SIM_CPU *); > extern void m32rbf_h_accum_set_handler (SIM_CPU *, DI); > +extern DI m32r2f_h_accums_get_handler (SIM_CPU *, UINT); > +extern void m32r2f_h_accums_set_handler (SIM_CPU *, UINT, DI); It looks like someone already did some of this before, so it seems hard to argue against it :-) Feel free to apply. Thanks, Andrew > > +#ifndef GET_H_ACCUM > #define GET_H_ACCUM() \ > XCONCAT2 (WANT_CPU,_h_accum_get_handler) (current_cpu) > #define SET_H_ACCUM(val) \ >