This is the mail archive of the
mailing list for the GCC project.
Re: Byte swapping support
- From: Andi Kleen <ak at linux dot intel dot com>
- To: Jürg Billeter <juerg dot billeter at codethink dot co dot uk>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, gcc at gcc dot gnu dot org
- Date: Wed, 13 Sep 2017 19:21:00 -0700
- Subject: Re: Byte swapping support
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org> <1524176.JWFjpHKHfN@polaris> <email@example.com>
Jürg Billeter <firstname.lastname@example.org> writes:
> I don't. The idea is to reverse scalar storage order for the whole
> userspace process and then add byte swapping to the Linux kernel when
> accessing userspace memory. This keeps userspace memory consistent
> with regards to endianness, which should lead to high compatibility
> with big-endian applications. Userspace memory access from the kernel
> always uses a small set of helper functions, which should make it
> easier to insert byte swapping at appropriate places.
I expect you'll find that it isn't that easy. There are a lot of opaque
copies that copy whole structures.
You'll need a whole compat layer, similar to 32<->64bit compat layers,
but actually doing more work because it has to handle all fields larger
than one byte, not just fields which differ in size.