1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#include <sys/io.h>
#include <fs.h>
#include <bios.h>
#include <syslinux/memscan.h>
#include <syslinux/firmware.h>
struct firmware *firmware = NULL;
extern struct ansi_ops bios_ansi_ops;
extern void bios_erase(int, int, int, int, uint8_t);
extern void bios_write_char(uint8_t, uint8_t);
extern void bios_showcursor(uint16_t);
extern void bios_scroll_up(uint8_t, uint8_t, uint8_t);
extern void bios_set_cursor(int, int, bool);
extern void bios_beep(void);
extern void bios_set_mode(uint16_t mode);
extern void bios_get_mode(int *rows, int *cols);
extern void bios_get_cursor(int *x, int *y);
struct output_ops bios_output_ops = {
.erase = bios_erase,
.write_char = bios_write_char,
.showcursor = bios_showcursor,
.set_cursor = bios_set_cursor,
.scroll_up = bios_scroll_up,
.beep = bios_beep,
.get_mode = bios_get_mode,
.set_mode = bios_set_mode,
.get_cursor = bios_get_cursor,
};
extern char bios_getchar(void);
struct input_ops bios_input_ops = {
.getchar = bios_getchar,
};
static const char *syslinux_ipappend_string_list[32];
bool bios_ipappend_strings(char **list, int *count)
{
static com32sys_t reg;
int i;
reg.eax.w[0] = 0x000f;
__intcall(0x22, ®, ®);
if (reg.eflags.l & EFLAGS_CF)
return false;
for (i = 0; i < reg.ecx.w[0]; i++) {
syslinux_ipappend_string_list[i] =
MK_PTR(reg.es,
*(uint16_t *) MK_PTR(reg.es, reg.ebx.w[0] + i * 2));
}
*list = syslinux_ipappend_string_list;
*count = reg.ecx.w[0];
return true;
}
extern char *bios_get_config_file_name(void);
extern void bios_get_serial_console_info(uint16_t *, uint16_t *, uint16_t *);
struct firmware bios_fw = {
.init = bios_init,
.scan_memory = bios_scan_memory,
.adjust_screen = bios_adjust_screen,
.cleanup = bios_cleanup_hardware,
.disk_init = bios_disk_init,
.o_ops = &bios_output_ops,
.i_ops = &bios_input_ops,
.ipappend_strings = bios_ipappend_strings,
.get_config_file_name = bios_get_config_file_name,
.get_serial_console_info = bios_get_serial_console_info,
};
void syslinux_register_bios(void)
{
firmware = &bios_fw;
}
|