From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Og5vB2IXUWOOsA4AWB0awg (envelope-from ) for ; Thu, 20 Oct 2022 05:39:46 -0400 Received: by simark.ca (Postfix, from userid 112) id 1BB041E112; Thu, 20 Oct 2022 05:39:46 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=wkcQR4gx; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 917B71E110 for ; Thu, 20 Oct 2022 05:39:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 255833831DA0 for ; Thu, 20 Oct 2022 09:38:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 255833831DA0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258723; bh=lhPrc6ldQVn5MVnn3m7xcurdBduYWL9K2YcNIO/MAEU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=wkcQR4gxYkdQEhUgW1ybECHAAv1eQVO+JtMM4qRTFivZy1py/80vz6iqza1BJ+91v j08SYPxQXu5y3L3BfRxq+gBmDHHzZvxqyEi3whYWqTv1BnZJptsIh5L2mtoqNX6RQf xoCR0l7wVQcHBRnSnRfQmHP2coAWaNKC21PdGa30= Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 01B5B3898397 for ; Thu, 20 Oct 2022 09:36:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01B5B3898397 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 549A6300089; Thu, 20 Oct 2022 09:36:45 +0000 (UTC) To: Tsukasa OI , Andrew Burgess , Mike Frysinger , Nick Clifton Subject: [PATCH 22/40] sim/m32r: Fixes to Linux emulator Date: Thu, 20 Oct 2022 09:32:27 +0000 Message-Id: In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Tsukasa OI via Gdb-patches Reply-To: Tsukasa OI Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This commit fixes various M32R Linux emulator issues. 1. Some header files were missing a. for ioctl b. for setfsuid/setfsgid (Linux 1.2 or later) c. for flock (a syscall on Linux 2.0 or later) d. for sendfile (Linux 2.2 or later) 2. syslog function must be called as a syscall rather than POSIX syslog because we are emulating Linux system calls on the Linux host. 3. ftime function is deprecated but used intentionally. We have to disable deprecated function warning. --- sim/m32r/traps.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index f0fb218a11d..de275b06a40 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -20,6 +20,7 @@ /* This must come before any other includes. */ #include "defs.h" +#include "diagnostics.h" #include "portability.h" #include "sim-main.h" #include "sim-signal.h" @@ -38,9 +39,14 @@ NB: The emulation is also missing argument conversion (endian & bitsize) even on Linux hosts. */ #ifdef __linux__ +#include +#include +#include #include #include #include +#include +#include #include #include #include @@ -397,7 +403,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) { struct timeb t; +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS result = ftime (&t); +DIAGNOSTIC_POP errcode = errno; if (result != 0) @@ -851,7 +860,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_syslog: - result = syslog (arg1, (char *) t2h_addr (cb, &s, arg2)); + result = syscall (SYS_syslog, arg1, (char *) t2h_addr (cb, &s, arg2), arg3); errcode = errno; break; -- 2.34.1