]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[bios] Support displaying and hiding cursor
authorMichael Brown <mcb30@ipxe.org>
Wed, 6 Aug 2014 14:10:58 +0000 (15:10 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 6 Aug 2014 14:10:58 +0000 (15:10 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/firmware/pcbios/bios_console.c
src/arch/i386/include/bios.h

index b2b7bf2d8c310b75740d6a054ff5fddea240652c..bd73838b588251cc501d5e8ad2075e62b2b1c49f 100644 (file)
@@ -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 }
 };
 
index 3e6a845e3ef896d8292ab39445027eb2d186fdd7..0754b1168812ab6e14a25ee21c2b8787c042984f 100644 (file)
@@ -9,5 +9,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #define BDA_REBOOT 0x0072
 #define BDA_REBOOT_WARM 0x1234
 #define BDA_NUM_DRIVES 0x0075
+#define BDA_CHAR_HEIGHT 0x0085
 
 #endif /* BIOS_H */