Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3kD2-0003gK-5X for qemu-devel@nongnu.org; Mon, 19 Apr 2010 02:11:52 -0400 Received: from [140.186.70.92] (port=48538 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3kD0-0003gC-4i for qemu-devel@nongnu.org; Mon, 19 Apr 2010 02:11:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3kCy-0001Ty-QC for qemu-devel@nongnu.org; Mon, 19 Apr 2010 02:11:49 -0400 Received: from col0-omc2-s7.col0.hotmail.com ([65.55.34.81]:8225) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3kCy-0001Ti-Kc for qemu-devel@nongnu.org; Mon, 19 Apr 2010 02:11:48 -0400 Message-ID: Content-Type: multipart/alternative; boundary="_cafa6acc-c7df-4d98-b573-4e06a3e21f44_" From: Taimoor Mirza Date: Mon, 19 Apr 2010 12:11:46 +0600 MIME-Version: 1.0 Subject: [Qemu-devel] Inserting Memory Watch points List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --_cafa6acc-c7df-4d98-b573-4e06a3e21f44_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi all=2C I've developed an application for ARM intergrator and it is running find un= der QEMU. I am trying to redirect my serial data to my custom emulated devi= ce. For that I've inserted memory watch point at Pl011 UART controllers Da= ta Register so that whenever some access is made to this register my regist= ered function gets invoked which will redirect request to my custom emulate= d device. I've few questions: cpu_watchpoint_insert needs a CPU_State parameter. From where can I get thi= s CPU state.I tried putting code in vl.c and called my custom_init function= from main before main_loop(). Below is source code of my custom_init funct= ion: static void custom_init() { CPUState *env=3B int err =3D 0=3B for (env =3D first_cpu=3B env !=3D NULL=3B env =3D env->next_cpu) { err =3D cpu_watchpoint_insert(env=2C369098752=2C8=2CBP_MEM_WRITE=2CNULL= )=3B if (err) printf("\n Got an error while inserting watchpoint")=3B } qemu_add_vm_change_state_handler(myfunc=2CNULL)=3B } This function gets called and does not return error=2C but when I run my ap= plication it gives me following error of segmentation fault: VNC server running on `127.0.0.1:5900' Program received signal SIGSEGV=2C Segmentation fault. [Switching to Thread -1208740160 (LWP 1912)] gdb_set_stop_cpu (env=3D0x9ef36a0) at /usr/QEMU_Learning/QEMU_Src/qemu-0.12= .3/gdbstub.c:2114 2114 gdbserver_state->c_cpu =3D env=3B (gdb) p env $1 =3D (struct CPUARMState *) 0x9ef36a0 (gdb) p gdbserver_state->c_cpu Cannot access memory at address 0x0 Can anybody tell me whats wrong with this? Thanks=2C Taimoor =20 _________________________________________________________________ Hotmail: Trusted email with Microsoft=92s powerful SPAM protection. https://signup.live.com/signup.aspx?id=3D60969= --_cafa6acc-c7df-4d98-b573-4e06a3e21f44_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi all=2C

I've developed an application for ARM intergrator and it i= s running find under QEMU. I am trying to redirect my serial data to my cus= tom emulated device. For that I've inserted memory watch point at Pl011 UAR= T =3B controllers Data Register so that whenever some access is made to= this register my registered function gets invoked which will redirect requ= est to my custom emulated device.

I've few questions:
  1. cpu= _watchpoint_insert needs a CPU_State parameter. From where can I get this C= PU state.
  2. I tried putting code in vl.c and called my custom_init fu= nction from main before main_loop(). Below is source code of my custom_init= function:

static void custom_init()
{
 =3B =3B&= nbsp=3B CPUState *env=3B
 =3B =3B =3B int err =3D 0=3B
 =3B =3B =3B for (env =3D first_cpu=3B env !=3D NULL=3B env = =3D env->=3Bnext_cpu) {
 =3B =3B =3B err =3D cpu_watchpoin= t_insert(env=2C369098752=2C8=2CBP_MEM_WRITE=2CNULL)=3B
 =3B =3B&= nbsp=3B if (err)
 =3B =3B =3B =3B =3B =3B = =3B =3B =3B =3B printf("\n Got an error while inserting watchpo= int")=3B
 =3B =3B =3B }
 =3B =3B =3B qemu_add= _vm_change_state_handler(myfunc=2CNULL)=3B

}

This function ge= ts called and does not return error=2C but when I run my application it giv= es me following error of segmentation fault:

VNC server running on `= 127.0.0.1:5900'

Program received signal SIGSEGV=2C Segmentation faul= t.
[Switching to Thread -1208740160 (LWP 1912)]
gdb_set_stop_cpu (env= =3D0x9ef36a0) at /usr/QEMU_Learning/QEMU_Src/qemu-0.12.3/gdbstub.c:2114
= 2114 =3B =3B =3B =3B =3B =3B =3B gdbserver_stat= e->=3Bc_cpu =3D env=3B
(gdb) p env
$1 =3D (struct CPUARMState *) 0x= 9ef36a0
(gdb) p gdbserver_state->=3Bc_cpu
Cannot access memory at a= ddress 0x0

Can anybody tell me whats wrong with this?

Thanks= =2C
Taimoor


Hotmail: Trusted email with Micro= soft=92s powerful SPAM protection. Sign up now. = --_cafa6acc-c7df-4d98-b573-4e06a3e21f44_--