From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCAtK-0006Dz-Nw for qemu-devel@nongnu.org; Mon, 15 Dec 2008 05:41:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCAtJ-0006DS-A2 for qemu-devel@nongnu.org; Mon, 15 Dec 2008 05:41:34 -0500 Received: from [199.232.76.173] (port=51413 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCAtJ-0006DI-2k for qemu-devel@nongnu.org; Mon, 15 Dec 2008 05:41:33 -0500 Received: from mta.eseo.fr ([193.49.148.26]:57533) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCAtI-0003R2-CL for qemu-devel@nongnu.org; Mon, 15 Dec 2008 05:41:32 -0500 Received: from mta.eseo.fr (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 7B82A18BC38A for ; Mon, 15 Dec 2008 10:41:26 +0000 (GMT) Received: from exchange.interne.eseo.fr (unknown [172.16.0.6]) by mta.eseo.fr (Email Security Appliance) with ESMTP id 237CB18BC389 for ; Mon, 15 Dec 2008 10:41:26 +0000 (GMT) Message-ID: <4946343F.7080808@eseo.fr> Date: Mon, 15 Dec 2008 11:41:03 +0100 From: Francois BERJONNEAU MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] How can I access to the CP15 registers ? Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I'm newbie in Qemu and in embedded development (on ARM). I must implement MMU/MPU functions for one rtos. In order to debug it=20 more easily I need to access at the cp15 registers through gdb. Actually I use the last release of Qemu. I manage to connect gdb with=20 Qemu (Intergrator/CP) with uboot and linux (download on the Qemu web site= ). I don't manage to access to the cp15 registers. I use the=20 arm-none-eabi-gdb : berjonneau@pc-nuth:~$ arm-none-eabi-gdb GNU gdb (CodeSourcery Sourcery G++ 2006q3-27) 6.5.50.20060822-cvs Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you = are welcome to change it and/or distribute copies of it under certain=20 conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for detail= s. This GDB was configured as "--host=3Di686-pc-linux-gnu=20 --target=3Darm-none-eabi". For bug reporting instructions, please see: . (gdb) target remote localhost:1234 Remote debugging using localhost:1234 0x01005630 in ?? () When I try the command monitor I receive this message : "Target does not=20 support this command." I have try to understand the Qemu architecture but it's not easily for me= . Surely I have forgot some (many) dependencies or I don't have=20 understand them. If somebody can help me (not necessary with THE solution but with the=20 way I must watch for find solution) I have try to modify my version of Qemu in file "gdbstub.c" I just have=20 modify this : #elif defined (TARGET_ARM) static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf) { int i; uint8_t *ptr; ptr =3D mem_buf; /* 16 core integer registers (4 bytes each). */ for (i =3D 0; i < 16; i++) { *(uint32_t *)ptr =3D tswapl(env->regs[i]); ptr +=3D 4; } /* 8 FPA registers (12 bytes each), FPS (4 bytes). Not yet implemented. */ memset (ptr, 0, 8 * 12 + 4); ptr +=3D 8 * 12 + 4; /* CPSR (4 bytes). */ *(uint32_t *)ptr =3D tswapl (cpsr_read(env)); ptr +=3D 4; =20 /************************************************************************= ********************* =20 /* MODIFY =20 /************************************************************************= ********************/ *(uint32_t *)ptr =3D tswapl(env->cp15.c0_cpuid); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c0_cachetype); ptr +=3D 4; for (i =3D 0; i < 8; i++) { *(uint32_t *)ptr =3D tswapl(env->cp15.c0_c1[i]); ptr +=3D 4; } for (i =3D 0; i < 8; i++) { *(uint32_t *)ptr =3D tswapl(env->cp15.c0_c2[i]); ptr +=3D 4; } *(uint32_t *)ptr =3D tswapl(env->cp15.c1_sys); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c1_coproc); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c2_base0); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c2_base1); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c2_mask); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c3); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c5_insn); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c5_data); ptr +=3D 4; for (i =3D 0; i <8; i++) { *(uint32_t *)ptr =3D tswapl(env->cp15.c6_region[i]); ptr +=3D 4; } *(uint32_t *)ptr =3D tswapl(env->cp15.c6_insn); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c6_data); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c9_insn); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c9_data); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c13_fcse); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c13_context); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c13_tls1); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c13_tls2); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c13_tls3); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c15_i_max); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c15_i_min); ptr +=3D 4; *(uint32_t *)ptr =3D tswapl(env->cp15.c15_threadid); ptr +=3D 4; /***********************************************************************= **************************** /* /***********************************************************************= ****************************/ return ptr - mem_buf; } Thank you vary much everybody. --=20 Cordialement _____________________________________ BERJONNEAU Fran=E7ois Stagiaire CNAM Equipe TRAME - ESEO