From: Francois BERJONNEAU <francois.berjonneau@eseo.fr>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] How can I access to the CP15 registers ?
Date: Mon, 15 Dec 2008 11:41:03 +0100 [thread overview]
Message-ID: <4946343F.7080808@eseo.fr> (raw)
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
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
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
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
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-none-eabi".
For bug reporting instructions, please see:
<URL:mailto:arm-gnu@codesourcery.com>.
(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
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
understand them.
If somebody can help me (not necessary with THE solution but with the
way I must watch for find solution)
I have try to modify my version of Qemu in file "gdbstub.c" I just have
modify this :
#elif defined (TARGET_ARM)
static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
{
int i;
uint8_t *ptr;
ptr = mem_buf;
/* 16 core integer registers (4 bytes each). */
for (i = 0; i < 16; i++)
{
*(uint32_t *)ptr = tswapl(env->regs[i]);
ptr += 4;
}
/* 8 FPA registers (12 bytes each), FPS (4 bytes).
Not yet implemented. */
memset (ptr, 0, 8 * 12 + 4);
ptr += 8 * 12 + 4;
/* CPSR (4 bytes). */
*(uint32_t *)ptr = tswapl (cpsr_read(env));
ptr += 4;
/*********************************************************************************************
/* MODIFY
/********************************************************************************************/
*(uint32_t *)ptr = tswapl(env->cp15.c0_cpuid);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c0_cachetype);
ptr += 4;
for (i = 0; i < 8; i++)
{
*(uint32_t *)ptr = tswapl(env->cp15.c0_c1[i]);
ptr += 4;
}
for (i = 0; i < 8; i++)
{
*(uint32_t *)ptr = tswapl(env->cp15.c0_c2[i]);
ptr += 4;
}
*(uint32_t *)ptr = tswapl(env->cp15.c1_sys);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c1_coproc);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c2_base0);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c2_base1);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c2_mask);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c3);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c5_insn);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c5_data);
ptr += 4;
for (i = 0; i <8; i++)
{
*(uint32_t *)ptr = tswapl(env->cp15.c6_region[i]);
ptr += 4;
}
*(uint32_t *)ptr = tswapl(env->cp15.c6_insn);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c6_data);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c9_insn);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c9_data);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c13_fcse);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c13_context);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c13_tls1);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c13_tls2);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c13_tls3);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c15_i_max);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c15_i_min);
ptr += 4;
*(uint32_t *)ptr = tswapl(env->cp15.c15_threadid);
ptr += 4;
/***************************************************************************************************
/*
/***************************************************************************************************/
return ptr - mem_buf;
}
Thank you vary much everybody.
--
Cordialement
_____________________________________
BERJONNEAU François
Stagiaire CNAM
Equipe TRAME - ESEO
reply other threads:[~2008-12-15 10:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4946343F.7080808@eseo.fr \
--to=francois.berjonneau@eseo.fr \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).