coreboot/payloads/libpayload/libc
Julius Werner 05a64d2e10 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

Change-Id: I2a7bcb35626a05a9a43fcfd99eb958b485d7622a
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/203547
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2014-06-23 19:31:18 +00: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 2014-06-11 03:30:51 +00:00
ctype.c fix typo in ctype.c 2008-08-19 16:53:47 +00:00
die.c libpayload: Fix the license in some files which were accidentally made GPL. 2014-01-11 01:36:57 +00:00
exec.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2013-08-14 17:05:33 -07: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: Fix the license header on hexdump. 2014-01-15 23:36:36 +00: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
Makefile.inc libpayload: Add a new "die" function to fatally signal programming errors. 2013-11-27 01:46:00 +00:00
malloc.c libpayload: Fix pointer related casts 2014-05-14 00:25:48 +00:00
memory.c libpayload: Reorder default memcpy, speed up memset and memcmp 2014-06-23 19:31:18 +00:00
printf.c libpayload: console: Allow output drivers to print whole strings at once 2014-04-30 10:00:35 +00:00
qsort.c libpayload: remove trailing whitespace and run dos2unix 2011-11-01 19:08:23 +01: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: Some more compatibility (for flashrom) 2011-08-17 16:26:20 +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. 2013-12-17 04:26:45 +00:00