From: Don Slutz <[email protected]>

---
 defs.h   |  1 +
 remote.c | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/defs.h b/defs.h
index adbfadc..7a77dab 100755
--- a/defs.h
+++ b/defs.h
@@ -5529,6 +5529,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 4b0388d..67e5ba8 100755
--- a/remote.c
+++ b/remote.c
@@ -2439,6 +2439,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, *p2, *p3;
+       int errflag;
+       ulong value;
+
+       if (!rc->remoteType[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, pc->flags2 & 
REMOTE_NIL);
+
+       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 */
+       p2 = strtok(NULL, " ");     /* cpu */
+       p3 = strtok(NULL, " ");     /* cr3 */
+
+       errflag = 0;
+       value = htol(p3, 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

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to