Elyes Haouas has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86233?usp=email )
Change subject: soc/intel/denverton_ns: Remove unused memcpy_s function ......................................................................
soc/intel/denverton_ns: Remove unused memcpy_s function
Remove the memcpy_s function as it is not used. Additionally, the function did not return the expected values: 0: If the memory copy is successful. EINVAL: If dest or src is a null pointer, or if count is greater than RSIZE_MAX. ERANGE: If count is greater than destsz.
Change-Id: I0d32c838e94ae760907efe55ed00bab3faaaa8c5 Signed-off-by: Elyes Haouas ehaouas@noos.fr Reviewed-on: https://review.coreboot.org/c/coreboot/+/86233 Reviewed-by: Maximilian Brune maximilian.brune@9elements.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/soc/intel/denverton_ns/include/soc/soc_util.h M src/soc/intel/denverton_ns/soc_util.c 2 files changed, 0 insertions(+), 54 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Maximilian Brune: Looks good to me, approved
diff --git a/src/soc/intel/denverton_ns/include/soc/soc_util.h b/src/soc/intel/denverton_ns/include/soc/soc_util.h index 5b7a75d..d38737d 100644 --- a/src/soc/intel/denverton_ns/include/soc/soc_util.h +++ b/src/soc/intel/denverton_ns/include/soc/soc_util.h @@ -35,11 +35,6 @@ uint16_t get_pmbase(void); uint16_t get_tcobase(void);
-/* -* Secure functions. -*/ -void *memcpy_s(void *dest, const void *src, size_t n); - void mmio_andthenor32(void *addr, uint32_t val2and, uint32_t val2or); uint8_t silicon_stepping(void);
diff --git a/src/soc/intel/denverton_ns/soc_util.c b/src/soc/intel/denverton_ns/soc_util.c index dbe924b..22e9471 100644 --- a/src/soc/intel/denverton_ns/soc_util.c +++ b/src/soc/intel/denverton_ns/soc_util.c @@ -238,52 +238,3 @@
return revision_id; } - -void *memcpy_s(void *dest, const void *src, size_t n) -{ - uint8_t *dp; - const uint8_t *sp; - - dp = (uint8_t *)dest; - sp = (uint8_t *)src; - - if (!n) - return dest; - - if (n > UINT32_MAX) - return dest; - - if (!dp) - return dest; - - if (!sp) - return dest; - - /* - * overlap is undefined behavior, do not allow - */ - if (((dp > sp) && (dp < (sp + n))) || ((sp > dp) && (sp < (dp + n)))) - return dest; - - /* - * now perform the copy - */ - - /* Original memcpy() function */ - unsigned long d0, d1, d2; - - asm volatile( -#if ENV_X86_64 - "rep ; movsd\n\t" - "mov %4,%%rcx\n\t" -#else - "rep ; movsl\n\t" - "movl %4,%%ecx\n\t" -#endif - "rep ; movsb\n\t" - : "=&c"(d0), "=&D"(d1), "=&S"(d2) - : "0"(n >> 2), "g"(n & 3), "1"(dest), "2"(src) - : "memory"); - - return dest; -}