<p>Jérémy Compostella has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20524">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libpayload: memset should support unaligned pointer<br><br>The optimization of the memset() function introduced by commit<br>dbadb1dd634c8c9419215ade0666a7fb69a4447b is provoking an issue on x86<br>platform when compile without the CONFIG_GPL option.<br><br>GCC is making use of the movdqa instruction to copy words.  This<br>instruction can raise a "General Protection Fault Exception" when it<br>is called on a non-aligned address argument.<br><br>Change-Id: I73382a76a4399d8e78244867f2ebb1dca176a6bf<br>Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com><br>---<br>M payloads/libpayload/libc/memory.c<br>1 file changed, 5 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/20524/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c<br>index ae476cf..cb56802 100644<br>--- a/payloads/libpayload/libc/memory.c<br>+++ b/payloads/libpayload/libc/memory.c<br>@@ -38,6 +38,11 @@<br>    size_t i;<br>     void *ret = s;<br>        unsigned long w = c & 0xff;<br>+      u8 *p = (u8 *)s;<br>+<br>+  s = (void *)ALIGN_UP((unsigned long)s, sizeof(unsigned long));<br>+       while (p < s && n--)<br>+              *p++ = c;<br> <br>  for (i = 1; i < sizeof(unsigned long); i <<= 1)<br>              w = (w << (i * 8)) | w;<br></pre><p>To view, visit <a href="https://review.coreboot.org/20524">change 20524</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20524"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I73382a76a4399d8e78244867f2ebb1dca176a6bf </div>
<div style="display:none"> Gerrit-Change-Number: 20524 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jérémy Compostella <jeremy.compostella@gmail.com> </div>