From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OAhjBp6YYGAQKAAAWB0awg (envelope-from ) for ; Sun, 28 Mar 2021 10:54:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 0D5401E783; Sun, 28 Mar 2021 10:54:22 -0400 (EDT) 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 2A3291E783 for ; Sun, 28 Mar 2021 10:54:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50916385703C; Sun, 28 Mar 2021 14:54:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50916385703C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1616943260; bh=PXpMGFr6a6nkVOcw7JhF0w4zceOz4onPy4qq0NOjdvA=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ubho7je1djVmWDh9aGkk/p+35169BJlD3rvt+IASQ7ciPQWm2YJ+jKS3wltu05YiX gCrq7acHdIlC5HjClmCgX051VLc1OIIo5o7IF3ujjHbtxxrfkZavz6imuf6/xMmXYi epxUMGX/Y0DwPA0pl3rsxw+/nWGFKBl+982eYGGI= Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 8F66F385703C for ; Sun, 28 Mar 2021 14:54:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F66F385703C Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 698D83408B8; Sun, 28 Mar 2021 14:54:16 +0000 (UTC) Date: Sun, 28 Mar 2021 10:54:16 -0400 To: Faraz Shahbazker Subject: Re: [PATCH] sim: mips: Add handlers to simulator monitor for unlink, lseek and stat Message-ID: Mail-Followup-To: Faraz Shahbazker , gdb-patches@sourceware.org, Chao-ying Fu References: <20210328093206.15977-1-fshahbazker@wavecomp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210328093206.15977-1-fshahbazker@wavecomp.com> 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: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: gdb-patches@sourceware.org, Chao-ying Fu Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 28 Mar 2021 02:32, Faraz Shahbazker wrote: > sim/mips/ChangeLog > * interp.c (sim_monitor): Add switch entries for unlink (13), > lseek (14), and stat (15). what ABI is sim_monitor supposed to be supporting ? it seems to be confused between IDT monitor & PMON, or at least out of sync with the libgloss code. it would be nice if this were cleaned up to define the ABIs using constant maps. cris/traps.c is one example. > +#include this is not portable. we have sim-endian.h APIs already you should use. > + case 15: /* int stat(const char *path, struct stat *buf); */ > + { > + /* We need to put the data into the type of stat structure > + that MIPS uses and make sure it has the correct endianness. > + We are assuming that the host and MIPS agree on what the bits > + in st_mode mean. That appears to be true for x86 linux and > + MIPS. */ > + struct stat host_stat; > + struct __attribute__ ((__packed__)) mips_stat { > + short st_dev; > + unsigned short st_ino; > + unsigned int st_mode; > + unsigned short st_nlink; > + unsigned short st_uid; > + unsigned short st_gid; > + short st_rdev; > + union { > + int b32; > + long b64; > + } st_size; > + } mips_stat; the sim core provides APIs to automate this. grep for "stat_map" in the bfin, cris, and common code. -mike