Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonsensical disassembly of ARMv8 instructions #1578

Closed
noloader opened this issue Jul 27, 2016 · 1 comment
Closed

Nonsensical disassembly of ARMv8 instructions #1578

noloader opened this issue Jul 27, 2016 · 1 comment

Comments

@noloader
Copy link

Raspberry Pi 3 uses an ARMv8 processor. The machine can consume ARMv8 instructions, even though an ARMv7-based OS is provided. The sample program below with hand crafted ARMv8 instructions executes successfully.

However, disassembling fails:

$ gcc -g3 -O0 -march=armv7-a -mfpu=neon test.cc -c
$ objdump -d test.o

test.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:   e52db004    push    {fp}        ; (str fp, [sp, #-4]!)
   4:   e28db000    add fp, sp, #0
   8:   e24dd00c    sub sp, sp, #12
   c:   e50b0008    str r0, [fp, #-8]
  10:   e50b100c    str r1, [fp, #-12]
  14:   0058c11a    .word   0x0058c11a
  18:   0054c11a    .word   0x0054c11a
  1c:   0050c11a    .word   0x0050c11a
  20:   00e0e10e    .word   0x00e0e10e
  24:   00e0e14e    .word   0x00e0e14e
  28:   2048284e    .word   0x2048284e
  2c:   2058284e    .word   0x2058284e
  30:   2000025e    .word   0x2000025e
  34:   2020025e    .word   0x2020025e
  38:   2030025e    .word   0x2030025e
  3c:   e3a03000    mov r3, #0
  40:   e1a00003    mov r0, r3
  44:   e24bd000    sub sp, fp, #0
  48:   e49db004    pop {fp}        ; (ldr fp, [sp], #4)
  4c:   e12fff1e    bx  lr

This can be compiled with gcc -g3 -O0 -march=armv7-a -mfpu=neon test.cc.

$ cat test.cc
#include <arm_neon.h>
int main(int argc, char* argv[])
{
  __asm__ __volatile__
    (
     ".code 32"

     // CRC using word
     ".byte 0x1a, 0xc1, 0x58, 0x00;\n"
     // CRC using half word
     ".byte 0x1a, 0xc1, 0x54, 0x00;\n"
     // CRC using byte
     ".byte 0x1a, 0xc1, 0x50, 0x00;\n"
     // PMULL
     ".byte 0x0e, 0xe1, 0xe0, 0x00;\n"
     // PMULL2
     ".byte 0x4e, 0xe1, 0xe0, 0x00;\n"
     // AES (aese)
     ".byte 0x4e, 0x28, 0x48, 0x20;\n"
     // AES (aesd)
     ".byte 0x4e, 0x28, 0x58, 0x20;\n"
     // SHA1 (sha1c)
     ".byte 0x5e, 0x02, 0x00, 0x20;\n"
     // SHA1 (sha1m)
     ".byte 0x5e, 0x02, 0x20, 0x20;\n"
     // SHA1 (sha1p)
     ".byte 0x5e, 0x02, 0x30, 0x20;\n"
     :
     :
     : "cc", "d0", "d1", "d2", "q0", "q1", "q2"
    );

  return 0;
}
@noloader
Copy link
Author

I'm going to close this. The toolchain has bigger problems than disassemblies. Its not worth the dev cycles at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant