On 8/6/21 5:36 PM, Wolfgang Denk wrote:
Dear Stefan,
In message <20210806133843.3642916-2...@denx.de> 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:]
EFI binaries are freestanding. They cannot use any U-Boot library
function except the UEFI API exposed via the system table.
We compile EFI binaries with GCC parameter -ffreestanding. As we do not
include any GCC library it is assumed that functions like memset() are
provided by the compiled source package. This is where
efi_freestanding.c comes in.
Please, have a look at
scripts/Makefile.lib:420:
targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
where we link the efi_freestanding.o module into every EFI binary.
Best regards
Heinrich
+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