qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] How can I access to the CP15 registers ?


From: Francois BERJONNEAU
Subject: [Qemu-devel] How can I access to the CP15 registers ?
Date: Mon, 15 Dec 2008 11:41:03 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081125)

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 :

address@hidden:~$ 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:address@hidden>.

(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 via email to

[Prev in Thread] Current Thread [Next in Thread]