iPXE
|
#include <assert.h>
#include <realmode.h>
#include <bios.h>
#include <biosint.h>
#include <ipxe/console.h>
#include <ipxe/ansiesc.h>
#include <ipxe/keys.h>
#include <ipxe/keymap.h>
#include <ipxe/init.h>
#include <config/console.h>
Go to the source code of this file.
Data Structures | |
struct | bios_key |
A BIOS key. More... | |
Macros | |
#define | ATTR_BOLD 0x08 |
#define | ATTR_FCOL_MASK 0x07 |
#define | ATTR_FCOL_BLACK 0x00 |
#define | ATTR_FCOL_BLUE 0x01 |
#define | ATTR_FCOL_GREEN 0x02 |
#define | ATTR_FCOL_CYAN 0x03 |
#define | ATTR_FCOL_RED 0x04 |
#define | ATTR_FCOL_MAGENTA 0x05 |
#define | ATTR_FCOL_YELLOW 0x06 |
#define | ATTR_FCOL_WHITE 0x07 |
#define | ATTR_BLINK 0x80 |
#define | ATTR_BCOL_MASK 0x70 |
#define | ATTR_BCOL_BLACK 0x00 |
#define | ATTR_BCOL_BLUE 0x10 |
#define | ATTR_BCOL_GREEN 0x20 |
#define | ATTR_BCOL_CYAN 0x30 |
#define | ATTR_BCOL_RED 0x40 |
#define | ATTR_BCOL_MAGENTA 0x50 |
#define | ATTR_BCOL_YELLOW 0x60 |
#define | ATTR_BCOL_WHITE 0x70 |
#define | ATTR_DEFAULT ATTR_FCOL_WHITE |
#define | SCANCODE_RSHIFT 0x36 |
Maximum keycode subject to remapping. More... | |
#define | SCANCODE_NON_US 0x56 |
Scancode for the "non-US \ and |" key. More... | |
#define | CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG ) |
#define | bios_inject_lock __use_text16 ( bios_inject_lock ) |
#define | int16_vector __use_text16 ( int16_vector ) |
#define | BIOS_KEY(scancode, key) { scancode, KEY_REL ( key ) } |
Define a BIOS key mapping. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static uint8_t | __text16 (bios_inject_lock) |
Keypress injection lock. More... | |
static struct segoff | __text16 (int16_vector) |
Vector for chaining to other INT 16 handlers. More... | |
void | int16_wrapper (void) |
Assembly wrapper. More... | |
static void | bios_handle_cup (struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[]) |
Handle ANSI CUP (cursor position) More... | |
static void | bios_handle_ed (struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused) |
Handle ANSI ED (erase in page) More... | |
static void | bios_handle_sgr (struct ansiesc_context *ctx __unused, unsigned int count, int params[]) |
Handle ANSI SGR (set graphics rendition) More... | |
static void | bios_handle_dectcem_set (struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused) |
Handle ANSI DECTCEM set (show cursor) More... | |
static void | bios_handle_dectcem_reset (struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused) |
Handle ANSI DECTCEM reset (hide cursor) More... | |
static void | bios_putchar (int character) |
Print a character to BIOS console. More... | |
static const char * | bios_ansi_seq (unsigned int scancode) |
Get ANSI escape sequence corresponding to BIOS scancode. More... | |
static int | bios_getchar (void) |
Get character from BIOS console. More... | |
static int | bios_iskey (void) |
Check for character ready to read from BIOS console. More... | |
static __asmcall __used void | bios_inject (struct i386_all_regs *ix86) |
Inject keypresses. More... | |
static void | bios_inject_startup (void) |
Start up keypress injection. More... | |
static void | bios_inject_shutdown (int booting __unused) |
Shut down keypress injection. More... | |
struct startup_fn bios_inject_startup_fn | __startup_fn (STARTUP_NORMAL) |
Keypress injection startup function. More... | |
Variables | |
static unsigned int | bios_attr = ATTR_DEFAULT |
Current character attribute. More... | |
static struct ansiesc_handler | bios_ansiesc_handlers [] |
BIOS console ANSI escape sequence handlers. More... | |
static struct ansiesc_context | bios_ansiesc_ctx |
BIOS console ANSI escape sequence context. More... | |
static const char * | bios_ansi_input = "" |
Pointer to current ANSI output sequence. More... | |
static const struct bios_key | bios_keys [] |
Mapping from BIOS scan codes to iPXE key codes. More... | |
struct console_driver bios_console | __console_driver |
BIOS console. More... | |
#define ATTR_BOLD 0x08 |
Definition at line 37 of file bios_console.c.
#define ATTR_FCOL_MASK 0x07 |
Definition at line 39 of file bios_console.c.
#define ATTR_FCOL_BLACK 0x00 |
Definition at line 40 of file bios_console.c.
#define ATTR_FCOL_BLUE 0x01 |
Definition at line 41 of file bios_console.c.
#define ATTR_FCOL_GREEN 0x02 |
Definition at line 42 of file bios_console.c.
#define ATTR_FCOL_CYAN 0x03 |
Definition at line 43 of file bios_console.c.
#define ATTR_FCOL_RED 0x04 |
Definition at line 44 of file bios_console.c.
#define ATTR_FCOL_MAGENTA 0x05 |
Definition at line 45 of file bios_console.c.
#define ATTR_FCOL_YELLOW 0x06 |
Definition at line 46 of file bios_console.c.
#define ATTR_FCOL_WHITE 0x07 |
Definition at line 47 of file bios_console.c.
#define ATTR_BLINK 0x80 |
Definition at line 49 of file bios_console.c.
#define ATTR_BCOL_MASK 0x70 |
Definition at line 51 of file bios_console.c.
#define ATTR_BCOL_BLACK 0x00 |
Definition at line 52 of file bios_console.c.
#define ATTR_BCOL_BLUE 0x10 |
Definition at line 53 of file bios_console.c.
#define ATTR_BCOL_GREEN 0x20 |
Definition at line 54 of file bios_console.c.
#define ATTR_BCOL_CYAN 0x30 |
Definition at line 55 of file bios_console.c.
#define ATTR_BCOL_RED 0x40 |
Definition at line 56 of file bios_console.c.
#define ATTR_BCOL_MAGENTA 0x50 |
Definition at line 57 of file bios_console.c.
#define ATTR_BCOL_YELLOW 0x60 |
Definition at line 58 of file bios_console.c.
#define ATTR_BCOL_WHITE 0x70 |
Definition at line 59 of file bios_console.c.
#define ATTR_DEFAULT ATTR_FCOL_WHITE |
Definition at line 61 of file bios_console.c.
#define SCANCODE_RSHIFT 0x36 |
Maximum keycode subject to remapping.
This allows us to avoid remapping the numeric keypad, which is necessary for keyboard layouts such as "fr" that swap the shifted and unshifted digit keys.
Definition at line 69 of file bios_console.c.
#define SCANCODE_NON_US 0x56 |
Scancode for the "non-US \ and |" key.
This is the key that appears between Left Shift and Z on non-US keyboards.
Definition at line 76 of file bios_console.c.
#define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG ) |
Definition at line 81 of file bios_console.c.
#define bios_inject_lock __use_text16 ( bios_inject_lock ) |
Definition at line 89 of file bios_console.c.
#define int16_vector __use_text16 ( int16_vector ) |
Definition at line 93 of file bios_console.c.
Define a BIOS key mapping.
scancode | Scancode |
key | iPXE key code |
bioskey | BIOS key mapping |
Definition at line 304 of file bios_console.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Keypress injection lock.
|
static |
Vector for chaining to other INT 16 handlers.
void int16_wrapper | ( | void | ) |
Assembly wrapper.
Referenced by bios_inject_shutdown(), and bios_inject_startup().
|
static |
Handle ANSI CUP (cursor position)
ctx | ANSI escape sequence context |
count | Parameter count |
params[0] | Row (1 is top) |
params[1] | Column (1 is left) |
Definition at line 106 of file bios_console.c.
References __asm__(), __volatile__(), cx, and REAL_CODE.
|
static |
Handle ANSI ED (erase in page)
ctx | ANSI escape sequence context |
count | Parameter count |
params[0] | Region to erase |
Definition at line 128 of file bios_console.c.
References __asm__(), __volatile__(), ANSIESC_ED_ALL, assert(), bios_attr, console_height, console_width, and REAL_CODE.
|
static |
Handle ANSI SGR (set graphics rendition)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 148 of file bios_console.c.
References ATTR_BCOL_BLACK, ATTR_BCOL_BLUE, ATTR_BCOL_CYAN, ATTR_BCOL_GREEN, ATTR_BCOL_MAGENTA, ATTR_BCOL_MASK, ATTR_BCOL_RED, ATTR_BCOL_WHITE, ATTR_BCOL_YELLOW, ATTR_BLINK, ATTR_BOLD, ATTR_DEFAULT, ATTR_FCOL_BLACK, ATTR_FCOL_BLUE, ATTR_FCOL_CYAN, ATTR_FCOL_GREEN, ATTR_FCOL_MAGENTA, ATTR_FCOL_MASK, ATTR_FCOL_RED, ATTR_FCOL_WHITE, ATTR_FCOL_YELLOW, bios_attr, and count.
|
static |
Handle ANSI DECTCEM set (show cursor)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 194 of file bios_console.c.
References __asm__(), __volatile__(), BDA_CHAR_HEIGHT, BDA_SEG, get_real, and REAL_CODE.
|
static |
Handle ANSI DECTCEM reset (hide cursor)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 215 of file bios_console.c.
References __asm__(), __volatile__(), and REAL_CODE.
|
static |
Print a character to BIOS console.
character | Character to be printed |
Definition at line 243 of file bios_console.c.
References __asm__(), __volatile__(), ansiesc_process(), bios_ansiesc_ctx, bios_attr, discard_c, and REAL_CODE.
|
static |
Get ANSI escape sequence corresponding to BIOS scancode.
scancode | BIOS scancode |
ansi_seq | ANSI escape sequence, if any, otherwise NULL |
Definition at line 333 of file bios_console.c.
References assert(), bios_keys, DBG, KEY_ANSI_N, KEY_ANSI_TERMINATOR, NULL, bios_key::rkey, bios_key::scancode, sprintf, terminator, and tmp.
Referenced by bios_getchar().
|
static |
Get character from BIOS console.
character | Character read from console |
Definition at line 371 of file bios_console.c.
References __asm__(), __volatile__(), BDA_KB0, BDA_KB0_CAPSLOCK, BDA_KB0_CTRL, BDA_KB0_LSHIFT, BDA_KB0_RSHIFT, BDA_KB2, BDA_KB2_RALT, BDA_SEG, bios_ansi_input, bios_ansi_seq(), bios_inject_lock, get_real, key_remap(), KEYMAP_ALTGR, KEYMAP_CAPSLOCK_REDO, KEYMAP_CTRL, KEYMAP_PSEUDO, REAL_CODE, bios_key::scancode, SCANCODE_NON_US, and SCANCODE_RSHIFT.
|
static |
Check for character ready to read from BIOS console.
True | Character available to read |
False | No character available to read |
Definition at line 450 of file bios_console.c.
References __asm__(), __volatile__(), bios_ansi_input, bios_inject_lock, flags, REAL_CODE, and ZF.
|
static |
Inject keypresses.
ix86 | Registers as passed to INT 16 |
Definition at line 488 of file bios_console.c.
References __asm__(), __volatile__(), i386_regs::ah, bios_console, bios_inject_lock, bios_keys, DBGC, i386_regs::eax, getkey(), iskey(), key, KEY_MIN, KEY_REL, REAL_CODE, i386_all_regs::regs, and bios_key::scancode.
Referenced by bios_inject_startup().
|
static |
Start up keypress injection.
Definition at line 562 of file bios_console.c.
References __asm__(), __volatile__(), bios_inject(), hook_bios_interrupt(), int16_vector, int16_wrapper(), TEXT16_CODE, and VIRT_CALL.
|
static |
Shut down keypress injection.
booting | System is shutting down for OS boot |
Definition at line 585 of file bios_console.c.
References int16_vector, int16_wrapper(), and unhook_bios_interrupt().
struct startup_fn bios_inject_startup_fn __startup_fn | ( | STARTUP_NORMAL | ) |
Keypress injection startup function.
|
static |
Current character attribute.
Definition at line 85 of file bios_console.c.
Referenced by bios_handle_ed(), bios_handle_sgr(), and bios_putchar().
|
static |
BIOS console ANSI escape sequence handlers.
Definition at line 224 of file bios_console.c.
|
static |
BIOS console ANSI escape sequence context.
Definition at line 234 of file bios_console.c.
Referenced by bios_putchar().
|
static |
Pointer to current ANSI output sequence.
While we are in the middle of returning an ANSI sequence for a special key, this will point to the next character to return. When not in the middle of such a sequence, this will point to a NUL (note: not "will be NULL").
Definition at line 287 of file bios_console.c.
Referenced by bios_getchar(), and bios_iskey().
|
static |
Mapping from BIOS scan codes to iPXE key codes.
Definition at line 307 of file bios_console.c.
Referenced by bios_ansi_seq(), and bios_inject().
struct console_driver bios_console __console_driver |
BIOS console.
Definition at line 476 of file bios_console.c.