* [Qemu-devel] Inserting Memory Watch points
@ 2010-04-19 6:11 Taimoor Mirza
2010-04-19 13:06 ` Nathan Froyd
0 siblings, 1 reply; 2+ messages in thread
From: Taimoor Mirza @ 2010-04-19 6:11 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]
Hi all,
I've developed an application for ARM intergrator and it is running find under QEMU. I am trying to redirect my serial data to my custom emulated device. For that I've inserted memory watch point at Pl011 UART controllers Data Register so that whenever some access is made to this register my registered function gets invoked which will redirect request to my custom emulated device.
I've few questions:
cpu_watchpoint_insert needs a CPU_State parameter. From where can I get this 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 function:
static void custom_init()
{
CPUState *env;
int err = 0;
for (env = first_cpu; env != NULL; env = env->next_cpu) {
err = cpu_watchpoint_insert(env,369098752,8,BP_MEM_WRITE,NULL);
if (err)
printf("\n Got an error while inserting watchpoint");
}
qemu_add_vm_change_state_handler(myfunc,NULL);
}
This function gets called and does not return error, but when I run my application it gives me following error of segmentation fault:
VNC server running on `127.0.0.1:5900'
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208740160 (LWP 1912)]
gdb_set_stop_cpu (env=0x9ef36a0) at /usr/QEMU_Learning/QEMU_Src/qemu-0.12.3/gdbstub.c:2114
2114 gdbserver_state->c_cpu = env;
(gdb) p env
$1 = (struct CPUARMState *) 0x9ef36a0
(gdb) p gdbserver_state->c_cpu
Cannot access memory at address 0x0
Can anybody tell me whats wrong with this?
Thanks,
Taimoor
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
[-- Attachment #2: Type: text/html, Size: 2280 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] Inserting Memory Watch points
2010-04-19 6:11 [Qemu-devel] Inserting Memory Watch points Taimoor Mirza
@ 2010-04-19 13:06 ` Nathan Froyd
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Froyd @ 2010-04-19 13:06 UTC (permalink / raw)
To: Taimoor Mirza; +Cc: qemu-devel
On Mon, Apr 19, 2010 at 12:11:46PM +0600, Taimoor Mirza wrote:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1208740160 (LWP 1912)]
> gdb_set_stop_cpu (env=0x9ef36a0) at /usr/QEMU_Learning/QEMU_Src/qemu-0.12.3/gdbstub.c:2114
> 2114 gdbserver_state->c_cpu = env;
> (gdb) p env
> $1 = (struct CPUARMState *) 0x9ef36a0
> (gdb) p gdbserver_state->c_cpu
> Cannot access memory at address 0x0
>
> Can anybody tell me whats wrong with this?
gdbserver_state is NULL. You need to start QEMU with the -gdb switch
and connect to it via GDB for cpu_watchpoint_insert to work.
-Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-19 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-19 6:11 [Qemu-devel] Inserting Memory Watch points Taimoor Mirza
2010-04-19 13:06 ` Nathan Froyd
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).