diff options
author | joerg <joerg@FreeBSD.org> | 1997-09-10 12:31:40 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1997-09-10 12:31:40 +0000 |
commit | adb1bbd53fc3af34ba996c57177768fe3f7b9f56 (patch) | |
tree | 6964851f918d67f4f73e73a9003e75482063dff0 | |
parent | 9631b54264e1c524f0da7c350dc7838b3711bc30 (diff) | |
download | FreeBSD-src-adb1bbd53fc3af34ba996c57177768fe3f7b9f56.zip FreeBSD-src-adb1bbd53fc3af34ba996c57177768fe3f7b9f56.tar.gz |
Do not ever try to coredump adapter memory regions.
PR: 4486
Submitted by: tegge@idi.ntnu.no (Tor Egge)
Implement a function is_adapter_memory() in order to determine what
should nto be dumped at all. Currently, only populated with the ``ISA
memory hole''. Adapter regions of other busses should be added.
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 30 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 3 | ||||
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 30 | ||||
-rw-r--r-- | sys/i386/include/md_var.h | 3 | ||||
-rw-r--r-- | sys/i386/isa/wd.c | 10 | ||||
-rw-r--r-- | sys/scsi/sd.c | 10 |
6 files changed, 76 insertions, 10 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 7c93b00..dcb2a9a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.86 1997/08/26 18:10:34 peter Exp $ + * $Id: vm_machdep.c,v 1.87 1997/09/02 20:05:31 bde Exp $ */ #include "npx.h" @@ -957,3 +957,31 @@ vm_page_zero_idle() #endif return (1); } + +/* + * Tell whether this address is in some adapter memory region. + * Currently used by the kernel coredump code in order to avoid + * dumping the ``ISA memory hole'' which could cause indefinite hangs, + * or other unpredictable behaviour. + */ + +#include "isa.h" + +int +is_adapter_memory(addr) + vm_offset_t addr; +{ + +#if NISA > 0 + /* The ISA ``memory hole''. */ + if (addr >= 0xa0000 && addr < 0x100000) + return 1; +#endif + + /* + * stuff other tests for known memory-mapped devices (PCI?) + * here + */ + + return 0; +} diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index b5f6625..086704a 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: md_var.h,v 1.15 1997/06/15 02:02:55 wollman Exp $ + * $Id: md_var.h,v 1.16 1997/08/09 00:03:14 dyson Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -68,6 +68,7 @@ void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es)); void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault)); int fill_regs __P((struct proc *p, struct reg *regs)); void fillw __P((int /*u_short*/ pat, void *base, size_t cnt)); +int is_adapter_memory __P((vm_offset_t addr)); u_long kvtop __P((void *addr)); void setidt __P((int idx, alias_for_inthand_t *func, int typ, int dpl, int selec)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 7c93b00..dcb2a9a 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.86 1997/08/26 18:10:34 peter Exp $ + * $Id: vm_machdep.c,v 1.87 1997/09/02 20:05:31 bde Exp $ */ #include "npx.h" @@ -957,3 +957,31 @@ vm_page_zero_idle() #endif return (1); } + +/* + * Tell whether this address is in some adapter memory region. + * Currently used by the kernel coredump code in order to avoid + * dumping the ``ISA memory hole'' which could cause indefinite hangs, + * or other unpredictable behaviour. + */ + +#include "isa.h" + +int +is_adapter_memory(addr) + vm_offset_t addr; +{ + +#if NISA > 0 + /* The ISA ``memory hole''. */ + if (addr >= 0xa0000 && addr < 0x100000) + return 1; +#endif + + /* + * stuff other tests for known memory-mapped devices (PCI?) + * here + */ + + return 0; +} diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index b5f6625..086704a 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: md_var.h,v 1.15 1997/06/15 02:02:55 wollman Exp $ + * $Id: md_var.h,v 1.16 1997/08/09 00:03:14 dyson Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -68,6 +68,7 @@ void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es)); void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault)); int fill_regs __P((struct proc *p, struct reg *regs)); void fillw __P((int /*u_short*/ pat, void *base, size_t cnt)); +int is_adapter_memory __P((vm_offset_t addr)); u_long kvtop __P((void *addr)); void setidt __P((int idx, alias_for_inthand_t *func, int typ, int dpl, int selec)); diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 5537a4a..f633ebc 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.135 1997/08/09 01:44:25 julian Exp $ + * $Id: wd.c,v 1.136 1997/09/04 18:49:47 sos Exp $ */ /* TODO: @@ -2106,8 +2106,12 @@ out: return (EIO); } while (blkcnt != 0) { - pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, trunc_page(addr), - VM_PROT_READ, TRUE); + if (is_adapter_memory((vm_offset_t)addr)) + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page(0), VM_PROT_READ, TRUE); + else + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page(addr), VM_PROT_READ, TRUE); /* Ready to send data? */ DELAY(5); /* ATA spec */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index fe7ba61..0bc2ca0 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -15,7 +15,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.107 1997/08/09 01:44:22 julian Exp $ + * $Id: sd.c,v 1.108 1997/09/02 20:06:37 bde Exp $ */ #include "opt_bounce.h" @@ -997,8 +997,12 @@ sddump(dev_t dev) blknum = dumplo + blkoff; while (num > 0) { - pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, trunc_page(addr), - VM_PROT_READ, TRUE); + if (is_adapter_memory((vm_offset_t)addr)) + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page(0), VM_PROT_READ, TRUE); + else + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, + trunc_page(addr), VM_PROT_READ, TRUE); /* * Fill out the scsi command */ |