Re: [PATCH 2/2] RISC-V: make use of variadic sbi_ecall
From: Radim Krčmář
Date: Fri Jun 13 2025 - 13:08:41 EST
2025-06-13T16:52:26+01:00, David Laight <david.laight.linux@xxxxxxxxx>:
> On Fri, 13 Jun 2025 16:10:52 +0200
> Radim Krčmář <rkrcmar@xxxxxxxxxxxxxxxx> wrote:
>
> ...
>> The macro will result in the same arguments as before, and it is what
>> the sbi_ecall actually should do.
>
> Ugg...
> Are you using pre-processor 'magic' to add a pile of zeros and then
> select the first 'n' arguments?
Sadly, yes. The zeros should have never been introduced in the code, so
I'm hiding them for the moment.
I planned to remove the useless zeros in future patches.
> That ought to be banned as error prone.
Sounds reasonable to me. I will try to fix the insane tracepoint bloat,
and send a v2 that fills only the correct amount of registers for the
ecall instruction.
> I think the one for strncpy() removes the immediate compile error for:
> strncpy(dest, src, 1, 2);
I would have preferred if sbi.h had a wrapper function for each SBI
function, and we never allowed direct invocation of the ecall
instruction outside of the library.