// bcc -ansi -Md -O pcidump2.c -o pcidump2.com #include unsigned long in_w(unsigned short port) { #asm push bp mov bp, sp mov dx, [bp + 4] in eax, dx push eax pop ax pop dx pop bp #endasm } void out_w(unsigned short port, unsigned long data) { #asm push bp mov bp, sp mov dx, [bp + 4] mov eax, [bp + 6] out dx, eax pop bp #endasm } unsigned long read_pcireg(unsigned long reg) { unsigned long var; reg |= 0x80000000L; #asm cli #endasm out_w(0xcf8, reg); var = in_w(0xcfc); #asm sti #endasm return var; } int main(int argc, char *argv[]) { FILE *fp; unsigned long f, r; static unsigned long buf[64]; fp = fopen("pcidump2.bin", "wb"); if (fp == NULL) goto fin0; for (f = 0; f < 256; f++) { for (r = 0; r < 64; r++) { buf[r] = read_pcireg((f << 8) | (r << 2)); } fwrite(buf, sizeof(buf), 1, fp); } fclose(fp); fin0: return 0; }