From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22497 invoked by alias); 17 Feb 2015 08:59:39 -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 22476 invoked by uid 89); 17 Feb 2015 08:59:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Feb 2015 08:59:34 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 5079B3407C9; Tue, 17 Feb 2015 08:59:32 +0000 (UTC) Date: Tue, 17 Feb 2015 08:59:00 -0000 From: Mike Frysinger To: Jiri Gaisler Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 03/23] sim/erc32: Perform pseudo-init of system if binary starts from non-zero address. Message-ID: <20150217085931.GI20008@vapier> Mail-Followup-To: Jiri Gaisler , gdb-patches@sourceware.org References: <1424159099-5148-1-git-send-email-jiri@gaisler.se> <1424159099-5148-4-git-send-email-jiri@gaisler.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="16qp2B0xu0fRvRD7" Content-Disposition: inline In-Reply-To: <1424159099-5148-4-git-send-email-jiri@gaisler.se> X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00410.txt.bz2 --16qp2B0xu0fRvRD7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1459 On 17 Feb 2015 08:44, Jiri Gaisler wrote: > +extern struct pstate sregs; > + > +void > +boot_init () in C, you need to do (void) to avoid ugliness. also looks like this is missing an update to a header to add the prototype ? > +{ > + mec_write(MEC_WCR, 0); /* zero waitstates */ > + mec_write(MEC_TRAPD, 0); /* turn off watch-dog */ > + mec_write(MEC_RTC_SCALER, sregs.freq-1); /* generate 1 MHz RTC tick = */ > + mec_write(MEC_MEMCFG, (3 << 18) | (4 << 10)); /* 1 MB ROM, 4 MB RAM = */ > + sregs.wim =3D 2; > + sregs.psr =3D 0x110010e0; > + sregs.r[30] =3D RAM_END; > + sregs.r[14] =3D sregs.r[30] - 96*4; > + mec_mcr |=3D 1; /* power-down enabled */ > +} why isn't sregs passed in as an arg ? looks like both callers have a point= er to=20 it already. > --- a/sim/erc32/func.c > +++ b/sim/erc32/func.c > @@ -468,6 +468,7 @@ exec_cmd(sregs, cmd) > } > sregs->pc =3D len & ~3; > sregs->npc =3D sregs->pc + 4; > + if ((sregs->pc !=3D 0) && (ebase.simtime =3D=3D 0)) boot_init(); i know the code base doesn't follow GNU style already, but lets at least st= art=20 moving in that direction. i.e. uncuddle this: if (...) boot_init(); > --- a/sim/erc32/interf.c > +++ b/sim/erc32/interf.c > @@ -78,6 +78,7 @@ run_sim(sregs, icount, dis) > init_stdio(); > sregs->starttime =3D time(NULL); > irq =3D 0; > + if ((sregs->pc !=3D 0) && (ebase.simtime =3D=3D 0)) boot_init(); same here -mike --16qp2B0xu0fRvRD7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU4wLzAAoJEEFjO5/oN/WB/McP/3DzzLDIlHVyYy2o+gQwMaZI UiDkdvck44WStc4WJBS0uJgdXFv3rbcxlaUUd/bSuYM/oZcPu9fSc/ft3RGAxXAl fEreVfS/9rIQA20QwUN1rIGFwnWOvuvnD6REKV/IagRRanPVfzG8j81mRkeYMy9w QMBH1Vw7SKpJNwhiaG+UlUIloc6nD5k1bug8GeXN8YC/gRxSDguRXKJdzx2abD/U 6/QXDRzx33XvTACoK6cDpIhC1A87ir6TTnRCBUeI5yConlUtCZnZ16vQdNhN7y/y DJbAbwVUARt2DxtMcvpkMQzXOOTQzey6PvgX0JR0AnImqpQY1NuGReTFoHO6Y0T+ KK+aOItXAIJVAR7nTHIgxrQxT1RQVEtFMuDy1gMFFkA25S7nl20Pkgt2hbuvqoZj UnuFxOiHa6XNKuQkV2cyPo5G9RRgep5QeSnT+E6RDM2v2tbnXRutH3x6zgiHERiG 9KHbBjlVYhG/kdudQ2RPMFncrMwO3vIql2XaTTgJ/BOvtHSQrlMVN1EBQCpMtvxS fvvOVur/dhY3TjLnEI8kQMjModxL4H+J1OOaadUcUAjK7Bqu8xQ3MvToHTrKJQqU 9TtPwtoBAVZm6EJ5vkZetuW0vyg3BYDfu7tUkx8fcBCv3uQE6vtjjTmO7lMCwXWR RrLubxu8yN7mq6GuBLP5 =/dew -----END PGP SIGNATURE----- --16qp2B0xu0fRvRD7--