arm: semihosting: replace inline assembly with assembly file
authorAndre Przywara <andre.przywara@arm.com>
Tue, 7 Feb 2023 15:21:04 +0000 (15:21 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 6 Mar 2023 22:06:17 +0000 (17:06 -0500)
commit29c579a2493a1c5de162a724e05521099b66bedb
tree31253a89c1aefa3ecc684adfe364ca03e86f0002
parent885198536dcb33e15be8259a326161e5e04a832c
arm: semihosting: replace inline assembly with assembly file

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 one instruction, 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 assembly file.
This is much more readable and robust.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
arch/arm/lib/semihosting.S [new file with mode: 0644]
arch/arm/lib/semihosting.c [deleted file]