[coreboot-gerrit] New patch to review for coreboot: 9be6652 cbmem: Terminate the cbmem console at the cursor position.
Isaac Christensen (isaac.christensen@se-eng.com)
gerrit at coreboot.org
Tue Jul 29 19:25:05 CEST 2014
Isaac Christensen (isaac.christensen at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6404
-gerrit
commit 9be6652481253d469162c577b50df8aedce71128
Author: Gabe Black <gabeblack at google.com>
Date: Fri Aug 9 00:40:06 2013 -0700
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 at google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/65300
Reviewed-by: Hung-Te Lin <hungte at chromium.org>
Commit-Queue: Gabe Black <gabeblack at chromium.org>
Tested-by: Gabe Black <gabeblack at chromium.org>
(cherry picked from commit 8ec61e52a6a27ed518d0abb5a19d6261edf9dab1)
Signed-off-by: Isaac Christensen <isaac.christensen at se-eng.com>
---
util/cbmem/cbmem.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index fabede3..4dcfe91 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -472,8 +472,8 @@ static void dump_console(void)
* char console[size]
* Hence we have to add 8 to get to the actual console string.
*/
- size = *(uint32_t *)console_p;
- cursor = *(uint32_t *) (console_p + 4);
+ size = ((uint32_t *)console_p)[0];
+ cursor = ((uint32_t *)console_p)[1];
/* Cursor continues to go on even after no more data fits in
* the buffer but the data is dropped in this case.
*/
@@ -489,6 +489,7 @@ static void dump_console(void)
size + sizeof(size) + sizeof(cursor));
memcpy(console_c, console_p + 8, size);
console_c[size] = 0;
+ console_c[cursor] = 0;
printf("%s\n", console_c);
if (size < cursor)
More information about the coreboot-gerrit
mailing list