coreboot-kgpe-d16/payloads/libpayload/libc
Julius Werner dbadb1dd63 libpayload: Reorder default memcpy, speed up memset and memcmp
The current default memcpy first copies single bytes to align the
amount, then copies the rest as full words. In practice, the start of a
buffer is much more likely to be word-aligned then the end, and aligned
word access are usually more efficient. This patch reorders those
accesses to first copy as many full words as possible and then finish
the rest with byte accesses to optimize this common case.

This fixes a data abort when using USB on ARM without CONFIG_GPL. Due to
some limitations of how DMA memory is set up in coreboot on ARM, it
currently does not support unaligned accesses. (This could be fixed with
a more complicated patch, but it's usually not an issue... unless, of
course, your memcpy happens to be braindead).

Also add word-aligned accesses to memset and memcmp while I'm at it, and
make memcmp's return value standard's compliant.

BUG=chrome-os-partner:24957
TEST=Manual

Original-Change-Id: I2a7bcb35626a05a9a43fcfd99eb958b485d7622a
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/203547
Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
(cherry picked from commit 05a64d2e107e1675cc3442e6dabe14a341e55673)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>

Change-Id: I0030ca8a203c97587b0da31a0a5e9e11b0be050f
Reviewed-on: http://review.coreboot.org/8126
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-01-09 07:08:43 +01:00
..
Makefile.inc libpayload: Add a new "die" function to fatally signal programming errors. 2014-09-15 17:37:13 +02:00
args.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
console.c libpayload: Add ability to unregister output driver 2015-01-09 07:04:58 +01:00
ctype.c fix typo in ctype.c 2008-08-19 16:53:47 +00:00
die.c libpayload: Add a new "die" function to fatally signal programming errors. 2014-09-15 17:37:13 +02:00
exec.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
getopt_long.c Reduce warnings/errors in libpayload when using picky compiler options 2011-06-30 20:41:23 +02:00
hexdump.c libpayload: hexdump: Use `p` as conversion specifier for pointers 2014-12-19 21:15:05 +01:00
ipchecksum.c trivial fix: ipchksum takes an unspecified input blob, not explicitly a number of shorts. 2008-08-16 15:16:36 +00:00
lar.c Refactor the endianness conversion functions and header files. 2012-11-08 19:49:51 +01:00
lib.c libpayload: Provide dummy getenv() 2011-07-20 10:02:19 +02:00
malloc.c libpayload: Fix pointer related casts 2014-12-31 18:57:35 +01:00
memory.c libpayload: Reorder default memcpy, speed up memset and memcmp 2015-01-09 07:08:43 +01:00
printf.c libpayload: fix printf handling of unsigned long long 2014-12-30 20:54:23 +01:00
qsort.c libpayload: Fix whitespace errors 2013-06-27 14:46:43 +02:00
rand.c Add rand/rand_r/srand functions for generating pseudo-random bytes. 2008-04-07 23:33:50 +00:00
readline.c Catch various cases in libpayload where malloc() or memalign() return NULL 2009-07-31 11:39:55 +00:00
string.c libpayload: Add strerror 2013-06-28 10:39:57 +02:00
strings.c Reduce warnings/errors in libpayload when using picky compiler options 2011-06-30 20:41:23 +02:00
strlcpy.c libpayload: Implement strlcpy 2011-07-07 22:29:35 +02:00
sysinfo.c Reduce warnings/errors in libpayload when using picky compiler options 2011-06-30 20:41:23 +02:00
time.c libpayload: Add a timer_us() function. 2014-09-15 19:01:03 +02:00