[PATCH] devmem: add 128-bit width

Denys Vlasenko vda.linux at googlemail.com
Fri Aug 26 15:25:22 UTC 2022


On Thu, Aug 25, 2022 at 5:55 PM Aaro Koskinen <aaro.koskinen at iki.fi> wrote:
>
> From: Aaro Koskinen <aaro.koskinen at nokia.com>
>
> Add 128-bit width if the compiler provides the needed type.
>
> function                                             old     new   delta
> devmem_main                                          412     517    +105
> usage_messages                                       247     313     +66
> .rodata                                             3553    3571     +18
> ------------------------------------------------------------------------------
> (add/remove: 2/0 grow/shrink: 3/0 up/down: 189/0)             Total: 189 bytes
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen at nokia.com>
> Signed-off-by: Aaro Koskinen <aaro.koskinen at iki.fi>
> ---
>  miscutils/devmem.c | 113 +++++++++++++++++++++++++++------------------
>  1 file changed, 69 insertions(+), 44 deletions(-)
>
> diff --git a/miscutils/devmem.c b/miscutils/devmem.c
> index f9f0276bc..a6991886a 100644
> --- a/miscutils/devmem.c
> +++ b/miscutils/devmem.c
> @@ -15,12 +15,15 @@
>  //kbuild:lib-$(CONFIG_DEVMEM) += devmem.o
>
>  //usage:#define devmem_trivial_usage
> -//usage:       "ADDRESS [WIDTH [VALUE]]"
> +//usage:       "ADDRESS [WIDTH [VALUE]...]"
>  //usage:#define devmem_full_usage "\n\n"
>  //usage:       "Read/write from physical address\n"
>  //usage:     "\n       ADDRESS Address to act upon"
>  //usage:     "\n       WIDTH   Width (8/16/...)"
>  //usage:     "\n       VALUE   Data to be written"
> +#ifdef __SIZEOF_INT128__
> +//usage:     "\n               For 128-bit data, provide 64-bit values (LOW, or HI and LOW)"
> +#endif

Let's use strtoumax() to parse a long number, instead of making user
jump through such hoops.

Applied, thank you.

Is there a need to make these 128 reads actually this wide as one atomic load?
(On x86, SSE insn do that).


More information about the busybox mailing list