[coreboot] Could I replace memmove function?

Andrew Wu andrewwu.tw at gmail.com
Thu Aug 15 14:01:14 CEST 2013

Hi, I am developing coreboot on DMP/Vortex86EX board. I found recent
updated coreboot
source code made it boots slower on my board. That is because:

>From commit c6b44162f5cccd72e9b4d9dbf071911249971846, src/lib/cbfs_core.c uses
memmove instead of memcpy to load uncompressed ramstage. memmove function
is in src/arch/x86/lib/memmove.c, which is from memcpy_32.c in the Linux kernel.
You can see:


But this memmove seems over-optimized, it will only use x86 REP MOVSL
instruction if memory
is 256-byte aligned, otherwise it will failback to use slower MOV
loop. MOV loop is much slower then
REP MOVSL on Vortex86EX, because reading instructions from ROM is slow.

How could I avoid this? I can:

1. Modify src/arch/x86/lib/memmove.c, to use another implementation.
But it will interfere other module that uses memmove. I used grep to
search memmove calls, only src/lib/cbfs_core.c and src/lib/gcov-io.c
uses memmove.

In fact I tried to use memmove from older Linux kernel, which always
use REP MOVS and runs much better on my hardware. See :


2. Write my own memmove module, and link this module only when
building Vortex86EX target. But it seems current Makefile doesn't
support this mechanism, I can only link either src/lib/mommove.c or
src/arch/x86/lib/memmove.c, no third option.

Any suggestion? :)

More information about the coreboot mailing list