From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23900 invoked by alias); 20 Mar 2015 05:19:12 -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 23855 invoked by uid 89); 20 Mar 2015 05:19:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 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; Fri, 20 Mar 2015 05:19:11 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id DE1B0340C22; Fri, 20 Mar 2015 05:19:08 +0000 (UTC) Date: Fri, 20 Mar 2015 05:19:00 -0000 From: Mike Frysinger To: James Bowman , "gdb-patches@sourceware.org" Subject: Re: [PATCH, FT32] gdb and sim support Message-ID: <20150320051909.GE11803@vapier> Mail-Followup-To: James Bowman , "gdb-patches@sourceware.org" References: <20150224045154.GE13523@vapier> <20150316082548.GC12926@vapier> <20150319185217.GC4128@vapier> <20150320051809.GD11803@vapier> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Wb5NtZlyOqqy58h0" Content-Disposition: inline In-Reply-To: <20150320051809.GD11803@vapier> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00619.txt.bz2 --Wb5NtZlyOqqy58h0 Content-Type: multipart/mixed; boundary="TD8GDToEDw0WLGOL" Content-Disposition: inline --TD8GDToEDw0WLGOL Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-length: 148 On 20 Mar 2015 01:18, Mike Frysinger wrote: > it mostly looks good. i made some fixes you should apply (see attached). forgot to attach ... -mike --TD8GDToEDw0WLGOL Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="ft32-sim.patch" Content-Transfer-Encoding: quoted-printable Content-length: 3695 --- a/sim/ft32/interp.c +++ b/sim/ft32/interp.c @@ -30,16 +30,11 @@ #include "gdb/remote-sim.h" =20 #include "sim-main.h" -#include "sim-base.h" =20 #include "opcode/ft32.h" =20 #define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */ =20 -/* Forward declarations. */ -int ft32_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int lengt= h); -int ft32_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int lengt= h); - static unsigned long ft32_extract_unsigned_integer (unsigned char *addr, int len) { @@ -139,7 +134,7 @@ static uint32_t cpu_mem_read (SIM_DESC sd, uint32_t dw,= uint32_t ea) uint8_t byte[4]; =20 ea &=3D 0x1ffff; - if ((ea & ~0xffff)) + if (ea & ~0xffff) { switch (ea) { @@ -147,10 +142,8 @@ static uint32_t cpu_mem_read (SIM_DESC sd, uint32_t dw= , uint32_t ea) /* Read the simulator cycle timer. */ return cpu->state.cycles / 100; default: - sim_io_eprintf (sd, - "Illegal IO read address %08x, pc %#x\n", - ea, - insnpc); + sim_io_eprintf (sd, "Illegal IO read address %08x, pc %#x\n", + ea, insnpc); ILLEGAL (); } } @@ -281,8 +274,8 @@ static uint32_t flip (uint32_t x, uint32_t b) return x; } =20 -static -void step_once (SIM_DESC sd) +static void +step_once (SIM_DESC sd) { sim_cpu *cpu =3D STATE_CPU (sd, 0); address_word cia =3D CIA_GET (cpu); @@ -366,9 +359,7 @@ void step_once (SIM_DESC sd) else cpu->state.pc =3D cpu->state.regs[r_2]; if (cpu->state.pc =3D=3D 0x8) - { goto escape; - } } } break; @@ -680,10 +671,8 @@ sim_read (SIM_DESC sd, } =20 static uint32_t * -ft32_lookup_register (SIM_CPU *current_cpu, int nr) +ft32_lookup_register (SIM_CPU *cpu, int nr) { - sim_cpu *cpu =3D current_cpu; - /* Handle the register number translation here. * Sim registers are 0-31. * Other tools (gcc, gdb) use: @@ -694,29 +683,28 @@ ft32_lookup_register (SIM_CPU *current_cpu, int nr) */ =20 if ((nr < 0) || (nr > 31)) - abort (); + { + sim_io_eprintf (CPU_STATE (cpu), "unknown register %i\n", nr); + abort (); + } =20 switch (nr) { case 0: return &cpu->state.regs[FT32_FP_REGNUM]; - break; case 1: return &cpu->state.regs[FT32_SP_REGNUM]; - break; case 31: return &cpu->state.regs[FT32_CC_REGNUM]; - break; case 32: return &cpu->state.pc; - break; default: return &cpu->state.regs[nr - 2]; } } =20 -int -ft32_reg_store (SIM_CPU *current_cpu, +static int +ft32_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length) @@ -724,7 +712,7 @@ ft32_reg_store (SIM_CPU *current_cpu, if (0 <=3D rn && rn <=3D 32) { if (length =3D=3D 4) - *ft32_lookup_register (current_cpu, rn) =3D ft32_extract_unsigned_integer= (memory, 4); + *ft32_lookup_register (cpu, rn) =3D ft32_extract_unsigned_integer (memory= , 4); =20 return 4; } @@ -732,8 +720,8 @@ ft32_reg_store (SIM_CPU *current_cpu, return 0; } =20 -int -ft32_reg_fetch (SIM_CPU *current_cpu, +static int +ft32_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length) @@ -741,7 +729,7 @@ ft32_reg_fetch (SIM_CPU *current_cpu, if (0 <=3D rn && rn <=3D 32) { if (length =3D=3D 4) - ft32_store_unsigned_integer (memory, 4, *ft32_lookup_register (current_cp= u, rn)); + ft32_store_unsigned_integer (memory, 4, *ft32_lookup_register (cpu, rn)); =20 return 4; } @@ -837,8 +825,7 @@ sim_open (SIM_OPEN_KIND kind, } =20 void -sim_close (SIM_DESC sd, - int quitting) +sim_close (SIM_DESC sd, int quitting) { sim_module_uninstall (sd); } --TD8GDToEDw0WLGOL-- --Wb5NtZlyOqqy58h0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVC63NAAoJEEFjO5/oN/WBek4P/iUXMkfsuKHbdg3rGI16T6rH 1z66MUeEHbb0N7+I9tX5RilwrIH76YGqNvkcP4IRCbqnVQTK6seM/0bFk9fVl204 tZrZ1oY4SYxSXTKzBlgOchZhZc0ogvLp2mUfI9Vb3EtlgPEKw151H0QXJNOkHTpO yGbDIaY0NmnsNKMc1nRlwWGyYY36zwNRtqZF+6LziNelWHEeA0DGHd4XFH/f9Tqc Pww8bhGxpGbA85iq9Vm4mCv0T1sSuRqSZfoNse1HZHUmIWcI7p3Xfg24z4NwBhg/ agPOAvV8Wqs7VpwwvCjgp8Ps01PTiITMZJGS/YSvf9shZAPlsZdiRmA9PH1aEv9a /b9CfzTJtJrjJGLgPM0rNJbC89OmvT4HY3mdzswO1pev5+wlvVY7vto8XX/hIib4 ScxTrSpNUACkjyqx5L1BPafQRbnpRZHOxk7AjHn6QluAJXgtbXN8Se2JAl2Urvm4 9YLMgjr3rFTJuJqlfj0TKp26gSMOAUrV65UxquYn6n4cJvwviapADOPFzO5xFucy osiSIggyhSzX2AK6nUfmVSifM0gAnRZqWq/3rMs3fIqVdiF1Ei7Vf2oGZ8TS4i5u kgMUTDJaSIvYgub6V6lk8pKiXTrL6h1Fzvgjb2BT0hCy7xOsmJd4k+taF1TmWsAg iRcFYpa2GPKxZvsYJBhc =FJZQ -----END PGP SIGNATURE----- --Wb5NtZlyOqqy58h0--