#define _GNU_SOURCE #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include #include #include #include #include #include #include #include #include #include "dev/pci/sis1100_var.h" /****************************************************************************/ static int* alloc_buf(int num) { unsigned long int p; int pagesize, pagemask; pagesize=getpagesize(); pagemask=pagesize-1; p=(unsigned long int)calloc(num+pagesize, 1); if (!p) return (int*)p; p=(p+pagesize-1)&(~pagemask); return (int*)p; } static int generate_size(int max) { int maxbits, bits; int mask, size; maxbits=0; while (1<>(32-bits); size=random()%mask+1; return size; } static int generate_start(int max, int size) { int space, offs; space=max-size; offs=random()%(space+1); return offs; } static void check_it(int p, int size, int* ob, int* ib, int mem, int err_addr) { u_int32_t data; int l; lseek(p, sizeof(int)*(mem+err_addr), SEEK_SET); read(p, &data, sizeof(int)); printf("/524288=%d %%524288=%d diff to end=%d\n", ((err_addr+1)*4)/524288, ((err_addr+1)*4)%524288, size-err_addr); /* printf("** ob: %08X mem: %08X ib: %08X\n", ob[err_addr], data, ib[err_addr]); printf("** ob+offs=%08X ib+offs=%08X\n", (unsigned int)(ob+err_addr), (unsigned int)(ib+err_addr)); */ for (l=0; l<5; l++) { lseek(p, sizeof(int)*mem, SEEK_SET); write(p, ob, size*sizeof(int)); lseek(p, sizeof(int)*mem, SEEK_SET); read(p, ib, size*sizeof(int)); if (bcmp(ib, ob, size*sizeof(int))) { int i, n; printf("## size=%08X ob=%08lX ib=%08lX mem=%08lX\n", size, (unsigned long)ob, (unsigned long)ib, (unsigned long)mem); for (i=0, n=0; (i