From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87587 invoked by alias); 13 Feb 2017 05:36:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 87564 invoked by uid 89); 13 Feb 2017 05:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=simulator, D*eu, memories, Simulator X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Feb 2017 05:36:12 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 572A1340FE2; Mon, 13 Feb 2017 05:36:10 +0000 (UTC) Date: Mon, 13 Feb 2017 05:36:00 -0000 From: Mike Frysinger To: Dimitar Dimitrov Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 1/2] PRU Simulator port Message-ID: <20170213053609.GF28432@vapier> Mail-Followup-To: Dimitar Dimitrov , gdb-patches@sourceware.org References: <20161227212556.4214-1-dimitar@dinux.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5xSkJheCpeK0RUEJ" Content-Disposition: inline In-Reply-To: <20161227212556.4214-1-dimitar@dinux.eu> X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00318.txt.bz2 --5xSkJheCpeK0RUEJ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 4592 On 27 Dec 2016 23:25, Dimitar Dimitrov wrote: > The corresponding libgloss changes have not yet been mainlined. > The PRU patches are available here: > https://github.com/dinuxbg/gnupru/tree/for-next/patches/newlib-cygwin have you sent them to the mailing list ? i don't see them ... https://sourceware.org/ml/newlib/ > 2016-12-26 Dimitar Dimitrov >=20 > * sim/MAINTAINERS.tgt: Add myself as PRU maintainer. ChangeLog is relative to sim/, so should be "MAINTAINERS". also, this file doesn't have a .tgt suffix. > --- /dev/null > +++ b/sim/pru/interp.c > > +#ifndef NUM_ELEM > +#define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0]) > +#endif use the standard ARRAY_SIZE from libiberty.h > +/* DMEM zero address is perfectly valid. But if CRT leaves the first wo= rd > + alone, we can use it as a trap to catch NULL pointer access. */ > +static int abort_on_dmem_zero_access; use bfd_boolean instead, and TRUE/FALSE values > +extract_regval (uint32_t val, uint32_t regsel) > +{ > ... > + default: sim_io_error(NULL, "invalid regsel"); space before the ( this comes up a few times in this file -- please fix them all > +pru_reg2dmem (SIM_CPU *cpu, uint32_t addr, unsigned int nbytes, > + int regn, int regb) > +{ > + /* GDB assumes unconditional access to all memories, so enable additio= nal > + checks only in standalone mode. */ only one space before "in" > + bool standalone =3D (STATE_OPEN_KIND (CPU_STATE (cpu)) =3D=3D SIM_OPEN= _STANDALONE); > + > + if (standalone && abort_on_dmem_zero_access && addr < 4) i don't think you need the standalone check here. you already have the abort_on_dmem_zero_access check here. it'll work in gdb too. > +sim_step_once (SIM_DESC sd) > ... > + default: > + RAISE_SIGILL (); > + sim_io_eprintf (sd, "Unknown opcode.\n"); RAISE_SIGILL never returns, so this sim_io_eprintf is never shown, so you might as well delete it > +SIM_DESC > +sim_open (SIM_OPEN_KIND kind, host_callback *cb, > + struct bfd *abfd, char * const *argv) > ... > + sim_do_commandf (sd, "memory-region 0x%x,0x%x", > + 0, > + DMEM_DEFAULT_SIZE); > + sim_do_commandf (sd, "memory-region 0x%x,0x%x", > + 0x20000000, > + IMEM_DEFAULT_SIZE); in other sims, we check the memory map before we add this /* Allocate external memory if none specified by user. Use address 4 here in case the user wanted address 0 unmapped. */ if (sim_core_read_buffer (sd, NULL, read_map, &c, 4, 1) =3D=3D 0) { ...do the sim_do_commandf call... } > --- /dev/null > +++ b/sim/pru/pru.h > > +/* (void)0 is a guard against using RD as a left-hand side value. */ > +#define RD (void)0; rd_is_modified =3D 1; _RDVAL the standard way to handle (void)0 is with a do{...}while(0) loop looks like you want to make a helper call macro anyways. something like #define FOO(x) do { ...; _RDVAL =3D x; } while (0) also, RD depends on _RDVAL which only exists inside a single func. this should be moved to interp.c i think for the one user. > +#define PC (cpu->pru_cpu.pc) use CPU ? > +#define PC_byteaddr ((cpu->pru_cpu.pc << 2) | PC_ADDR_SPACE_MARKER) use PC ? > +#define DO_SYSCALL() pru_sim_syscall(sd, cpu) you use this once. doesn't seem like a good use of a define. i.e. delete this and inline the code in the one call site. > +#define RAISE_SIGILL() sim_engine_halt (sd, NULL, NULL, PC_byteaddr, \ > + sim_signalled, SIM_SIGILL); > +#define RAISE_SIGINT() sim_engine_halt (sd, NULL, NULL, PC_byteaddr, \ > + sim_signalled, SIM_SIGINT); shouldn't you pass in cpu here ? drop the semi-colons too > +#define NUM_REGS 33 you've got a space then a tab. you should fix that. > +#define PCREG_NUM 32 > +#define INST_SIZE 4 you aren't using these. delete them ? > +/* Number of cycles spent for memory access. No distinction is currently > + made between SRAM, DRAM and generic L3 slaves. */ > +#define MEM_ACCESS_CYCLES 2 you only use this once. does it need to be a define ? > --- /dev/null > +++ b/sim/pru/pru.isa > > +INSTRUCTION (xchg, > + fprintf (stderr, "XCHG instruction not supported by sim\n"); > + RAISE_SIGILL ()) > + > +INSTRUCTION (sxin, > + fprintf (stderr, "SXIN instruction not supported by sim\n"); > + RAISE_SIGILL ()) > + > +INSTRUCTION (sxout, > + fprintf (stderr, "SXOUT instruction not supported by sim\n"); > + RAISE_SIGILL ()) > + > +INSTRUCTION (sxchg, > + fprintf (stderr, "SXCHG instruction not supported by sim\n"); > + RAISE_SIGILL ()) you should use sim_io_eprintf instead of fprintf -mike --5xSkJheCpeK0RUEJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAlihRckACgkQQWM7n+g3 9YGL7RAAn08im6f93T14DnrwFNxPL2pLCz5TfsBJGp5rGvZ0wsrkqMEQLLIHOmp3 hTP3GPw8q0gd6sodVd/TX501j2lPwuc7PsRq6byZ5RKFIlER8KymcAdHRtrlXgT1 3YI/bjyD0fw4i76/ShWGiIEPOLWrmwH4xwl2fPVnSv3XCxtGJyLV0rizqKHAN4Ni VLSsk+AVxjtlTjVE0F64ztk+BxUUVw15EiPaeTgOqeMk5dgjqHJyCvpE3Wn75x+R ckFa7CMKJ7GLhqtZC70EnCxT1RAPNDtGxa63KLJvChFuw+PtqyV1EuFmrNjnIPQE zikBCRGEkBVgW5SZM31IOjp6Zsnb57MS6HPiPGJdUkRgs/jMqaTV1rb8PyEXdizd DKyQwTp+tiitptoETwDDK3PEaYrOfhTX98waV9ANfuaTg5kOUVtAQzRwJvH1B57v drGi7N6ZtQIiHay9Yz8rBarvSdYIB7F/h3pRMCLfWJFswyGG2UPZjhQi12lxaCEO 0FEB+K0yXeZlXTtkhJKwcAoIEzzjUG+R9lyboHYJpe8n8RUcx2s3luiA/D7AbMvj 5m25Up1hYE/DxClwLt8UCgXrNcCluhxinDnjPlLnLZ6LK39lcMpiIcxY/K+vVkhh A+DZ69LhO58Z/qB+crsmvJ4pWx6MFPBBy1W5tabXQ3InSuOz1sc= =k+dA -----END PGP SIGNATURE----- --5xSkJheCpeK0RUEJ--