summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/firmware/pcbios/bios_console.c
diff options
context:
space:
mode:
authorMichael Brown2014-08-06 16:10:58 +0200
committerMichael Brown2014-08-06 16:10:58 +0200
commit6566690ba105427912e2f1ad1f6e4cbc7422bd5c (patch)
treedf093c00493b41beafd226bc259cf5ab445e02ab /src/arch/i386/firmware/pcbios/bios_console.c
parent[efi] Generalise snpnet_pci_info() to efi_locate_device() (diff)
downloadipxe-6566690ba105427912e2f1ad1f6e4cbc7422bd5c.tar.gz
ipxe-6566690ba105427912e2f1ad1f6e4cbc7422bd5c.tar.xz
ipxe-6566690ba105427912e2f1ad1f6e4cbc7422bd5c.zip
[bios] Support displaying and hiding cursor
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/firmware/pcbios/bios_console.c')
-rw-r--r--src/arch/i386/firmware/pcbios/bios_console.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/arch/i386/firmware/pcbios/bios_console.c b/src/arch/i386/firmware/pcbios/bios_console.c
index b2b7bf2d..bd73838b 100644
--- a/src/arch/i386/firmware/pcbios/bios_console.c
+++ b/src/arch/i386/firmware/pcbios/bios_console.c
@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <assert.h>
#include <realmode.h>
+#include <bios.h>
#include <ipxe/console.h>
#include <ipxe/ansiesc.h>
#include <ipxe/keymap.h>
@@ -148,11 +149,53 @@ static void bios_handle_sgr ( struct ansiesc_context *ctx __unused,
}
}
+/**
+ * Handle ANSI DECTCEM set (show cursor)
+ *
+ * @v ctx ANSI escape sequence context
+ * @v count Parameter count
+ * @v params List of graphic rendition aspects
+ */
+static void bios_handle_dectcem_set ( struct ansiesc_context *ctx __unused,
+ unsigned int count __unused,
+ int params[] __unused ) {
+ uint8_t height;
+
+ /* Get character height */
+ get_real ( height, BDA_SEG, BDA_CHAR_HEIGHT );
+
+ __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
+ "int $0x10\n\t"
+ "cli\n\t" )
+ : : "a" ( 0x0100 ),
+ "c" ( ( ( height - 2 ) << 8 ) |
+ ( height - 1 ) ) );
+}
+
+/**
+ * Handle ANSI DECTCEM reset (hide cursor)
+ *
+ * @v ctx ANSI escape sequence context
+ * @v count Parameter count
+ * @v params List of graphic rendition aspects
+ */
+static void bios_handle_dectcem_reset ( struct ansiesc_context *ctx __unused,
+ unsigned int count __unused,
+ int params[] __unused ) {
+
+ __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
+ "int $0x10\n\t"
+ "cli\n\t" )
+ : : "a" ( 0x0100 ), "c" ( 0x2000 ) );
+}
+
/** BIOS console ANSI escape sequence handlers */
static struct ansiesc_handler bios_ansiesc_handlers[] = {
{ ANSIESC_CUP, bios_handle_cup },
{ ANSIESC_ED, bios_handle_ed },
{ ANSIESC_SGR, bios_handle_sgr },
+ { ANSIESC_DECTCEM_SET, bios_handle_dectcem_set },
+ { ANSIESC_DECTCEM_RESET, bios_handle_dectcem_reset },
{ 0, NULL }
};