qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-arm] Patch for ARM memory barriers and getdent


From: Henry Wertz
Subject: [Qemu-arm] Patch for ARM memory barriers and getdent
Date: Mon, 16 Apr 2018 13:44:52 -0500

Please find submitted a patch for ARM memory barriers.  This patch is against qemu-2.12-rc2 but I do believe it should apply for anything from 2.11.x to current.

I found with qemu 2.11.x or newer that I would get an illegal instruction error running some Intel binaries on my ARM chromebook.  On investigation, I found it was quitting on memory barriers.
qemu instruction:
mb $0x31
was translating as:
0x604050cc:  5bf07ff5  blpl     #0x600250a8

After patch it gives:
0x604050cc:  f57ff05b  dmb      ish

In short, I found INSN_DMB_ISH (memory barrier for ARMv7) appeared to be correct based on online docs, but due to some endian-related shenanigans it had to be byte-swapped to suit qemu; it appears INSN_DMB_MCR (memory barrier for ARMv6) also should be byte swapped  (and this patch does so).  I have not checked for correctness of aarch64's barrier instruction.
-------------------------------
Please find submitted a patch for getdents (this system call stands for "get directory entries", it is passed a file descriptor pointing to a directory and returns a struct with info on the entries in that directory.)  This patch is against qemu-2.10 series but continues to apply cleanly on current as of April 15 2018.  If you are running a 32-bit binary on 64-bit target current qemu will convert he getdents struct, but it will NOT in the case of 64-bit binary on 32-bit host.  (In my case, I had android SDK's "aapt" for x86-64 error out on 32-bit ARM without this patch, and run fine with it.)  This patch simply replaces a "#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64" with "#if TARGET_ABI_BITS != HOST_LONG_BITS".

Thanks!

Attachment: arm-mb.patch
Description: Text Data

Attachment: qemu-getdents.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]