diff options
author | bde <bde@FreeBSD.org> | 1998-01-19 14:27:41 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-01-19 14:27:41 +0000 |
commit | 314c0741a961ab83f999b41d7edf55acc00569b6 (patch) | |
tree | eed1b7229e1b772ba2ed3039b88e7408def87fba /gnu | |
parent | 421158c94f47608d01fa044da1e014dbad7e436e (diff) | |
download | FreeBSD-src-314c0741a961ab83f999b41d7edf55acc00569b6.zip FreeBSD-src-314c0741a961ab83f999b41d7edf55acc00569b6.tar.gz |
Removed `kstack' and associated mistranslations in kvtophys().
Correct translations would have been null. However, kstack was
the top of the kernel stack instead of the base of the kernel stack
like it was when the kernel exported it, so the area above the
kernel stack was mistranslated and the kernel stack was not
translated. This bug was depended on to compensate for the wrong
value of kstack - to read the pcb, instead of just using the address
of the pcb, we used the mistranslated address of kstack, which
happened to be the same (curpcb = kstack - 0x2000).
This area is simpler than it used to be now that the kernel stack
address is per-process. The code still seems to be more complicated
than necessary - the `found_pcb == 0' case seems to be unused.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c | 19 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/kvm-fbsd.c | 19 | ||||
-rw-r--r-- | gnu/usr.bin/gdb/gdb/kvm-fbsd.c | 19 |
3 files changed, 3 insertions, 54 deletions
diff --git a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c index 5cb03113..970d3a8 100644 --- a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c @@ -453,7 +453,6 @@ set_proc_cmd (arg, from_tty) static CORE_ADDR sbr; static CORE_ADDR curpcb; -static CORE_ADDR kstack; static int found_pcb; static int devmem; static int kfd; @@ -473,9 +472,7 @@ kvm_open (efile, cfile, sfile, perm, errout) char *errout; /* makes this kvm_open more compatible to the one in libkvm */ { struct stat stb; - CORE_ADDR addr; int cfd; - struct i386tss cts; if ((cfd = open (cfile, perm, 0)) < 0) return (cfd); @@ -492,14 +489,12 @@ kvm_open (efile, cfile, sfile, perm, errout) printf ("IdlePTD %x\n", sbr); curpcb = ksym_lookup ("curpcb") - KERNOFF; physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb); - physrd (cfd, ksym_lookup ("common_tss") - KERNOFF, (char*)&cts, sizeof cts); - kstack = cts.tss_ksp; found_pcb = 1; /* for vtophys */ if (!devmem) read_pcb (cfd, ksym_lookup ("dumppcb") - KERNOFF); else - read_pcb (cfd, kvtophys (cfd, kstack)); + read_pcb (cfd, kvtophys (cfd, curpcb)); return (cfd); } @@ -722,18 +717,6 @@ kvtophys (fd, addr) CORE_ADDR current_ptd; /* - * If we're looking at the kernel stack, - * munge the address to refer to the user space mapping instead; - * that way we get the requested process's kstack, not the running one. - */ - /* - * this breaks xlating user addresses from a crash dump so only - * do it for a "live" kernel. - */ - if (devmem && addr >= kstack && addr < kstack + ctob (UPAGES)) - addr = (addr - kstack) + curpcb; - - /* * We may no longer have a linear system page table... * * Here's the scoop. IdlePTD contains the physical address diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c index 5cb03113..970d3a8 100644 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c @@ -453,7 +453,6 @@ set_proc_cmd (arg, from_tty) static CORE_ADDR sbr; static CORE_ADDR curpcb; -static CORE_ADDR kstack; static int found_pcb; static int devmem; static int kfd; @@ -473,9 +472,7 @@ kvm_open (efile, cfile, sfile, perm, errout) char *errout; /* makes this kvm_open more compatible to the one in libkvm */ { struct stat stb; - CORE_ADDR addr; int cfd; - struct i386tss cts; if ((cfd = open (cfile, perm, 0)) < 0) return (cfd); @@ -492,14 +489,12 @@ kvm_open (efile, cfile, sfile, perm, errout) printf ("IdlePTD %x\n", sbr); curpcb = ksym_lookup ("curpcb") - KERNOFF; physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb); - physrd (cfd, ksym_lookup ("common_tss") - KERNOFF, (char*)&cts, sizeof cts); - kstack = cts.tss_ksp; found_pcb = 1; /* for vtophys */ if (!devmem) read_pcb (cfd, ksym_lookup ("dumppcb") - KERNOFF); else - read_pcb (cfd, kvtophys (cfd, kstack)); + read_pcb (cfd, kvtophys (cfd, curpcb)); return (cfd); } @@ -722,18 +717,6 @@ kvtophys (fd, addr) CORE_ADDR current_ptd; /* - * If we're looking at the kernel stack, - * munge the address to refer to the user space mapping instead; - * that way we get the requested process's kstack, not the running one. - */ - /* - * this breaks xlating user addresses from a crash dump so only - * do it for a "live" kernel. - */ - if (devmem && addr >= kstack && addr < kstack + ctob (UPAGES)) - addr = (addr - kstack) + curpcb; - - /* * We may no longer have a linear system page table... * * Here's the scoop. IdlePTD contains the physical address diff --git a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c index 5cb03113..970d3a8 100644 --- a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c +++ b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c @@ -453,7 +453,6 @@ set_proc_cmd (arg, from_tty) static CORE_ADDR sbr; static CORE_ADDR curpcb; -static CORE_ADDR kstack; static int found_pcb; static int devmem; static int kfd; @@ -473,9 +472,7 @@ kvm_open (efile, cfile, sfile, perm, errout) char *errout; /* makes this kvm_open more compatible to the one in libkvm */ { struct stat stb; - CORE_ADDR addr; int cfd; - struct i386tss cts; if ((cfd = open (cfile, perm, 0)) < 0) return (cfd); @@ -492,14 +489,12 @@ kvm_open (efile, cfile, sfile, perm, errout) printf ("IdlePTD %x\n", sbr); curpcb = ksym_lookup ("curpcb") - KERNOFF; physrd (cfd, curpcb, (char*)&curpcb, sizeof curpcb); - physrd (cfd, ksym_lookup ("common_tss") - KERNOFF, (char*)&cts, sizeof cts); - kstack = cts.tss_ksp; found_pcb = 1; /* for vtophys */ if (!devmem) read_pcb (cfd, ksym_lookup ("dumppcb") - KERNOFF); else - read_pcb (cfd, kvtophys (cfd, kstack)); + read_pcb (cfd, kvtophys (cfd, curpcb)); return (cfd); } @@ -722,18 +717,6 @@ kvtophys (fd, addr) CORE_ADDR current_ptd; /* - * If we're looking at the kernel stack, - * munge the address to refer to the user space mapping instead; - * that way we get the requested process's kstack, not the running one. - */ - /* - * this breaks xlating user addresses from a crash dump so only - * do it for a "live" kernel. - */ - if (devmem && addr >= kstack && addr < kstack + ctob (UPAGES)) - addr = (addr - kstack) + curpcb; - - /* * We may no longer have a linear system page table... * * Here's the scoop. IdlePTD contains the physical address |