[PATCH 2/3] arm: smh: Make semihosting trap calls more robust

Tom Rini trini at konsulko.com
Thu Nov 3 17:57:15 CET 2022


On Wed, Oct 05, 2022 at 05:38:48PM +0100, Andre Przywara wrote:

> 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 at arm.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221103/79291969/attachment.sig>


More information about the U-Boot mailing list