arm: smh: Make semihosting trap calls more robust
authorAndre Przywara <andre.przywara@arm.com>
Wed, 5 Oct 2022 16:38:48 +0000 (17:38 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 2 Nov 2022 17:31:40 +0000 (13:31 -0400)
commitd660a82934fdb8ab23a789d1e53ac34825e9f7c7
tree59395e012cf6f889e82ddfba43f0bed98d648d0a
parent30b315b48da38a704896f550771cdebf9d619413
arm: smh: Make semihosting trap calls more robust

Commit f4b540e25c5c("arm: smh: Fix uninitialized parameters with newer
GCCs") added a memory clobber to the semihosting inline assembly trap
calls, to avoid too eager GCC optimisation: when passing a pointer, newer
compilers couldn't be bothered to actually fill in the structure that it
pointed to, as this data would seemingly never be used (at least from the
compiler's point of view).
But instead of the memory clobber we need to tell the compiler that we are
passing an *array* instead of some generic pointer, this forces the
compiler to actually populate the data structure.
This involves some rather hideous cast, which is best hidden in a macro.

But regardless of that, we actually need the memory clobber, but for two
different reasons: explain them in comments.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/lib/semihosting.c