diff options
author | Mikulas Patocka <mikulas@twibright.com> | 2018-11-20 08:41:14 -0800 |
---|---|---|
committer | Kevin Brace <kevinbrace@gmx.com> | 2018-11-21 13:51:54 -0800 |
commit | a939aa56b3af4418d0c026a3775fde7288b0cca7 (patch) | |
tree | 7893afa6a877dcccf0e80ea239c1fdb80e91c553 /.gitignore | |
parent | 0f4883f0b8ebfd105d5cee93841bc69f0f2b60b7 (diff) |
mga_drv: fix image corruption due to memcpy reordering
The memcpy specification doesn't specify how the destination is written -
and on glibc 2.19 memcpy is doing some bytewise writes with the rep stosb
instruction. These bytewise writes confuse the hardware (because it
expects 32-bit writes) and result in image corruption.
This patch replaces memcpy with explicit writes, so that the sequential
write order and 32-bit write size is guaranteed. We use the "volatile"
attribute to make sure that compiler optimizations won't cause write
reordering. When reading the memory, we use a structure with "packed"
attribute to avoid unaligned traps on RISC machines.
Tested-by: Kevin Brace <kevinbrace@gmx.com>
Signed-off-by: Mikulas Patocka <mikulas@twibright.com>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions