Browse Source

[bios] Support displaying and hiding cursor

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
6566690ba1
2 changed files with 44 additions and 0 deletions
  1. 43
    0
      src/arch/i386/firmware/pcbios/bios_console.c
  2. 1
    0
      src/arch/i386/include/bios.h

+ 43
- 0
src/arch/i386/firmware/pcbios/bios_console.c View File

@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
21 21
 
22 22
 #include <assert.h>
23 23
 #include <realmode.h>
24
+#include <bios.h>
24 25
 #include <ipxe/console.h>
25 26
 #include <ipxe/ansiesc.h>
26 27
 #include <ipxe/keymap.h>
@@ -148,11 +149,53 @@ static void bios_handle_sgr ( struct ansiesc_context *ctx __unused,
148 149
 	}
149 150
 }
150 151
 
152
+/**
153
+ * Handle ANSI DECTCEM set (show cursor)
154
+ *
155
+ * @v ctx		ANSI escape sequence context
156
+ * @v count		Parameter count
157
+ * @v params		List of graphic rendition aspects
158
+ */
159
+static void bios_handle_dectcem_set ( struct ansiesc_context *ctx __unused,
160
+				      unsigned int count __unused,
161
+				      int params[] __unused ) {
162
+	uint8_t height;
163
+
164
+	/* Get character height */
165
+	get_real ( height, BDA_SEG, BDA_CHAR_HEIGHT );
166
+
167
+	__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
168
+					   "int $0x10\n\t"
169
+					   "cli\n\t" )
170
+			       : : "a" ( 0x0100 ),
171
+				   "c" ( ( ( height - 2 ) << 8 ) |
172
+					 ( height - 1 ) ) );
173
+}
174
+
175
+/**
176
+ * Handle ANSI DECTCEM reset (hide cursor)
177
+ *
178
+ * @v ctx		ANSI escape sequence context
179
+ * @v count		Parameter count
180
+ * @v params		List of graphic rendition aspects
181
+ */
182
+static void bios_handle_dectcem_reset ( struct ansiesc_context *ctx __unused,
183
+					unsigned int count __unused,
184
+					int params[] __unused ) {
185
+
186
+	__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
187
+					   "int $0x10\n\t"
188
+					   "cli\n\t" )
189
+			       : : "a" ( 0x0100 ), "c" ( 0x2000 ) );
190
+}
191
+
151 192
 /** BIOS console ANSI escape sequence handlers */
152 193
 static struct ansiesc_handler bios_ansiesc_handlers[] = {
153 194
 	{ ANSIESC_CUP, bios_handle_cup },
154 195
 	{ ANSIESC_ED, bios_handle_ed },
155 196
 	{ ANSIESC_SGR, bios_handle_sgr },
197
+	{ ANSIESC_DECTCEM_SET, bios_handle_dectcem_set },
198
+	{ ANSIESC_DECTCEM_RESET, bios_handle_dectcem_reset },
156 199
 	{ 0, NULL }
157 200
 };
158 201
 

+ 1
- 0
src/arch/i386/include/bios.h View File

@@ -9,5 +9,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
9 9
 #define BDA_REBOOT 0x0072
10 10
 #define BDA_REBOOT_WARM 0x1234
11 11
 #define BDA_NUM_DRIVES 0x0075
12
+#define BDA_CHAR_HEIGHT 0x0085
12 13
 
13 14
 #endif /* BIOS_H */

Loading…
Cancel
Save