On 31 Mar 2023, at 2:29 AM, Kang-Che Sung <explore...@gmail.com> wrote: > On Fri, Mar 31, 2023 at 12:34 AM <ben.busy...@backplane.be> wrote: >> shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */ >> >> Seems a lot more complicated than intel's approach: >> >> shaNI = ((ebx >> 29) & 1); > The `shaNI` variable is not a boolean, but has three possible values: > 0 (undetermined), 1 (SHA instructions supported), -1 (not supported) > That's why the slightly complicated logic. > > By the way, the `shaNI` name is a misnomer, as Intel never uses "NI" > to refer to their SHA instruction set, unlike the AES instruction set.
Thanks I did miss that. I can now see that this approach prevents cpuid from being called on every invocation of the sha1 & sha256 functions -- which would happen with my patch on systems that don't have the SHA extensions. _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox