aboutsummaryrefslogtreecommitdiffstats
path: root/core/cleanup.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2011-10-18 13:13:06 +0100
committerMatt Fleming <matt.fleming@intel.com>2011-12-01 13:14:05 +0000
commit9f51b69d7c0500e04b3c404bb5138a9234810035 (patch)
treed566e6984457f331288f34d780f15a680334af94 /core/cleanup.c
parentdd5e4935f3e2f8f1940c72d9c3b39a926300c42e (diff)
downloadsyslinux-9f51b69d7c0500e04b3c404bb5138a9234810035.tar.gz
syslinux-9f51b69d7c0500e04b3c404bb5138a9234810035.tar.xz
syslinux-9f51b69d7c0500e04b3c404bb5138a9234810035.zip
core: Reimplement lots asm code in C
There is an awful lot of code currently implemented in assembly when it could just as easily be implemented in C. Having it in C makes it much easier to share code between the BIOS and forthcoming EFI firmware backend. The following code fragments have been rewritten, - timer initialisation - adjust_screen() - check_esapes() and mem_init() - conio.inc - plaincon.inc - cleanup.inc - serirq.inc - font.inc - graphics - writehex Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'core/cleanup.c')
-rw-r--r--core/cleanup.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/cleanup.c b/core/cleanup.c
new file mode 100644
index 00000000..7bf1df2e
--- /dev/null
+++ b/core/cleanup.c
@@ -0,0 +1,46 @@
+/* -----------------------------------------------------------------------
+ *
+ * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * -----------------------------------------------------------------------
+ */
+#include <com32.h>
+#include <core.h>
+
+extern void timer_cleanup(void);
+extern void comboot_cleanup_api(void);
+
+/*
+ * cleanup.c
+ *
+ * Some final tidying before jumping to a kernel or bootsector
+ */
+
+/*
+ * cleanup_hardware:
+ *
+ * Shut down anything transient.
+ */
+void cleanup_hardware(void)
+{
+ /*
+ * TODO
+ *
+ * Linux wants the floppy motor shut off before starting the
+ * kernel, at least bootsect.S seems to imply so. If we don't
+ * load the floppy driver, this is *definitely* so!
+ */
+ __intcall(0x13, &zero_regs, NULL);
+
+ call16(comboot_cleanup_api, &zero_regs, NULL);
+ call16(timer_cleanup, &zero_regs, NULL);
+
+ /* If we enabled serial port interrupts, clean them up now */
+ sirq_cleanup();
+}