[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/7] vgabios: Fix size computation overflow
On Fri, 2012-05-04 at 15:26 +0100, Ian Campbell wrote: > On Fri, 2012-05-04 at 15:18 +0100, Frediano Ziglio wrote: > > On Fri, 2012-05-04 at 15:12 +0100, Ian Campbell wrote: > > > On Fri, 2012-05-04 at 13:36 +0100, Frediano Ziglio wrote: > > > > Remove an overflow computing width x height x bit which does > > > > not fit into a 16 bits. I wrote a routine to multiple these value > > > > and get the size required for framebuffer in segment unit (64k). > > > > > > Couldn't this be done in C using a suitably wide temporary variable? > > > > > > > I'd like :( > > > > BCC compiler used need some function which are not linked by BIOS. > > In which case > > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> > > In current vgabios (from Bochs not Xen copy) size is computed using size_64k = (Bit16u)((Bit32u)cur_info->info.XResolution * cur_info->info.XResolution * cur_info->info.BitsPerPixel) >> 19; If you try to use this code you get an undefined call to lmulul. Bochs code (still in vbe.c) provide this internal function with this asm code: ; helper function for memory size calculation lmulul: and eax, #0x0000FFFF shl ebx, #16 or eax, ebx SEG SS mul eax, dword ptr [di] mov ebx, eax shr ebx, #16 ret Note also that Bochs line have some problems - it multiply Xres by Xres intead of Xres by Yref - it does not take into account ceiling division Frediano _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |