#include #include #include #include #include int main(int argc, char *argv[]) { int fd = open("/dev/kmem", O_RDONLY); if(fd < 0) { perror("open"); return -1; } int in_block = 0; char buffer[4096]; for(unsigned long i = 0; i < 0xfffff000; i+= sizeof(buffer)) { if(lseek(fd, i, SEEK_SET) == -1) { continue; } if(read(fd, buffer, sizeof(buffer)) == sizeof(buffer)) { if(!in_block) { printf("block found at 0x%8.8x:", i); fflush(stdout); in_block = 1; } } else { if(in_block) { in_block = 0; printf("0x%8.8x\n", i); fflush(stdout); } } } }