2 bios2dump.c - Was designed to dump memory block to file.
3 Usage: as argument requires absolute address of memory dump and its lenght
4 (int hexadecimal form).
5 as output - will write file which will named: memADDR_LEN.dump
6 where: ADDR - given address of memory
7 LEN - given length of memory
9 Copyright: Nick Kurshev <nickols_k@mail.ru>
14 int main( int argc
, char *argv
[])
16 FILE * fd_mem
, *fd_out
;
17 unsigned long i
,addr
,len
;
23 printf("Usage: %s address length (in hex)\n",argv
[0]);
26 addr
= strtol(argv
[1],NULL
,16);
27 len
= strtol(argv
[2],NULL
,16);
28 if(!(fd_mem
= fopen("/dev/mem","rb")))
30 perror("Can't open file - /dev/mem");
33 sprintf(outname
,"mem%08X_%08X.dump",addr
,len
);
34 if(!(fd_out
= fopen(outname
,"wb")))
36 perror("Can't open output file");
40 fseek(fd_mem
,addr
,SEEK_SET
);
43 fread(&ch
,1,1,fd_mem
);
44 fwrite(&ch
,1,1,fd_out
);