Re: [PATCH v1 1/5] lib/string: Add memset_simple()

From
Wolfgang Denk <hidden>
Date
2021-08-06 15:36:38
Reply to
Stefan Roese, 2021-08-06
Dear Stefan,

In message [ref] you wrote:
The optimized memset() ARM64 implementation cannot be used very early
on, since caches need to be enabled for this function to work. Otherwise
an exception occurs (only printed with very early DEBUG_UART enabled).

This patch now implements a very simple memset() version, which will be
used in a few selected places in the ARM64 early boot process.
...

We have already implementations of memset() elsewhere, for example in
lib/string.c [hey, that's even the file you are modifying...], then
again in lib/efi/efi_stub.c and also in
lib/efi_loader/efi_freestanding.c - so do we really need another
implementation?

BTW: lib/efi_loader/efi_freestanding.c  looks completely useless to
me.  Can we dump this? [Adding Heinich to Cc:]

quoted hunk ↗ jump to hunk
+void *memset_simple(void *s, int c, size_t count)
+{
+	char *s8 = (char *)s;
+
+	while (count--)
+		*s8++ = c;
+
+	return s;
+}
In which way is this different from memset() as defined in the same
file (further up) with CONFIG_TINY_MEMSET enabled?  And even without
this option the memset() implementation here should work.  Or does
it not?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
: ... and it's got weird formatting - Notepad, Write, Works  3  can't
: decipher it, and it's too big to go in DOS Edit. Help!
Install an operating system. :-)                  -- Tom Christiansen
Thread (17 messages) 17 messages, 5 authors, last reply 2021-08-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help