diff options
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386at/biosmem.c | 18 | ||||
-rw-r--r-- | i386/i386at/biosmem.h | 6 | ||||
-rw-r--r-- | i386/i386at/mem.c | 18 |
3 files changed, 25 insertions, 17 deletions
diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c index 9f86b66a..4f0914ca 100644 --- a/i386/i386at/biosmem.c +++ b/i386/i386at/biosmem.c @@ -995,3 +995,21 @@ biosmem_free_usable(void) biosmem_free_usable_entry(start, end); } } + +boolean_t +biosmem_addr_available(phys_addr_t addr) +{ + struct biosmem_map_entry *entry; + unsigned i; + + if (addr < BIOSMEM_BASE) + return FALSE; + + for (i = 0; i < biosmem_map_size; i++) { + entry = &biosmem_map[i]; + + if (addr >= entry->base_addr && addr < entry->base_addr + entry->length) + return entry->type == BIOSMEM_TYPE_AVAILABLE; + } + return FALSE; +} diff --git a/i386/i386at/biosmem.h b/i386/i386at/biosmem.h index 7824c168..76ab23a0 100644 --- a/i386/i386at/biosmem.h +++ b/i386/i386at/biosmem.h @@ -100,4 +100,10 @@ void biosmem_setup(void); */ void biosmem_free_usable(void); +/* + * Tell whether this address is marked as available in the biosmem and thus used + * for usable memory. + */ +boolean_t biosmem_addr_available(phys_addr_t addr); + #endif /* _X86_BIOSMEM_H */ diff --git a/i386/i386at/mem.c b/i386/i386at/mem.c index 61143185..e42e995d 100644 --- a/i386/i386at/mem.c +++ b/i386/i386at/mem.c @@ -36,24 +36,8 @@ dev_t dev; vm_offset_t off; vm_prot_t prot; { - struct vm_page *p; - - if (off == 0) - return 0; - - /* - * The legacy device mappings are included in the page tables and - * need their own test. - */ - if (off >= 0xa0000 && off < 0x100000) - goto out; - - p = vm_page_lookup_pa(off); - - if (p != NULL) { + if (biosmem_addr_available(off)) return -1; - } -out: return i386_btop(off); } |