aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-04-03 15:30:58 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-04-17 10:58:35 +0100
commit085157ac96ce448efa69b864863869bdeb4e485e (patch)
tree0b05795be3fc16bc8e5fb8390cc5f7a9277a1144
parent9da94301c4986c2085e0e7b7f4551915dc4f3786 (diff)
downloadsyslinux-085157ac96ce448efa69b864863869bdeb4e485e.tar.gz
syslinux-085157ac96ce448efa69b864863869bdeb4e485e.tar.xz
syslinux-085157ac96ce448efa69b864863869bdeb4e485e.zip
graphics: Fix GXPix* assignment
We need assign cols/rows to GXPixCols/GXPixRows separately, we can't rely on the compiler writing the 32-bit value to two consecutive 16-bit memory locations like the assembly version did. The value we were storing was actually being truncated by the compiler (see the warning below), Also fixup the following warnings, graphics.c: In function ‘vgasetmode’: graphics.c:95:18: warning: cast from pointer to integer of different size graphics.c:102:2: warning: large integer implicitly truncated to unsigned type graphics.c: In function ‘outputvga’: graphics.c:222:12: warning: cast from pointer to integer of different size graphics.c:227:11: warning: cast from pointer to integer of different size graphics.c: In function ‘vgadisplayfile’: graphics.c:303:4: warning: passing argument 1 of ‘outputvga’ from incompatible pointer type graphics.c:213:13: note: expected ‘uint32_t *’ but argument is of type ‘uint8_t *’ Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--core/graphics.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/graphics.c b/core/graphics.c
index 4a4af55f..e85787dd 100644
--- a/core/graphics.c
+++ b/core/graphics.c
@@ -92,14 +92,15 @@ static int vgasetmode(void)
ireg.eax.w[0] = 0x0012; /* Set mode = 640x480 VGA 16 colors */
__intcall(0x10, &ireg, &oreg);
- ireg.edx.w[0] = (uint16_t)linear_color;
+ ireg.edx.w[0] = (uint32_t)linear_color;
ireg.eax.w[0] = 0x1002; /* Write color registers */
__intcall(0x10, &ireg, &oreg);
UsingVGA = 1;
/* Set GXPixCols and GXPixRows */
- GXPixCols = 640+(480 << 16);
+ GXPixCols = 640;
+ GXPixRows = 480;
use_font();
ScrollAttribute = 0;
@@ -219,12 +220,12 @@ static void outputvga(uint32_t *in, uint32_t *out)
val = 2; /* Sequencer mask */
/* Select the sequencer mask */
- outb(val, (uint16_t)addr);
+ outb(val, (uint32_t)addr);
addr += 1; /* VGA Sequencer Register data port */
for (i = 1; i <= 8; i *= 2) {
/* Select the bit plane to write */
- outb(i, (uint16_t)addr);
+ outb(i, (uint32_t)addr);
for (j = 0; j < (640 / 32); j++)
*(out + j) = *(in + j);
@@ -300,7 +301,8 @@ void vgadisplayfile(FILE *_fd)
rledecode(VGARowBuffer, GraphXSize);
packedpixel2vga(VGARowBuffer, VGAPlaneBuffer, 640);
- outputvga(VGAPlaneBuffer, MK_PTR(0x0A000, VGAPos));
+ outputvga((uint32_t *)VGAPlaneBuffer,
+ MK_PTR(0x0A000, VGAPos));
VGAPos += 640/8;
}
}