All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christopher Covington <cov@codeaurora.org>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] AArch64 ELF File Loading
Date: Fri, 25 Jul 2014 10:01:17 -0400	[thread overview]
Message-ID: <53D2632D.4070700@codeaurora.org> (raw)

Hi,

I think the AArch64 port has a problem with a self-modifying code sequence
that appears to run fine on other simulators, but I can't get QEMU to run the
small bare metal test case I created to try to reproduce the issue. Any help
would be appreciated.

qemu-system-aarch64 -nodefaults -nographic -monitor none -M virt -semihosting
-d exec,in_asm /tmp/test-nooverwrite 2>&1 | less

qemu: fatal: Trying to execute code outside RAM or ROM at 0x0000000000000000

qemu-system-aarch64 -nodefaults -nographic -monitor none -M virt -semihosting
-d exec,in_asm -bios /tmp/test-nooverwrite 2>&1 | less

qemu: fatal: Trying to execute code outside RAM or ROM at 0x0000000000000000

qemu-system-aarch64 -nodefaults -nographic -monitor none -M virt -semihosting
-d exec,in_asm -kernel /tmp/test-nooverwrite 2>&1 | less

IN:
0x0000000040000000:  e3a00000      mov  r0, #0  ; 0x0
0x0000000040000004:  e59f1004      ldr  r1, [pc, #4]    ; 0x40000010
0x0000000040000008:  e59f2004      ldr  r2, [pc, #4]    ; 0x40000014
0x000000004000000c:  e59ff004      ldr  pc, [pc, #4]    ; 0x40000018

Trace 0x7f309f012000 [0000000040000000]

Note that the above are A32 instructions, but my ELF is A64 and this is not
the specified entry point.

aarch64-linux-gnu-readelf -h /tmp/test-nooverwrite
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x80001140
  Start of program headers:          64 (bytes into file)
  Start of section headers:          186600 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         3
  Size of section headers:           64 (bytes)
  Number of section headers:         17
  Section header string table index: 14

To generate a test bare metal executable, you can download the
aarch64-none-elf toolchain from Linaro and:

echo '#include <stdio.h>

int main() {
  printf("Hello, world!\n");
  return 0;
}' > hello.c

aarch64-none-elf-gcc -specs=aem-ve.specs hello.c -o hello

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

             reply	other threads:[~2014-07-25 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 14:01 Christopher Covington [this message]
2014-07-25 14:07 ` [Qemu-devel] AArch64 ELF File Loading Peter Maydell
2014-07-25 14:35   ` Christopher Covington
2014-07-25 14:41     ` Peter Maydell
2014-07-25 15:05       ` Christopher Covington
2014-07-25 15:17         ` Peter Maydell

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=53D2632D.4070700@codeaurora.org \
    --to=cov@codeaurora.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.