Below you find my version of the ptov function. I have just added a few lines and placed them under "#if defined(ARM)". The test is reasonable for ARM so I would appreciate if you include it. For other platforms please do whatever you like. Jan void cmd_ptov(void) { int c; ulong vaddr; physaddr_t paddr; #if defined(ARM) physaddr_t paddr_tst; #endif char buf1[BUFSIZE]; char buf2[BUFSIZE]; int others; while ((c = getopt(argcnt, args, "")) != EOF) { switch(c) { default: argerrs++; break; } } if (argerrs || !args[optind]) cmd_usage(pc->curcmd, SYNOPSIS); others = 0; while (args[optind]) { paddr = htoll(args[optind], FAULT_ON_ERROR, NULL); vaddr = PTOV(paddr); #if defined(ARM) if (kvtop(0, vaddr, &paddr_tst, 0) && paddr_tst==paddr) { #endif fprintf(fp, "%s%s %s\n", others++ ? "\n" : "", mkstring(buf1, VADDR_PRLEN, LJUST, "VIRTUAL"), mkstring(buf2, VADDR_PRLEN, LJUST, "PHYSICAL")); fprintf(fp, "%s %s\n", mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(vaddr)), mkstring(buf2, VADDR_PRLEN, LJUST|LONGLONG_HEX, MKSTR(&paddr))); #if defined(ARM) } else { fprintf(fp, "Unknown virtual address for physical address 0x%08llx\n", paddr); } #endif optind++; } } Jan Karlsson Senior Software Engineer MIB Sony Mobile Communications Tel: +46703062174 sonymobile.com -----Original Message----- From: crash-utility-bounces@xxxxxxxxxx [mailto:crash-utility-bounces@xxxxxxxxxx] On Behalf Of Dave Anderson Sent: torsdag den 5 juli 2012 15:48 To: Discussion list for crash utility usage, maintenance and development Subject: Re: ptov command ----- Original Message ----- > > Hi Dave > > I have a question about the ptov command. Ptov only handles kernel > virtual addresses and their corresponding physical addresses. > However if you give ptov a physical address that does not correspond > to a kernel virtual address it still answers with an address. Users > might get confused and do not know when to trust ptov, especially as > the inverse command vtop always works. > > So I would like to restrict ptov to give a result only when it is > valid. The idea I have is that if ptov returns a valid virtual > address then vtop on that address should give the same physical > address back again. True?? > > cmd_ptov() in memory.c > > .... > > vaddr = PTOV(paddr); > kvtop(0, vaddr, &paddr_tst, 0); > if (paddr != paddr_tst) ... invalid vaddr, do not print it ... > > Any comments? > > Jan Sounds reasonable, at least for the 32-bit arches. I don't think it's necessary for any 64-bit arch. And you'd also need to account for kvtop() failing outright (and returning FALSE). Dave -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility