iPXE
bios_console.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25
26#include <assert.h>
27#include <realmode.h>
28#include <bios.h>
29#include <biosint.h>
30#include <ipxe/console.h>
31#include <ipxe/ansiesc.h>
32#include <ipxe/keys.h>
33#include <ipxe/keymap.h>
34#include <ipxe/init.h>
35#include <config/console.h>
36
37#define ATTR_BOLD 0x08
38
39#define ATTR_FCOL_MASK 0x07
40#define ATTR_FCOL_BLACK 0x00
41#define ATTR_FCOL_BLUE 0x01
42#define ATTR_FCOL_GREEN 0x02
43#define ATTR_FCOL_CYAN 0x03
44#define ATTR_FCOL_RED 0x04
45#define ATTR_FCOL_MAGENTA 0x05
46#define ATTR_FCOL_YELLOW 0x06
47#define ATTR_FCOL_WHITE 0x07
48
49#define ATTR_BLINK 0x80
50
51#define ATTR_BCOL_MASK 0x70
52#define ATTR_BCOL_BLACK 0x00
53#define ATTR_BCOL_BLUE 0x10
54#define ATTR_BCOL_GREEN 0x20
55#define ATTR_BCOL_CYAN 0x30
56#define ATTR_BCOL_RED 0x40
57#define ATTR_BCOL_MAGENTA 0x50
58#define ATTR_BCOL_YELLOW 0x60
59#define ATTR_BCOL_WHITE 0x70
60
61#define ATTR_DEFAULT ATTR_FCOL_WHITE
62
63/** Maximum keycode subject to remapping
64 *
65 * This allows us to avoid remapping the numeric keypad, which is
66 * necessary for keyboard layouts such as "fr" that swap the shifted
67 * and unshifted digit keys.
68 */
69#define SCANCODE_RSHIFT 0x36
70
71/** Scancode for the "non-US \ and |" key
72 *
73 * This is the key that appears between Left Shift and Z on non-US
74 * keyboards.
75 */
76#define SCANCODE_NON_US 0x56
77
78/* Set default console usage if applicable */
79#if ! ( defined ( CONSOLE_PCBIOS ) && CONSOLE_EXPLICIT ( CONSOLE_PCBIOS ) )
80#undef CONSOLE_PCBIOS
81#define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
82#endif
83
84/** Current character attribute */
85static unsigned int bios_attr = ATTR_DEFAULT;
86
87/** Keypress injection lock */
89#define bios_inject_lock __use_text16 ( bios_inject_lock )
90
91/** Vector for chaining to other INT 16 handlers */
92static struct segoff __text16 ( int16_vector );
93#define int16_vector __use_text16 ( int16_vector )
94
95/** Assembly wrapper */
96extern void int16_wrapper ( void );
97
98/**
99 * Handle ANSI CUP (cursor position)
100 *
101 * @v ctx ANSI escape sequence context
102 * @v count Parameter count
103 * @v params[0] Row (1 is top)
104 * @v params[1] Column (1 is left)
105 */
107 unsigned int count __unused, int params[] ) {
108 int cx = ( params[1] - 1 );
109 int cy = ( params[0] - 1 );
110
111 if ( cx < 0 )
112 cx = 0;
113 if ( cy < 0 )
114 cy = 0;
115
116 __asm__ __volatile__ ( REAL_CODE ( "int $0x10\n\t" )
117 : : "a" ( 0x0200 ), "b" ( 1 ),
118 "d" ( ( cy << 8 ) | cx ) );
119}
120
121/**
122 * Handle ANSI ED (erase in page)
123 *
124 * @v ctx ANSI escape sequence context
125 * @v count Parameter count
126 * @v params[0] Region to erase
127 */
129 unsigned int count __unused,
130 int params[] __unused ) {
131 /* We assume that we always clear the whole screen */
132 assert ( params[0] == ANSIESC_ED_ALL );
133
134 __asm__ __volatile__ ( REAL_CODE ( "int $0x10\n\t" )
135 : : "a" ( 0x0600 ), "b" ( bios_attr << 8 ),
136 "c" ( 0 ),
137 "d" ( ( ( console_height - 1 ) << 8 ) |
138 ( console_width - 1 ) ) );
139}
140
141/**
142 * Handle ANSI SGR (set graphics rendition)
143 *
144 * @v ctx ANSI escape sequence context
145 * @v count Parameter count
146 * @v params List of graphic rendition aspects
147 */
149 unsigned int count, int params[] ) {
150 static const uint8_t bios_attr_fcols[10] = {
154 ATTR_FCOL_WHITE, ATTR_FCOL_WHITE /* defaults */
155 };
156 static const uint8_t bios_attr_bcols[10] = {
160 ATTR_BCOL_BLACK, ATTR_BCOL_BLACK /* defaults */
161 };
162 unsigned int i;
163 int aspect;
164
165 for ( i = 0 ; i < count ; i++ ) {
166 aspect = params[i];
167 if ( aspect == 0 ) {
169 } else if ( aspect == 1 ) {
171 } else if ( aspect == 5 ) {
173 } else if ( aspect == 22 ) {
175 } else if ( aspect == 25 ) {
177 } else if ( ( aspect >= 30 ) && ( aspect <= 39 ) ) {
179 bios_attr |= bios_attr_fcols[ aspect - 30 ];
180 } else if ( ( aspect >= 40 ) && ( aspect <= 49 ) ) {
182 bios_attr |= bios_attr_bcols[ aspect - 40 ];
183 }
184 }
185}
186
187/**
188 * Handle ANSI DECTCEM set (show cursor)
189 *
190 * @v ctx ANSI escape sequence context
191 * @v count Parameter count
192 * @v params List of graphic rendition aspects
193 */
195 unsigned int count __unused,
196 int params[] __unused ) {
197 uint8_t height;
198
199 /* Get character height */
200 get_real ( height, BDA_SEG, BDA_CHAR_HEIGHT );
201
202 __asm__ __volatile__ ( REAL_CODE ( "int $0x10\n\t" )
203 : : "a" ( 0x0100 ),
204 "c" ( ( ( height - 2 ) << 8 ) |
205 ( height - 1 ) ) );
206}
207
208/**
209 * Handle ANSI DECTCEM reset (hide cursor)
210 *
211 * @v ctx ANSI escape sequence context
212 * @v count Parameter count
213 * @v params List of graphic rendition aspects
214 */
216 unsigned int count __unused,
217 int params[] __unused ) {
218
219 __asm__ __volatile__ ( REAL_CODE ( "int $0x10\n\t" )
220 : : "a" ( 0x0100 ), "c" ( 0x2000 ) );
221}
222
223/** BIOS console ANSI escape sequence handlers */
232
233/** BIOS console ANSI escape sequence context */
235 .handlers = bios_ansiesc_handlers,
236};
237
238/**
239 * Print a character to BIOS console
240 *
241 * @v character Character to be printed
242 */
243static void bios_putchar ( int character ) {
244 int discard_a, discard_b, discard_c;
245
246 /* Intercept ANSI escape sequences */
247 character = ansiesc_process ( &bios_ansiesc_ctx, character );
248 if ( character < 0 )
249 return;
250
251 /* Print character with attribute */
252 __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
253 /* Skip non-printable characters */
254 "cmpb $0x20, %%al\n\t"
255 "jb 1f\n\t"
256 /* Read attribute */
257 "movb %%al, %%cl\n\t"
258 "movb $0x08, %%ah\n\t"
259 "int $0x10\n\t"
260 "xchgb %%al, %%cl\n\t"
261 /* Skip if attribute matches */
262 "cmpb %%ah, %%bl\n\t"
263 "je 1f\n\t"
264 /* Set attribute */
265 "movw $0x0001, %%cx\n\t"
266 "movb $0x09, %%ah\n\t"
267 "int $0x10\n\t"
268 "\n1:\n\t"
269 /* Print character */
270 "xorw %%bx, %%bx\n\t"
271 "movb $0x0e, %%ah\n\t"
272 "int $0x10\n\t"
273 "popl %%ebp\n\t" /* gcc bug */ )
274 : "=a" ( discard_a ), "=b" ( discard_b ),
275 "=c" ( discard_c )
276 : "a" ( character ), "b" ( bios_attr ) );
277}
278
279/**
280 * Pointer to current ANSI output sequence
281 *
282 * While we are in the middle of returning an ANSI sequence for a
283 * special key, this will point to the next character to return. When
284 * not in the middle of such a sequence, this will point to a NUL
285 * (note: not "will be NULL").
286 */
287static const char *bios_ansi_input = "";
288
289/** A BIOS key */
290struct bios_key {
291 /** Scancode */
293 /** Relative key value */
295} __attribute__ (( packed ));
296
297/**
298 * Define a BIOS key mapping
299 *
300 * @v scancode Scancode
301 * @v key iPXE key code
302 * @v bioskey BIOS key mapping
303 */
304#define BIOS_KEY( scancode, key ) { scancode, KEY_REL ( key ) }
305
306/** Mapping from BIOS scan codes to iPXE key codes */
307static const struct bios_key bios_keys[] = {
308 BIOS_KEY ( 0x53, KEY_DC ),
309 BIOS_KEY ( 0x48, KEY_UP ),
310 BIOS_KEY ( 0x50, KEY_DOWN ),
311 BIOS_KEY ( 0x4b, KEY_LEFT ),
312 BIOS_KEY ( 0x4d, KEY_RIGHT ),
313 BIOS_KEY ( 0x47, KEY_HOME ),
314 BIOS_KEY ( 0x4f, KEY_END ),
315 BIOS_KEY ( 0x49, KEY_PPAGE ),
316 BIOS_KEY ( 0x51, KEY_NPAGE ),
317 BIOS_KEY ( 0x3f, KEY_F5 ),
318 BIOS_KEY ( 0x40, KEY_F6 ),
319 BIOS_KEY ( 0x41, KEY_F7 ),
320 BIOS_KEY ( 0x42, KEY_F8 ),
321 BIOS_KEY ( 0x43, KEY_F9 ),
322 BIOS_KEY ( 0x44, KEY_F10 ),
323 BIOS_KEY ( 0x85, KEY_F11 ),
324 BIOS_KEY ( 0x86, KEY_F12 ),
325};
326
327/**
328 * Get ANSI escape sequence corresponding to BIOS scancode
329 *
330 * @v scancode BIOS scancode
331 * @ret ansi_seq ANSI escape sequence, if any, otherwise NULL
332 */
333static const char * bios_ansi_seq ( unsigned int scancode ) {
334 static char buf[ 5 /* "[" + two digits + terminator + NUL */ ];
335 unsigned int rkey;
336 unsigned int terminator;
337 unsigned int n;
338 unsigned int i;
339 char *tmp = buf;
340
341 /* Construct ANSI escape sequence for scancode, if known */
342 for ( i = 0 ; i < ( sizeof ( bios_keys ) /
343 sizeof ( bios_keys[0] ) ) ; i++ ) {
344
345 /* Look for matching scancode */
346 if ( bios_keys[i].scancode != scancode )
347 continue;
348
349 /* Construct escape sequence */
350 rkey = bios_keys[i].rkey;
351 n = KEY_ANSI_N ( rkey );
353 *(tmp++) = '[';
354 if ( n )
355 tmp += sprintf ( tmp, "%d", n );
356 *(tmp++) = terminator;
357 *(tmp++) = '\0';
358 assert ( tmp <= &buf[ sizeof ( buf ) ] );
359 return buf;
360 }
361
362 DBG ( "Unrecognised BIOS scancode %02x\n", scancode );
363 return NULL;
364}
365
366/**
367 * Get character from BIOS console
368 *
369 * @ret character Character read from console
370 */
371static int bios_getchar ( void ) {
372 uint16_t keypress;
373 uint8_t kb0;
374 uint8_t kb2;
375 unsigned int scancode;
376 unsigned int character;
377 const char *ansi_seq;
378
379 /* If we are mid-sequence, pass out the next byte */
380 if ( ( character = *bios_ansi_input ) ) {
382 return character;
383 }
384
385 /* Do nothing if injection is in progress */
386 if ( bios_inject_lock )
387 return 0;
388
389 /* Read character from real BIOS console */
391 __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
392 "int $0x16\n\t"
393 "cli\n\t" )
394 : "=a" ( keypress )
395 : "a" ( 0x1000 ), "m" ( bios_inject_lock ) );
397 scancode = ( keypress >> 8 );
398 character = ( keypress & 0xff );
399 get_real ( kb0, BDA_SEG, BDA_KB0 );
400 get_real ( kb2, BDA_SEG, BDA_KB2 );
401
402 /* If it's a normal character, map (if applicable) and return it */
403 if ( character && ( character < 0x80 ) ) {
404
405 /* Handle special scancodes */
406 if ( scancode == SCANCODE_NON_US ) {
407 /* Treat as "\|" with high bit set */
408 character |= KEYMAP_PSEUDO;
409 } else if ( scancode >= SCANCODE_RSHIFT ) {
410 /* Non-remappable scancode (e.g. numeric keypad) */
411 return character;
412 }
413
414 /* Apply modifiers */
415 if ( kb0 & BDA_KB0_CTRL )
416 character |= KEYMAP_CTRL;
417 if ( kb0 & BDA_KB0_CAPSLOCK )
418 character |= KEYMAP_CAPSLOCK_REDO;
419 if ( kb2 & BDA_KB2_RALT )
420 character |= KEYMAP_ALTGR;
421
422 /* Treat LShift+RShift as AltGr since many BIOSes will
423 * not return ASCII characters when AltGr is pressed.
424 */
425 if ( ( kb0 & ( BDA_KB0_LSHIFT | BDA_KB0_RSHIFT ) ) ==
427 character |= KEYMAP_ALTGR;
428 }
429
430 /* Map and return */
431 return key_remap ( character );
432 }
433
434 /* Otherwise, check for a special key that we know about */
435 if ( ( ansi_seq = bios_ansi_seq ( keypress >> 8 ) ) ) {
436 /* Start of escape sequence: return ESC (0x1b) */
437 bios_ansi_input = ansi_seq;
438 return 0x1b;
439 }
440
441 return 0;
442}
443
444/**
445 * Check for character ready to read from BIOS console
446 *
447 * @ret True Character available to read
448 * @ret False No character available to read
449 */
450static int bios_iskey ( void ) {
451 unsigned int discard_a;
452 unsigned int flags;
453
454 /* If we are mid-sequence, we are always ready */
455 if ( *bios_ansi_input )
456 return 1;
457
458 /* Do nothing if injection is in progress */
459 if ( bios_inject_lock )
460 return 0;
461
462 /* Otherwise check the real BIOS console */
464 __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
465 "int $0x16\n\t"
466 "pushfw\n\t"
467 "popw %w0\n\t"
468 "cli\n\t" )
469 : "=R" ( flags ), "=a" ( discard_a )
470 : "a" ( 0x1100 ), "m" ( bios_inject_lock ) );
472 return ( ! ( flags & ZF ) );
473}
474
475/** BIOS console */
477 .putchar = bios_putchar,
478 .getchar = bios_getchar,
479 .iskey = bios_iskey,
480 .usage = CONSOLE_PCBIOS,
481};
482
483/**
484 * Inject keypresses
485 *
486 * @v ix86 Registers as passed to INT 16
487 */
488static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
489 unsigned int discard_a;
490 unsigned int scancode;
491 unsigned int rkey;
492 unsigned int i;
493 uint16_t keypress;
494 int key;
495
496 /* If this is a blocking call, then loop until the
497 * non-blocking variant of the call indicates that a keypress
498 * is available. Do this without acquiring the injection
499 * lock, so that injection may take place.
500 */
501 if ( ( ix86->regs.ah & ~0x10 ) == 0x00 ) {
502 __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
503 "\n1:\n\t"
504 "pushw %%ax\n\t"
505 "int $0x16\n\t"
506 "popw %%ax\n\t"
507 "jc 2f\n\t"
508 "jz 1b\n\t"
509 "\n2:\n\t"
510 "cli\n\t" )
511 : "=a" ( discard_a )
512 : "a" ( ix86->regs.eax | 0x0100 ),
513 "m" ( bios_inject_lock ) );
514 }
515
516 /* Acquire injection lock */
518
519 /* Check for keypresses */
520 if ( iskey() ) {
521
522 /* Get key */
523 key = getkey ( 0 );
524
525 /* Reverse internal CR->LF mapping */
526 if ( key == '\n' )
527 key = '\r';
528
529 /* Convert to keypress */
530 keypress = ( ( key << 8 ) | key );
531
532 /* Handle special keys */
533 if ( key >= KEY_MIN ) {
534 rkey = KEY_REL ( key );
535 for ( i = 0 ; i < ( sizeof ( bios_keys ) /
536 sizeof ( bios_keys[0] ) ) ; i++ ) {
537 if ( bios_keys[i].rkey == rkey ) {
538 scancode = bios_keys[i].scancode;
539 keypress = ( scancode << 8 );
540 break;
541 }
542 }
543 }
544
545 /* Inject keypress */
546 DBGC ( &bios_console, "BIOS injecting keypress %04x\n",
547 keypress );
548 __asm__ __volatile__ ( REAL_CODE ( "int $0x16\n\t" )
549 : "=a" ( discard_a )
550 : "a" ( 0x0500 ), "c" ( keypress ),
551 "m" ( bios_inject_lock ) );
552 }
553
554 /* Release injection lock */
556}
557
558/**
559 * Start up keypress injection
560 *
561 */
562static void bios_inject_startup ( void ) {
563
564 /* Assembly wrapper to call bios_inject() */
566 TEXT16_CODE ( "\nint16_wrapper:\n\t"
567 "pushfw\n\t"
568 "cmpb $0, %%cs:bios_inject_lock\n\t"
569 "jnz 1f\n\t"
571 "\n1:\n\t"
572 "popfw\n\t"
573 "ljmp *%%cs:int16_vector\n\t" ) : );
574
575 /* Hook INT 16 */
577 &int16_vector );
578}
579
580/**
581 * Shut down keypress injection
582 *
583 * @v booting System is shutting down for OS boot
584 */
585static void bios_inject_shutdown ( int booting __unused ) {
586
587 /* Unhook INT 16 */
589 &int16_vector );
590}
591
592/** Keypress injection startup function */
593struct startup_fn bios_inject_startup_fn __startup_fn ( STARTUP_NORMAL ) = {
594 .name = "bios_inject",
595 .startup = bios_inject_startup,
596 .shutdown = bios_inject_shutdown,
597};
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
union @162305117151260234136356364136041353210355154177 key
Sense key.
Definition scsi.h:3
struct golan_eq_context ctx
Definition CIB_PRM.h:0
int ansiesc_process(struct ansiesc_context *ctx, int c)
Process character that may be part of ANSI escape sequence.
Definition ansiesc.c:75
ANSI escape sequences.
#define __asmcall
Declare a function with standard calling conventions.
Definition compiler.h:15
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
unsigned short uint16_t
Definition stdint.h:11
unsigned long intptr_t
Definition stdint.h:21
unsigned char uint8_t
Definition stdint.h:10
long discard_c
Definition bigint.h:33
Assertions.
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define BDA_KB0_CTRL
Definition bios.h:12
#define BDA_KB0_CAPSLOCK
Definition bios.h:13
#define BDA_KB0_LSHIFT
Definition bios.h:11
#define BDA_SEG
Definition bios.h:6
#define BDA_KB2
Definition bios.h:21
#define BDA_KB2_RALT
Definition bios.h:22
#define BDA_KB0
Definition bios.h:9
#define BDA_CHAR_HEIGHT
Definition bios.h:20
#define BDA_KB0_RSHIFT
Definition bios.h:10
#define ATTR_BLINK
static __asmcall __used void bios_inject(struct i386_all_regs *ix86)
Inject keypresses.
static void bios_handle_dectcem_reset(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM reset (hide cursor)
static struct ansiesc_handler bios_ansiesc_handlers[]
BIOS console ANSI escape sequence handlers.
static struct ansiesc_context bios_ansiesc_ctx
BIOS console ANSI escape sequence context.
static void bios_putchar(int character)
Print a character to BIOS console.
static unsigned int bios_attr
Current character attribute.
static int bios_getchar(void)
Get character from BIOS console.
void int16_wrapper(void)
Assembly wrapper.
static int bios_iskey(void)
Check for character ready to read from BIOS console.
#define bios_inject_lock
static const char * bios_ansi_input
Pointer to current ANSI output sequence.
static void bios_handle_dectcem_set(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM set (show cursor)
static void bios_inject_startup(void)
Start up keypress injection.
#define int16_vector
static const char * bios_ansi_seq(unsigned int scancode)
Get ANSI escape sequence corresponding to BIOS scancode.
static void bios_handle_cup(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[])
Handle ANSI CUP (cursor position)
#define SCANCODE_NON_US
Scancode for the "non-US \ and |" key.
#define SCANCODE_RSHIFT
Maximum keycode subject to remapping.
static void bios_inject_shutdown(int booting __unused)
Shut down keypress injection.
static const struct bios_key bios_keys[]
Mapping from BIOS scan codes to iPXE key codes.
static void bios_handle_ed(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI ED (erase in page)
#define BIOS_KEY(scancode, key)
Define a BIOS key mapping.
static void bios_handle_sgr(struct ansiesc_context *ctx __unused, unsigned int count, int params[])
Handle ANSI SGR (set graphics rendition)
#define CONSOLE_PCBIOS
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
Definition biosint.c:25
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
Definition biosint.c:70
Console configuration.
unsigned int console_width
Console width.
Definition console.c:15
int iskey(void)
Check for available input on any console.
Definition console.c:131
unsigned int console_height
Console height.
Definition console.c:18
#define ATTR_FCOL_BLACK
Definition efi_console.c:39
#define ATTR_BCOL_CYAN
Definition efi_console.c:52
#define ATTR_FCOL_YELLOW
Definition efi_console.c:45
#define ATTR_BCOL_GREEN
Definition efi_console.c:51
#define ATTR_BOLD
Definition efi_console.c:36
#define ATTR_FCOL_MAGENTA
Definition efi_console.c:44
#define ATTR_BCOL_BLACK
Definition efi_console.c:49
#define ATTR_BCOL_WHITE
Definition efi_console.c:56
#define ATTR_FCOL_WHITE
Definition efi_console.c:46
#define ATTR_FCOL_CYAN
Definition efi_console.c:42
#define ATTR_BCOL_BLUE
Definition efi_console.c:50
#define ATTR_BCOL_MAGENTA
Definition efi_console.c:54
#define ATTR_BCOL_YELLOW
Definition efi_console.c:55
#define ATTR_FCOL_BLUE
Definition efi_console.c:40
#define ATTR_BCOL_RED
Definition efi_console.c:53
#define ATTR_FCOL_GREEN
Definition efi_console.c:41
#define ATTR_FCOL_MASK
Definition efi_console.c:38
#define ATTR_BCOL_MASK
Definition efi_console.c:48
#define ATTR_FCOL_RED
Definition efi_console.c:43
#define ATTR_DEFAULT
Definition efi_console.c:58
uint8_t flags
Flags.
Definition ena.h:7
struct eth_slow_terminator_tlv terminator
Terminator.
Definition eth_slow.h:9
int getkey(unsigned long timeout)
Get single keypress.
Definition getkey.c:72
#define ANSIESC_DECTCEM_SET
Show cursor.
Definition ansiesc.h:129
#define ANSIESC_ED
Erase in page.
Definition ansiesc.h:107
#define ANSIESC_DECTCEM_RESET
Hide cursor.
Definition ansiesc.h:132
#define ANSIESC_SGR
Select graphic rendition.
Definition ansiesc.h:119
#define ANSIESC_CUP
Cursor position.
Definition ansiesc.h:104
#define ANSIESC_ED_ALL
Erase whole page.
Definition ansiesc.h:116
#define __used
Declare a function as used.
Definition compiler.h:605
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBGC(...)
Definition compiler.h:505
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
static unsigned int count
Number of entries.
Definition dwmac.h:220
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define STARTUP_NORMAL
Normal startup.
Definition init.h:65
#define __attribute__(x)
Definition compiler.h:10
User interaction.
#define __console_driver
Mark a struct console_driver as being part of the console drivers table.
Definition console.h:134
#define __startup_fn(startup_order)
Declare a startup/shutdown function.
Definition init.h:53
unsigned int key_remap(unsigned int character)
Remap a key.
Definition keymap.c:62
Keyboard mappings.
#define KEYMAP_PSEUDO
Pseudo key flag.
Definition keymap.h:53
#define KEYMAP_ALTGR
AltGr key flag.
Definition keymap.h:74
#define KEYMAP_CTRL
Ctrl key flag.
Definition keymap.h:56
#define KEYMAP_CAPSLOCK_REDO
Undo and redo CapsLock key flags.
Definition keymap.h:71
Key definitions.
#define KEY_RIGHT
Right arrow.
Definition keys.h:108
#define KEY_DC
Delete.
Definition keys.h:113
#define KEY_F12
F12.
Definition keys.h:123
#define KEY_DOWN
Down arrow.
Definition keys.h:107
#define KEY_ANSI_TERMINATOR(key)
Extract ANSI escape sequence terminating character.
Definition keys.h:104
#define KEY_F5
F5.
Definition keys.h:116
#define KEY_PPAGE
Page up.
Definition keys.h:114
#define KEY_F9
F9.
Definition keys.h:120
#define KEY_ANSI_N(key)
Extract ANSI escape sequence numeric portion.
Definition keys.h:96
#define KEY_F8
F8 (for PXE)
Definition keys.h:119
#define KEY_F7
F7.
Definition keys.h:118
#define KEY_NPAGE
Page down.
Definition keys.h:115
#define KEY_REL(key)
Construct relative key value for special key.
Definition keys.h:78
#define KEY_END
End.
Definition keys.h:110
#define KEY_MIN
Minimum value for special keypresses.
Definition keys.h:70
#define KEY_F11
F11.
Definition keys.h:122
#define KEY_F6
F6.
Definition keys.h:117
#define KEY_F10
F10.
Definition keys.h:121
#define KEY_LEFT
Left arrow.
Definition keys.h:109
#define KEY_HOME
Home.
Definition keys.h:111
#define KEY_UP
Up arrow.
Definition keys.h:106
#define REAL_CODE(asm_code_str)
Definition libkir.h:226
#define TEXT16_CODE(asm_code_str)
Definition libkir.h:217
#define __text16(variable)
Definition libkir.h:18
#define get_real
Definition libkir.h:151
#define VIRT_CALL(function)
Call C function from real-mode code.
Definition librm.h:72
unsigned long tmp
Definition linux_pci.h:65
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define ZF
Definition registers.h:184
uint16_t cx
Definition registers.h:37
#define sprintf(buf, fmt,...)
Write a formatted string to a buffer.
Definition stdio.h:37
ANSI escape sequence context.
Definition ansiesc.h:74
A handler for an escape sequence.
Definition ansiesc.h:35
A BIOS key.
uint16_t rkey
Relative key value.
uint8_t scancode
Scancode.
A console driver.
Definition console.h:56
A full register dump.
Definition registers.h:174
struct i386_regs regs
Definition registers.h:176
uint8_t ah
Definition registers.h:106
uint32_t eax
Definition registers.h:109
A startup/shutdown function.
Definition init.h:43
struct console_driver bios_console
Definition vesafb.c:45