summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2008-04-04 16:49:09 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-04-04 16:49:09 +0000
commit6c44dfb6497941cf844feef79aafec23f32635b2 (patch)
treed8f69ed80035031798a167dddaebde7ac092cc2c /payloads
parent4afb7fb761ee49595f25de66093bc021cbdfae16 (diff)
downloadcoreboot-6c44dfb6497941cf844feef79aafec23f32635b2.tar.xz
Fix the case where the user selects no modules in Kconfig at all.
Until now, the build would break, and even if it didn't the ELF would triple-fault in QEMU. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3216 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads')
-rw-r--r--payloads/coreinfo/coreinfo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c
index a683c8796a..40c4d07cba 100644
--- a/payloads/coreinfo/coreinfo.c
+++ b/payloads/coreinfo/coreinfo.c
@@ -72,7 +72,8 @@ static void print_menu(void)
for (i = 0; i < ARRAY_SIZE(modules); i++)
ptr += sprintf(ptr, "F%d: %s ", i + 1, modules[i]->name);
- mvprintw(23, 0, menu);
+ if (ARRAY_SIZE(modules) != 0)
+ mvprintw(23, 0, menu);
#ifdef CONFIG_SHOW_DATE_TIME
mvprintw(23, 59, "%02d/%02d/20%02d - %02d:%02d:%02d",
@@ -121,6 +122,9 @@ static void header(int row, const char *str)
static void redraw_module(void)
{
+ if (ARRAY_SIZE(modules) == 0)
+ return;
+
wclear(modwin);
modules[curwin]->redraw(modwin);
refresh();
@@ -133,7 +137,8 @@ static void loop(void)
center(0, "coreinfo v0.1");
print_menu();
- modules[curwin]->redraw(modwin);
+ if (ARRAY_SIZE(modules) != 0)
+ modules[curwin]->redraw(modwin);
refresh();
while (1) {
@@ -145,14 +150,16 @@ static void loop(void)
if (key >= KEY_F(1) && key <= KEY_F(9)) {
unsigned char ch = key - KEY_F(1);
- if (ch < ARRAY_SIZE(modules)) {
+ if (ch <= ARRAY_SIZE(modules)) {
+ if (ch == ARRAY_SIZE(modules))
+ continue;
curwin = ch;
redraw_module();
continue;
}
}
- if (modules[curwin]->handle)
+ if (ARRAY_SIZE(modules) != 0 && modules[curwin]->handle)
if (modules[curwin]->handle(key))
redraw_module();
}