mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Read ROM in chunks
This patch speeds up reads of the ROM by reading in large chunks rather than one byte at a time. This patch was by Dann Frazier.
This commit is contained in:
@@ -788,8 +788,10 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
|
||||
write(fd, "1", 2);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
||||
len = min(Len, st.st_size);
|
||||
|
||||
/* copy the ROM until we hit Len, EOF or read error */
|
||||
for (i = 0; i < Len && read(fd, Buf, 1) > 0; Buf++, i++)
|
||||
for (; len && (size = read(fd, Buf, len)) > 0 ; Buf+=size, len-=size)
|
||||
;
|
||||
|
||||
write(fd, "0", 2);
|
||||
|
||||
Reference in New Issue
Block a user