arch/x86: Fix undefined behavior

Fixes report found by undefined behavior sanitizer. Dereferencing a
pointer that is not aligned to the size of access is undefined behavior.
Switch to memcpy() for unaligned write to EBDA_LOWMEM. Change other
write16()s in setup_ebda() to memcpy() for consistency.

Change-Id: I79814bd47a14ec59d84068b11d094dc2531995d9
Signed-off-by: Ryan Salsamendi <>
Tested-by: build bot (Jenkins) <>
Reviewed-by: Aaron Durbin <>
Reviewed-by: Philippe Mathieu-Daudé <>
1 file changed