From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qhz7JgLRql81EgAAWB0awg (envelope-from ) for ; Tue, 10 Nov 2020 12:42:26 -0500 Received: by simark.ca (Postfix, from userid 112) id 91E471F08B; Tue, 10 Nov 2020 12:42:26 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,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 CE6231E58F for ; Tue, 10 Nov 2020 12:42:25 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 540DA3861878; Tue, 10 Nov 2020 17:42:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 540DA3861878 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605030145; bh=NGyOE9Umar1N0ybThWr5cYHB66Ja1Keq979hiEB/CD0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=WE5lDOJ5kKDuGzGfh3OopB5w4gU0WXRTjAzIdurWsBqXOxLmyMT5WCo+297cb/aOV LHenV9oJsFGOfWd8ugkVz9LH7KI16tCaXnteNOIEmkzS1ANrPEhAu3xSs3AkDoKsuP XrrcF7I/yYykgAlKMWdk5rqUJ7GLoRWHXh64PJ7Y= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 45AD93861834 for ; Tue, 10 Nov 2020 17:42:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 45AD93861834 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-JP4WfMdcORayQUG-Gin0fQ-1; Tue, 10 Nov 2020 12:42:21 -0500 X-MC-Unique: JP4WfMdcORayQUG-Gin0fQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4026801FDB; Tue, 10 Nov 2020 17:42:19 +0000 (UTC) Received: from comet.redhat.com (ovpn-115-53.ams2.redhat.com [10.36.115.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD9D646; Tue, 10 Nov 2020 17:42:18 +0000 (UTC) To: dje@sebabeach.org, andrew.burgess@embecosm.com Subject: RFA: m32r sim: Add prototypes for functions that pass/return DI values Date: Tue, 10 Nov 2020 17:42:15 +0000 Message-ID: <87ft5hhzwo.fsf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: , From: Nick Clifton via Gdb-patches Reply-To: Nick Clifton Cc: gdb-patches@sourceware.org, law@redhat.com Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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); +#ifndef GET_H_ACCUM #define GET_H_ACCUM() \ XCONCAT2 (WANT_CPU,_h_accum_get_handler) (current_cpu) #define SET_H_ACCUM(val) \