Message ID | CACxje58FtKDNZNw1cFOOMB1BUSf8_opSGgDvBw=M+bTbgfk-BA@mail.gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 39391 invoked by alias); 14 Dec 2019 10:26:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 39382 invoked by uid 89); 14 Dec 2019 10:26:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=sk:greenm, D*moxielogic.com, green@moxielogic.com, sk:green@m X-HELO: mail-lf1-f65.google.com Received: from mail-lf1-f65.google.com (HELO mail-lf1-f65.google.com) (209.85.167.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Dec 2019 10:26:08 +0000 Received: by mail-lf1-f65.google.com with SMTP id m30so1036708lfp.8 for <gdb-patches@sourceware.org>; Sat, 14 Dec 2019 02:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=moxielogic-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=GH24AQuF4rk5xeYfADqtfzFmGjtCF5dAxQt+aE3JiK8=; b=KJHljRyQC60623RvIPLAwUsFoy6S8fZZBg0WK3R1bY73rypJAHn8LZjg8k7wmNly7F wao29cD3ef4xu1SxZRs53VzRr3nvQYUd3zPuA8LA7NLtk0qlF4Q5eGOAHpbxrR6vjFNa ztrtzuogc0/Pxd7GUiAfu6FMTP1TTul9N/FFrFo5v2mfZime5fZQvELEJNIf0SnyJjcE agmlkQChzMh6Gyrs5Ou9BsybMR0tE9BN6TXvlR5rn9hvM2RgzlWGdabeuzWFIMU5My9S 3cHB99eU+0FdKPAWd+uwFkJoCngg2xG3XnrgWAPeeVi4CkYORfeW4Is3vsSbNT4O94i8 mMwQ== MIME-Version: 1.0 From: Anthony Green <green@moxielogic.com> Date: Sat, 14 Dec 2019 05:25:54 -0500 Message-ID: <CACxje58FtKDNZNw1cFOOMB1BUSf8_opSGgDvBw=M+bTbgfk-BA@mail.gmail.com> Subject: [PATCH] Implement unlink system call for moxie sim To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes |
Commit Message
Anthony Green
Dec. 14, 2019, 10:25 a.m. UTC
The following patch to the moxie sim (which I just pushed) adds support for the unlink system call, which is required by the GCC testsuite. It also switches read/write/open system calls to use the sim_io_* functions. 2019-12-14 Anthony Green <green@moxielogic.com> * interp.c (sim_engine_run): Make use of sim_io_* functions for read/write/open system calls. Implement the unlink system call. typedef unsigned int uword; @@ -942,9 +943,10 @@ sim_engine_run (SIM_DESC sd, char fname[1024]; int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]); int perm = (int) cpu.asregs.regs[4]; - int fd = open (fname, mode, perm); + int fd; sim_core_read_buffer (sd, scpu, read_map, fname, cpu.asregs.regs[2], 1024); + fd = sim_io_open (sd, fname, mode); /* FIXME - set errno */ cpu.asregs.regs[2] = fd; break; @@ -954,7 +956,7 @@ sim_engine_run (SIM_DESC sd, int fd = cpu.asregs.regs[2]; unsigned len = (unsigned) cpu.asregs.regs[4]; char *buf = malloc (len); - cpu.asregs.regs[2] = read (fd, buf, len); + cpu.asregs.regs[2] = sim_io_read (sd, fd, buf, len); sim_core_write_buffer (sd, scpu, write_map, buf, cpu.asregs.regs[3], len); free (buf); @@ -968,11 +970,22 @@ sim_engine_run (SIM_DESC sd, str = malloc (len); sim_core_read_buffer (sd, scpu, read_map, str, cpu.asregs.regs[3], len); - count = write (cpu.asregs.regs[2], str, len); + count = sim_io_write (sd, cpu.asregs.regs[2], str, len); free (str); cpu.asregs.regs[2] = count; break; } + case 0x7: /* SYS_unlink */ + { + char fname[1024]; + int fd; + sim_core_read_buffer (sd, scpu, read_map, fname, + cpu.asregs.regs[2], 1024); + fd = sim_io_unlink (sd, fname); + /* FIXME - set errno */ + cpu.asregs.regs[2] = fd; + break; + } case 0xffffffff: /* Linux System Call */ { unsigned int handler = cpu.asregs.sregs[1];
Comments
On 2019-12-14 5:25 a.m., Anthony Green wrote: > The following patch to the moxie sim (which I just pushed) adds > support for the unlink system call, which is required by the GCC > testsuite. It also switches read/write/open system calls to use the > sim_io_* functions. Hi Anthony, When you push a patch directly, please use a tag in the subject to reflect this, to make it obvious. For example, with git-send-email `--subject-prefix=pushed`. The exact tag doesn't really matter, as long as it's clear. Thanks, Simon
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index ecea5b42f3..fe770093e5 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sim-main.h" #include "sim-base.h" #include "sim-options.h" +#include "sim-io.h" typedef int word;