From: Don Slutz <dslutz(a)verizon.com>
Signed-off-by: Don Slutz <dslutz(a)verizon.com>
---
defs.h | 1 +
remote.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/defs.h b/defs.h
index de10b70..dae9662 100755
--- a/defs.h
+++ b/defs.h
@@ -5530,6 +5530,7 @@ int is_remote_daemon(char *);
physaddr_t get_remote_phys_base(physaddr_t, physaddr_t);
physaddr_t remote_vtop(int, physaddr_t);
int get_remote_regs(struct bt_info *, ulong *, ulong *);
+physaddr_t get_remote_cr3(int);
void remote_fd_init(void);
int get_remote_file(struct remote_file *);
uint remote_page_size(void);
diff --git a/remote.c b/remote.c
index b8a00a7..621942e 100755
--- a/remote.c
+++ b/remote.c
@@ -2446,6 +2446,45 @@ get_remote_regs(struct bt_info *bt, ulong *eip, ulong *esp)
}
/*
+ * Get a remote cr3 if supported.
+ */
+physaddr_t
+get_remote_cr3(int cpu)
+{
+ char sendbuf[BUFSIZE];
+ char recvbuf[BUFSIZE];
+ char *p1;
+ int errflag;
+ ulong value;
+
+ if (!rc->remote_type[0])
+ return 0; /* Not a special remote. */
+
+ BZERO(sendbuf, BUFSIZE);
+ BZERO(recvbuf, BUFSIZE);
+ sprintf(sendbuf, "FETCH_LIVE_CR3 %d", cpu);
+ if (remote_tcp_write_string(pc->sockfd, sendbuf))
+ return 0;
+ remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, NIL_MODE());
+
+ if (CRASHDEBUG(1))
+ fprintf(fp, "get_remote_cr3: [%s]\n", recvbuf);
+
+ if (strstr(recvbuf, "<FAIL>"))
+ error(FATAL, "get_remote_cr3 for CPU %d\n", cpu);
+ p1 = strtok(recvbuf, " "); /* FETCH_LIVE_CR3 */
+ p1 = strtok(NULL, " "); /* cpu */
+ p1 = strtok(NULL, " "); /* cr3 */
+
+ errflag = 0;
+ value = htol(p1, 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