Hey, Thanks for the reply. The instruction that is causing problem is 436: bx lr
On single stepping and logging the trace I see that the lr has been set correctly to jump back, in the beginning of the block and also the microinstructions instructions generated match the following disassembly of the elf. 290 0000042c <_init>: 291 42c: b5f8 push {r3, r4, r5, r6, r7, lr} 292 42e: bf00 nop 293 430: bcf8 pop {r3, r4, r5, r6, r7} 294 432: bc08 pop {r3} 295 434: 469e mov lr, r3 296 436: 4770 bx lr Also all the registers which are pushed to the stack, "r3, r4, r5, r6, r7, lr" are cleared to zero After bx lr, pc becomes 0, it does not find any code there thus throws a usage exception and runs Usage fault handler in a loop. What do you mean by setting up the stack? Is it done seperately? Other bx lr calls are successfully executed. Also I am not understanding where processor state values updated in qemu code. Thanks, Gauresh Rane ----- Original Message ----- From: "Peter Maydell" <peter.mayd...@linaro.org> To: "Gauresh Rane" <gdr...@cs.ucla.edu> Cc: qemu-devel@nongnu.org Sent: Friday, November 25, 2011 3:39:02 AM Subject: Re: [Qemu-devel] Problem with translating on ARM and Qemu beginner question On 25 November 2011 10:27, Gauresh Rane <gdr...@cs.ucla.edu> wrote: > I am working on developing a simulator on qemu. I am faced with a bug and I > have tried solving it for three days now with no success: > Here is my problem: > I trying to simulate LPC 1768 cortex m3 based processor on qemu. But I am > unable to get beyond the libc_init_array in the newlib. > My qemu cpu jumps to program counter 0 when on jump inside init function of > __libc_init_array of newlib. On M profile, suddenly finding yourself at address zero usually means that (1) the core tried to take an exception and (2) you didn't fill in the vector table so the address in the table for whichever exception it was was zero. Which instruction in the block is causing the problem? (If this is the first instruction where you tried to push something, has the stack pointer been set up correctly?) -- PMM