aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorErwan Velu <erwan@enovance.com>2014-01-22 23:57:12 +0100
committerErwan Velu <erwan@enovance.com>2014-01-22 23:57:12 +0100
commit3150c7839640859e8ec6ea0243002309e5f9c068 (patch)
tree275ff162a0252960548013afbe8ff7da7e9cffc0 /core
parent7a9978f280e1d291f6fac419e7c2a0178e9e5d6b (diff)
downloadsyslinux-3150c7839640859e8ec6ea0243002309e5f9c068.tar.gz
syslinux-3150c7839640859e8ec6ea0243002309e5f9c068.tar.xz
syslinux-3150c7839640859e8ec6ea0243002309e5f9c068.zip
com32sys_t inreg shall be zeroified prior intcall
As per commit f775e740a3a817a4ff5ba26bea99dbfd735456b3, inreg parameters of intcall() shall be zeroified. Having unclean inreg could trigger bad behaviors on some hosts. This patch is about adding memset() calls prior any intcall() : - some intcall didn't had any memset at all - some successive intcall() calls didn't memset inreg in between calls
Diffstat (limited to 'core')
-rw-r--r--core/bios.c21
-rw-r--r--core/font.c3
-rw-r--r--core/fs/diskio_bios.c2
-rw-r--r--core/graphics.c3
-rw-r--r--core/localboot.c2
-rw-r--r--core/plaincon.c2
-rw-r--r--core/pxeboot.c1
-rw-r--r--core/rawcon.c1
8 files changed, 35 insertions, 0 deletions
diff --git a/core/bios.c b/core/bios.c
index 25e857b9..1dfbbe9a 100644
--- a/core/bios.c
+++ b/core/bios.c
@@ -52,6 +52,7 @@ static void bios_get_cursor(uint8_t *x, uint8_t *y)
static void bios_erase(int x0, int y0, int x1, int y1, uint8_t attribute)
{
static com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
ireg.eax.w[0] = 0x0600; /* Clear window */
ireg.ebx.b[1] = attribute;
@@ -67,6 +68,8 @@ static void bios_showcursor(const struct term_state *st)
static com32sys_t ireg;
uint16_t cursor = st->cursor ? cursor_type : 0x2020;
+ memset(&ireg, 0, sizeof(ireg));
+
ireg.eax.b[1] = 0x01;
ireg.ecx.w[0] = cursor;
__intcall(0x10, &ireg, NULL);
@@ -78,6 +81,8 @@ static void bios_set_cursor(int x, int y, bool visible)
struct curxy xy = BIOS_CURXY[page];
static com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
+
(void)visible;
if (xy.x != x || xy.y != y) {
@@ -93,6 +98,8 @@ static void bios_write_char(uint8_t ch, uint8_t attribute)
{
static com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
+
ireg.eax.b[1] = 0x09;
ireg.eax.b[0] = ch;
ireg.ebx.b[1] = BIOS_PAGE;
@@ -105,6 +112,8 @@ static void bios_scroll_up(uint8_t cols, uint8_t rows, uint8_t attribute)
{
static com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
+
ireg.eax.w[0] = 0x0601;
ireg.ebx.b[1] = attribute;
ireg.ecx.w[0] = 0;
@@ -117,6 +126,8 @@ static void bios_beep(void)
{
static com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
+
ireg.eax.w[0] = 0x0e07;
ireg.ebx.b[1] = BIOS_PAGE;
__intcall(0x10, &ireg, NULL);
@@ -161,9 +172,11 @@ void bios_adv_init(void)
{
static com32sys_t reg;
+ memset(&reg, 0, sizeof(reg));
reg.eax.w[0] = 0x0025;
__intcall(0x22, &reg, &reg);
+ memset(&reg, 0, sizeof(reg));
reg.eax.w[0] = 0x001c;
__intcall(0x22, &reg, &reg);
__syslinux_adv_ptr = MK_PTR(reg.es, reg.ebx.w[0]);
@@ -174,6 +187,7 @@ int bios_adv_write(void)
{
static com32sys_t reg;
+ memset(&reg, 0, sizeof(reg));
reg.eax.w[0] = 0x001d;
__intcall(0x22, &reg, &reg);
return (reg.eflags.l & EFLAGS_CF) ? -1 : 0;
@@ -262,6 +276,7 @@ static int bios_vesacon_set_mode(struct vesa_info *vesa_info, int *px, int *py,
debug("Found mode: 0x%04x\r\n", mode);
+ memset(&rm, 0, sizeof rm);
memset(mi, 0, sizeof *mi);
rm.eax.w[0] = 0x4F01; /* Get SVGA mode information */
rm.ecx.w[0] = mode;
@@ -357,6 +372,7 @@ static int bios_vesacon_set_mode(struct vesa_info *vesa_info, int *px, int *py,
mi = &vesa_info->mi;
mode = bestmode;
+ memset(&rm, 0, sizeof rm);
/* Now set video mode */
rm.eax.w[0] = 0x4F02; /* Set SVGA video mode */
if (mi->mode_attr & 0x0080)
@@ -384,6 +400,7 @@ static void set_window_pos(struct win_info *wi, size_t win_pos)
if (wi->win_num < 0)
return; /* This should never happen... */
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.w[0] = 0x4F05;
ireg.ebx.b[0] = wi->win_num;
ireg.edx.w[0] = win_pos >> wi->win_gshift;
@@ -450,6 +467,7 @@ static inline void check_escapes(void)
{
com32sys_t ireg, oreg;
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.b[1] = 0x02; /* Check keyboard flags */
__intcall(0x16, &ireg, &oreg);
@@ -539,6 +557,7 @@ static int bios_scan_memory(scan_memory_callback_t callback, void *data)
if (!e820buf)
return -1;
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.l = 0xe820;
ireg.edx.l = 0x534d4150;
ireg.ebx.l = 0;
@@ -592,6 +611,7 @@ static int bios_scan_memory(scan_memory_callback_t callback, void *data)
return 0;
/* Next try INT 15h AX=E801h */
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.w[0] = 0xe801;
__intcall(0x15, &ireg, &oreg);
@@ -611,6 +631,7 @@ static int bios_scan_memory(scan_memory_callback_t callback, void *data)
}
/* Finally try INT 15h AH=88h */
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.w[0] = 0x8800;
if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) {
rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, SMT_FREE);
diff --git a/core/font.c b/core/font.c
index 7dd8be78..508f7059 100644
--- a/core/font.c
+++ b/core/font.c
@@ -134,6 +134,7 @@ void use_font(void)
__intcall(0x10, &ireg, &oreg);
+ memset(&ireg, 0, sizeof(ireg));
ireg.ebx.b[0] = 0;
ireg.eax.w[0] = 0x1103; /* Select page 0 */
__intcall(0x10, &ireg, NULL);
@@ -154,6 +155,8 @@ void bios_adjust_screen(void)
volatile uint8_t *vidrows = (volatile uint8_t *)BIOS_vidrows;
uint8_t rows, cols;
+ memset(&ireg, 0, sizeof(ireg));
+
rows = *vidrows;
if (!rows) {
/*
diff --git a/core/fs/diskio_bios.c b/core/fs/diskio_bios.c
index 9b935fe2..eba5a176 100644
--- a/core/fs/diskio_bios.c
+++ b/core/fs/diskio_bios.c
@@ -334,6 +334,7 @@ struct disk *bios_disk_init(void *private)
}
}
+ memset(&ireg, 0, sizeof ireg);
/* Get EBIOS support */
ireg.eax.b[1] = 0x41;
ireg.ebx.w[0] = 0x55aa;
@@ -352,6 +353,7 @@ struct disk *bios_disk_init(void *private)
/* memset(&edd_params, 0, sizeof edd_params); */
edd_params.len = sizeof edd_params;
+ memset(&ireg, 0, sizeof ireg);
ireg.eax.b[1] = 0x48;
ireg.ds = SEG(&edd_params);
ireg.esi.w[0] = OFFS(&edd_params);
diff --git a/core/graphics.c b/core/graphics.c
index 1efb2faf..471847f5 100644
--- a/core/graphics.c
+++ b/core/graphics.c
@@ -94,9 +94,11 @@ static int vgasetmode(void)
/*
* Set mode.
*/
+ memset(&ireg, 0, sizeof(ireg));
ireg.eax.w[0] = 0x0012; /* Set mode = 640x480 VGA 16 colors */
__intcall(0x10, &ireg, &oreg);
+ memset(&ireg, 0, sizeof(ireg));
ireg.edx.w[0] = (uint32_t)linear_color;
ireg.eax.w[0] = 0x1002; /* Write color registers */
__intcall(0x10, &ireg, &oreg);
@@ -339,6 +341,7 @@ static void vgacursorcommon(char data)
{
if (UsingVGA) {
com32sys_t ireg;
+ memset(&ireg, 0, sizeof(ireg));
ireg.eax.b[0] = data;
ireg.eax.b[1] = 0x09;
diff --git a/core/localboot.c b/core/localboot.c
index 39ffc8cb..04635d47 100644
--- a/core/localboot.c
+++ b/core/localboot.c
@@ -39,6 +39,7 @@ __export void local_boot(int16_t ax)
com32sys_t ireg, oreg;
int i;
+ memset(&ireg, 0, sizeof(ireg));
syslinux_force_text_mode();
writestr(LOCALBOOT_MSG);
@@ -62,6 +63,7 @@ __export void local_boot(int16_t ax)
ireg.eax.w[0] = 0; /* Reset drive */
__intcall(0x13, &ireg, NULL);
+ memset(&ireg, 0, sizeof(ireg));
ireg.eax.w[0] = 0x0201; /* Read one sector */
ireg.ecx.w[0] = 0x0001; /* C/H/S = 0/0/1 (first sector) */
ireg.ebx.w[0] = OFFS(trackbuf);
diff --git a/core/plaincon.c b/core/plaincon.c
index 2b7c4a63..66c259eb 100644
--- a/core/plaincon.c
+++ b/core/plaincon.c
@@ -14,6 +14,8 @@ __export void writechr(char data)
{
com32sys_t ireg, oreg;
+ memset(&ireg, 0, sizeof ireg);
+ memset(&oreg, 0, sizeof oreg);
write_serial(data); /* write to serial port if needed */
if (UsingVGA & 0x8)
diff --git a/core/pxeboot.c b/core/pxeboot.c
index b6c90998..d9960d81 100644
--- a/core/pxeboot.c
+++ b/core/pxeboot.c
@@ -24,6 +24,7 @@ extern void local_boot16(void);
__export void local_boot(uint16_t ax)
{
com32sys_t ireg;
+ memset(&ireg, 0, sizeof ireg);
syslinux_force_text_mode();
diff --git a/core/rawcon.c b/core/rawcon.c
index 6910a849..44030984 100644
--- a/core/rawcon.c
+++ b/core/rawcon.c
@@ -24,6 +24,7 @@ __export void writechr(char data)
bool curxyok = false;
uint16_t dx;
+ memset(&ireg, 0, sizeof ireg);
ireg.ebx.b[1] = *(uint8_t *)BIOS_page;
ireg.eax.b[1] = 0x03; /* Read cursor position */
__intcall(0x10, &ireg, &oreg);