qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gauresh Rane <gdrane@cs.ucla.edu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Problem with translating on ARM and Qemu beginner question
Date: Fri, 25 Nov 2011 04:33:39 -0800 (PST)	[thread overview]
Message-ID: <bbef5b76-7f05-4da9-b468-ebf77e64dc4d@mail.cs.ucla.edu> (raw)
In-Reply-To: <CAFEAcA_fUsAv1W=OnsrjksixzsQa8zc3vGuB+NFcAH_EK64U_w@mail.gmail.com>

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.maydell@linaro.org>
To: "Gauresh Rane" <gdrane@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 <gdrane@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

  reply	other threads:[~2011-11-25 12:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <519552ce-93df-4c90-82c6-1938d72bff72@mail.cs.ucla.edu>
2011-11-25 10:27 ` [Qemu-devel] Problem with translating on ARM and Qemu beginner question Gauresh Rane
2011-11-25 11:39   ` Peter Maydell
2011-11-25 12:33     ` Gauresh Rane [this message]
2011-11-25 12:47       ` Peter Maydell
2011-11-25 13:04         ` Max Filippov
2011-11-25 14:13           ` Gauresh Rane
2011-11-25 15:35             ` Max Filippov
2011-11-25 15:40               ` Peter Maydell
2011-11-26 19:37                 ` Gauresh Rane
2011-11-26 23:31                 ` Gauresh Rane

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=bbef5b76-7f05-4da9-b468-ebf77e64dc4d@mail.cs.ucla.edu \
    --to=gdrane@cs.ucla.edu \
    --cc=peter.maydell@linaro.org \
    --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).