From: Don Slutz <dslutz(a)verizon.com>
For eaxmple:
crash> vtop 0xffffffff802ee778
VIRTUAL PHYSICAL
ffffffff802ee778 4ee778
PML4 DIRECTORY: ffffffff80001000
PAGE DIRECTORY: 203067
PUD: 203ff0 => 205063
PMD: 205008 => bee2c163
PTE: bee2c770 => 4ee163
PAGE: 4ee000
PTE PHYSICAL FLAGS
4ee163 4ee000 (PRESENT|RW|ACCESSED|DIRTY|GLOBAL)
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff8100006f7410 4ee000 0 0 1 400
crash> set debug 1
debug: 1
crash> vtop 0xffffffff802ee778
VIRTUAL PHYSICAL
ffffffff802ee778 4ee778
PML4 DIRECTORY: ffffffff80001000
PAGE DIRECTORY: 203067
PUD: 203ff0 => 205063
PMD: 205008 => bee2c163
PTE: bee2c770 => 4ee163
PAGE: 4ee000
PTE PHYSICAL FLAGS
4ee163 4ee000 (PRESENT|RW|ACCESSED|DIRTY|GLOBAL)
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffff8100006f7410 4ee000 0 0 1 400
rvtop(ffffffff802ee778)=4ee778
Signed-off-by: Don Slutz <dslutz(a)verizon.com>
---
defs.h | 1 +
memory.c | 19 +++++++++++++++++++
remote.c | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
diff --git a/defs.h b/defs.h
index e7073c6..94ba495 100755
--- a/defs.h
+++ b/defs.h
@@ -5527,6 +5527,7 @@ void dump_sockets_workhorse(ulong, ulong, struct reference *);
*/
int is_remote_daemon(char *);
physaddr_t get_remote_phys_base(physaddr_t, physaddr_t);
+physaddr_t remote_vtop(int, physaddr_t);
void remote_fd_init(void);
int get_remote_file(struct remote_file *);
uint remote_page_size(void);
diff --git a/memory.c b/memory.c
index 5ec454d..d995f4d 100755
--- a/memory.c
+++ b/memory.c
@@ -2932,6 +2932,13 @@ cmd_vtop(void)
do_vtop(vaddr, tc, vtop_flags | loop_vtop_flags);
+ if (REMOTE() && CRASHDEBUG(1)) {
+ ulong pAddr = remote_vtop(tc->processor, vaddr);
+
+ if (pAddr)
+ fprintf(fp, "rvtop(%lx)=%lx\n", vaddr, pAddr);
+ }
+
optind++;
}
}
@@ -17178,3 +17185,15 @@ get_kmem_cache_by_name(char *request)
return found;
}
#endif /* NOT_USED */
+
+/*
+ * Specify Emacs local variables so the formating
+ * of the code stays the same.
+ *
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 8
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/remote.c b/remote.c
index 58588ce..2186af9 100755
--- a/remote.c
+++ b/remote.c
@@ -2342,6 +2342,46 @@ get_remote_phys_base(physaddr_t text_start, physaddr_t
virt_phys_base)
}
/*
+ * Do a remote VTOP if supported.
+ */
+physaddr_t
+remote_vtop(int cpu, physaddr_t virt_addr)
+{
+ char sendbuf[BUFSIZE];
+ char recvbuf[BUFSIZE];
+ char *p1, *p2, *p3, *p4;
+ int errflag;
+ ulong value;
+
+ if (!rc->remoteType[0])
+ return 0; /* Not a special remote. */
+
+ BZERO(sendbuf, BUFSIZE);
+ BZERO(recvbuf, BUFSIZE);
+ sprintf(sendbuf, "VTOP %d %llx", cpu, virt_addr);
+ remote_tcp_write_string(pc->sockfd, sendbuf);
+ remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, pc->flags2 &
REMOTE_NIL);
+
+ if (CRASHDEBUG(2))
+ fprintf(fp, "remote_vtop(%d,%llx): [%s]\n",
+ cpu, virt_addr, recvbuf);
+
+ if (strstr(recvbuf, "<FAIL>"))
+ error(FATAL, "remote_vtop for CPU %d\n", cpu);
+ p1 = strtok(recvbuf, " "); /* VTOP */
+ p2 = strtok(NULL, " "); /* cpu */
+ p3 = strtok(NULL, " "); /* vaddr */
+ p4 = strtok(NULL, " "); /* paddr */
+
+ errflag = 0;
+ value = htol(p4, RETURN_ON_ERROR|QUIET, &errflag);
+ if (!errflag) {
+ return value;
+ }
+ return 0;
+}
+
+/*
*
* Set up the file descriptors and file name strings if they haven't
* been set up before:
--
1.8.4