[syslinux:elflink] graphics: Fix GXPix* assignment
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Tue Apr 17 11:24:19 PDT 2012
Commit-ID: 085157ac96ce448efa69b864863869bdeb4e485e
Gitweb: http://www.syslinux.org/commit/085157ac96ce448efa69b864863869bdeb4e485e
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 3 Apr 2012 15:30:58 +0100
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 17 Apr 2012 10:58:35 +0100
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 at intel.com>
---
core/graphics.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/core/graphics.c b/core/graphics.c
index 4a4af55..e85787d 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;
}
}
More information about the Syslinux-commits
mailing list