[PATCH 2/2] riscv: semihosting: replace inline assembly with assembly file
Tom Rini
trini at konsulko.com
Tue Mar 7 18:52:18 CET 2023
On Tue, Feb 07, 2023 at 03:21:05PM +0000, Andre Przywara wrote:
> So far we used inline assembly to inject the actual instruction that
> triggers the semihosting service. While this sounds elegant, as it's
> really only about a few instructions, it has some serious downsides:
> - We need some barriers in place to force the compiler to issue writes
> to a data structure before issuing the trap instruction.
> - We need to convince the compiler to actually fill the structures that
> we use pointers to.
> - We need a memory clobber to avoid the compiler caching the data in
> those structures, when semihosting writes data back.
> - We need register arguments to make sure the function ID and the
> pointer land in the right registers.
>
> This is all doable, but fragile and somewhat cumbersome. Since we now
> have a separate function in an extra file anyway, we can do away with
> all the magic and just write that in an actual assembler.
> This is much more readable and robust.
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> Reviewed-by: Sean Anderson <sean.anderson at seco.com>
After correcting the style on the SPDX header of the new .S file,
applied to u-boot/next, 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/20230307/bd2bda2b/attachment.sig>
More information about the U-Boot
mailing list