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

ARM BE8 mode #785

Closed
zachriggle opened this issue Mar 17, 2017 · 8 comments
Closed

ARM BE8 mode #785

zachriggle opened this issue Mar 17, 2017 · 8 comments

Comments

@zachriggle
Copy link
Contributor

The ARM spec was written by people who hit their head too many times, and includes a "be8" mode in addition to traditional "big" and "little" endiannesses. Specifically, BE8 uses little-endian instructions and big-endian data memory.

If it helps any, qemu-user supports this mode. ARMv7 either added or removed support for traditional BE32, in favor of BE8, so it's recent and relevant. The current GCC for Ubuntu targeting ARMBE will emit BE8 binaries.

@aquynh
Copy link
Member

aquynh commented Mar 17, 2017

@xizhizhang, what do you think?

@aquynh
Copy link
Member

aquynh commented Mar 17, 2017

@zachriggle
Copy link
Contributor Author

zachriggle commented Mar 17, 2017 via email

@aquynh
Copy link
Member

aquynh commented Mar 17, 2017

if the patch you provided above is enough, that is not a lot of work to port over. can you do that?

@xizhizhang
Copy link
Contributor

It seems qemu have already commit BE8's in 2012:
qemu/qemu@d8fd295
so, is also in unicorn too.

BE-32(traditional big endian) is supported by ARM cores up to the ARM11 family (v6) (for example ARM7TDMI, ARM926EJ-S, ARM1136JF-S). BE-8 is supported by the ARM11 family and later (for example ARM1136JF-S, Cortex-R4, Cortex-A8). ARMv7 and ARMv8 cores do not support BE-32.

And, gcc toolchain already choose --be8 as the default link option.

I have just test a BE8 style THUMB2 code in big endian example.
\xf0\x4f\x00\x37\xeb\xa2\x01\x03
Above binary means "mov r0, #0x37; sub r1, r2, r3". and it works correctly.

If there are some bugs in ARM big endian mode's implementation, I would like to try to fix it.

Thanks~

@zachriggle
Copy link
Contributor Author

@aquynh That's the patch that adds support for QEMU. The code is all there already, support just needs to be added to Unicorn.

@aquynh
Copy link
Member

aquynh commented Mar 21, 2017

Zach, can you send a testcase for this?

@yekscorp
Copy link

yekscorp commented Feb 6, 2019

I just ran into this problem with a binary I am working with. Is there a plan to add a flag to enable this mode in unicorn?

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

5 participants