[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-discuss] Does Anyone Know What The x86_64 Magic and Mask Are (
Re: [Qemu-discuss] Does Anyone Know What The x86_64 Magic and Mask Are (For binfmt_misc)?
Wed, 1 Aug 2018 11:03:31 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
On 07/28/2018 06:29 PM, Tom A wrote:
> Hello Everyone,
> Hopefully, I am posting in the right place. I normally don't use a mailing
> list. Anyway, I was wondering if anyone here knows what the magic and mask
> values are for an x86_64 Linux binary file.
> My goal is to run a chroot x86_64 environment on my aarch64 device. I can
> use binfmt_misc to achieve my goal, but I need to know what the magic and
> mask values are so that Linux knows the type of binary files should be
> executed with qemu-x86_64-static.
The magic values are the first bytes of the ELF file that have to match,
and the mask is, well, the mask value that is ANDed with the values from
the ELF file before the comparison is done.
Have a look at one of the various ELF specs, e.g.
http://www.cs.cmu.edu/afs/cs/academic/class/15213-s00/doc/elf.pdf - I
think the value you are looking for is the EI_CLASS field which comes
right after the "\x7fELF" identifier.
> I took a look at the qemu-binfmt-conf.sh
> <https://github.com/qemu/qemu/blob/master/scripts/qemu-binfmt-conf.sh>, but
> it only gives the values for i386 and i486 binary files.
I'm a little bit surprised that we do not have an entry for x86_64 there
yet. Maybe Laurent or Riku know why it is not there yet...
- Re: [Qemu-discuss] Does Anyone Know What The x86_64 Magic and Mask Are (For binfmt_misc)?,
Thomas Huth <=