cbmem: Terminate the cbmem console at the cursor position.
If the cbmem console buffer isn't zero filled before it's used, there won't be a terminator at the end. We need to put one at the cursor position manually. Change-Id: I69870c2b24b67ce3cbcd402b62f3574acb4c2a8f Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/65300 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org> (cherry picked from commit 8ec61e52a6a27ed518d0abb5a19d6261edf9dab1) Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6404 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
0dd5e4395e
commit
06b13a37f0
|
@ -472,8 +472,8 @@ static void dump_console(void)
|
||||||
* char console[size]
|
* char console[size]
|
||||||
* Hence we have to add 8 to get to the actual console string.
|
* Hence we have to add 8 to get to the actual console string.
|
||||||
*/
|
*/
|
||||||
size = *(uint32_t *)console_p;
|
size = ((uint32_t *)console_p)[0];
|
||||||
cursor = *(uint32_t *) (console_p + 4);
|
cursor = ((uint32_t *)console_p)[1];
|
||||||
/* Cursor continues to go on even after no more data fits in
|
/* Cursor continues to go on even after no more data fits in
|
||||||
* the buffer but the data is dropped in this case.
|
* the buffer but the data is dropped in this case.
|
||||||
*/
|
*/
|
||||||
|
@ -489,6 +489,7 @@ static void dump_console(void)
|
||||||
size + sizeof(size) + sizeof(cursor));
|
size + sizeof(size) + sizeof(cursor));
|
||||||
memcpy(console_c, console_p + 8, size);
|
memcpy(console_c, console_p + 8, size);
|
||||||
console_c[size] = 0;
|
console_c[size] = 0;
|
||||||
|
console_c[cursor] = 0;
|
||||||
|
|
||||||
printf("%s\n", console_c);
|
printf("%s\n", console_c);
|
||||||
if (size < cursor)
|
if (size < cursor)
|
||||||
|
|
Loading…
Reference in New Issue