diff options
author | Gabe Black <gabeblack@google.com> | 2013-08-09 00:40:06 -0700 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2014-07-30 11:49:45 +0200 |
commit | 06b13a37f0f4b3545b899e3488762b3ed9c20812 (patch) | |
tree | 188fba84c5f5aebfc552abe6d7332f989147ceba | |
parent | 0dd5e4395e805e3d54b31f3eaf8b432af5bad5e2 (diff) | |
download | coreboot-06b13a37f0f4b3545b899e3488762b3ed9c20812.tar.xz |
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>
-rw-r--r-- | util/cbmem/cbmem.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index fabede32c4..4dcfe91ad1 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) |