/* dump a contiguous range of icmp_in slots: slots <alias> <from> <to> */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>

int
main(int argc, char **argv)
{
	uint64_t alias = strtoull(argv[1], NULL, 16);
	int from = atoi(argv[2]), to = atoi(argv[3]), s;
	uint64_t base = alias + 24 + 2ULL * 64511 * 8;
	int fd = open("/dev/kmem", O_RDONLY);
	for (s = from; s <= to; s++) {
		uint64_t v = 0xDEADDEADDEADDEAD;
		pread(fd, &v, 8, (off_t)(base + 8ULL * s));
		printf("icmp_in[%d] = 0x%016llx\n", s, (unsigned long long)v);
	}
	return 0;
}
