# HG changeset patch # User nick # Date 1003736528 0 # Node ID 04c80ace9581c476d709ab78f2974a713452afc1 # Parent 77d81e5c186de22e14b79227a8bd6c086ee8a02d re-eng tool diff -r 77d81e5c186d -r 04c80ace9581 TOOLS/c --- a/TOOLS/c Mon Oct 22 07:15:04 2001 +0000 +++ b/TOOLS/c Mon Oct 22 07:42:08 2001 +0000 @@ -1,5 +1,5 @@ gcc bios2dump.c -o bios2dump - +gcc mem2dump.c -o mem2dump gcc subreader.c -o subreader gcc movinfo.c -o movinfo diff -r 77d81e5c186d -r 04c80ace9581 TOOLS/mem2dump.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TOOLS/mem2dump.c Mon Oct 22 07:42:08 2001 +0000 @@ -0,0 +1,49 @@ +/* + bios2dump.c - Was designed to dump memory block to file. + Usage: as argument requires absolute address of memory dump and its lenght + (int hexadecimal form). + as output - will write file which will named: memADDR_LEN.dump + where: ADDR - given address of memory + LEN - given length of memory + Licence: GNU GPL v2 + Copyright: Nick Kurshev +*/ +#include +#include + +int main( int argc, char *argv[]) +{ + FILE * fd_mem, *fd_out; + unsigned long i,addr,len; + int int_no; + char outname[80]; + unsigned char ch; + if(argc < 3) + { + printf("Usage: %s address length (in hex)\n",argv[0]); + return EXIT_FAILURE; + } + addr = strtol(argv[1],NULL,16); + len = strtol(argv[2],NULL,16); + if(!(fd_mem = fopen("/dev/mem","rb"))) + { + perror("Can't open file - /dev/mem"); + return EXIT_FAILURE; + } + sprintf(outname,"mem%08X_%08X.dump",addr,len); + if(!(fd_out = fopen(outname,"wb"))) + { + perror("Can't open output file"); + fclose(fd_mem); + return EXIT_FAILURE; + } + fseek(fd_mem,addr,SEEK_SET); + for(i=0;i