aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-27 15:01:12 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-27 15:59:54 +0000
commit9f284ea6ad3215ab609b733424121fbfe7ab7edb (patch)
tree673a78be9c5cffba903b4b60b7ddc73b4d01bd2e /com32
parent75afaf55d70cda7a24533df124183f8624190438 (diff)
downloadsyslinux-9f284ea6ad3215ab609b733424121fbfe7ab7edb.tar.gz
syslinux-9f284ea6ad3215ab609b733424121fbfe7ab7edb.tar.xz
syslinux-9f284ea6ad3215ab609b733424121fbfe7ab7edb.zip
ldlinux: Reset the console whenever we execute a module
Each module expects the console to start in text mode and will make explicit calls to openconsole() when another console is required, e.g. in vesamenu.c32. This mimics the behaviour found in 4.0x. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/elflink/ldlinux/config.h1
-rw-r--r--com32/elflink/ldlinux/execute.c10
-rw-r--r--com32/elflink/ldlinux/ldlinux.c7
3 files changed, 17 insertions, 1 deletions
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 9b7ce4a4..c551fb19 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -48,6 +48,7 @@ extern int new_linux_kernel(char *okernel, char *ocmdline);
extern void pm_load_high(com32sys_t *regs);
extern void ldlinux_enter_command(void);
+extern void ldlinux_console_init(void);
extern const char *apply_extension(const char *kernel, const char *ext);
#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index e06192e6..10399230 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -102,6 +102,12 @@ void execute(const char *cmdline, uint32_t type)
}
if (type == IMAGE_TYPE_COM32) {
+ /*
+ * We may be called with the console in an unknown
+ * state, so initialise it.
+ */
+ ldlinux_console_init();
+
/* new entry for elf format c32 */
create_args_and_load((char *)cmdline);
@@ -112,6 +118,10 @@ void execute(const char *cmdline, uint32_t type)
* e.g. from vesamenu.c32.
*/
unload_modules_since("ldlinux.c32");
+
+ /* Restore the console */
+ ldlinux_console_init();
+
ldlinux_enter_command();
} else if (type == IMAGE_TYPE_CONFIG) {
char *argv[] = { "ldlinux.c32", NULL };
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 4a092838..82d2ae6d 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -270,6 +270,11 @@ static void __destructor close_console(void)
close(i);
}
+void ldlinux_console_init(void)
+{
+ openconsole(&dev_stdcon_r, &dev_ansiserial_w);
+}
+
int main(int argc __unused, char **argv __unused)
{
const void *adv;
@@ -277,7 +282,7 @@ int main(int argc __unused, char **argv __unused)
size_t count = 0;
char *config_argv[2] = { NULL, NULL };
- openconsole(&dev_stdcon_r, &dev_ansiserial_w);
+ ldlinux_console_init();
if (ConfigName[0])
config_argv[0] = ConfigName;