[Intel-gfx] [PATCH] Eliminate INT10 call to get BIOS contents

Julien Cristau jcristau at debian.org
Tue Sep 30 11:11:12 CEST 2008


Hi Keith,

On Mon, Sep 29, 2008 at 19:09:45 -0700, Keith Packard wrote:

> @@ -161,6 +158,11 @@ parse_general_features(I830Ptr pI830, struct bdb_header *bdb)
>      }
>  }
>  
> +#ifndef XSERVER_LIBPCIACCESS
> +/* XXX */
> +#define INTEL_VBIOS_SIZE (64 * 1024)
> +#endif
> +
>  /**
>   * i830_bios_init - map VBIOS, find VBT
>   *
> @@ -179,34 +181,25 @@ i830_bios_init(ScrnInfoPtr pScrn)
>      struct bdb_header *bdb;
>      int vbt_off, bdb_off;
>      unsigned char *bios;
> -    vbeInfoPtr	pVbe;
> -    pointer pVBEModule = NULL;
> +    int ret;
> +    int size;
>  
> -    bios = xalloc(INTEL_VBIOS_SIZE);

So you remove the allocation of this buffer...

> -    if (bios == NULL)
> +#if XSERVER_LIBPCIACCESS
> +    size = pI830->PciInfo->rom_size;
> +#else
> +    size = INTEL_VBIOS_SIZE;
> +#endif
> +    if (size == 0)
>  	return -1;
> -
> -    /* Load vbe module */
> -    if (!(pVBEModule = xf86LoadSubModule(pScrn, "vbe")))
> -	return FALSE;
> -    xf86LoaderReqSymLists(I810vbeSymbols, NULL);
> -
> -    pVbe = VBEInit(NULL, pI830->pEnt->index);
> -    if (pVbe != NULL) {
> -	memcpy(bios, xf86int10Addr(pVbe->pInt10,
> -				   pVbe->pInt10->BIOSseg << 4),
> -	       INTEL_VBIOS_SIZE);
> -	vbeFree (pVbe);
> -    } else {
> +    
>  #if XSERVER_LIBPCIACCESS
> -	pci_device_read_rom (pI830->PciInfo, bios);
> +    ret = pci_device_read_rom (pI830->PciInfo, bios);

... and then pass it to pci_device_read_rom(), which will happily write
somewhere random.

Btw, it would seem pci_device_read_rom really wants to take a size
parameter, to make sure it doesn't write past the end of its buffer.

Cheers,
Julien



More information about the Intel-gfx mailing list