diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-06-17 13:25:08 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-06-17 13:25:08 +0000 |
commit | 59223edaa18759982db0a8aced0e77457d10c68e (patch) | |
tree | 89354903b01fa0a447bffeefe00df3044495db2e /arch/i386/mm | |
parent | db7d4daea91e105e3859cf461d7e53b9b77454b2 (diff) |
Merge with Linux 2.3.6. Sorry, this isn't tested on silicon, I don't
have a MIPS box at hand.
Diffstat (limited to 'arch/i386/mm')
-rw-r--r-- | arch/i386/mm/init.c | 5 | ||||
-rw-r--r-- | arch/i386/mm/ioremap.c | 17 |
2 files changed, 12 insertions, 10 deletions
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index dc96ad4bb..22ebf7a10 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -390,6 +390,7 @@ __initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem)) int datapages = 0; int initpages = 0; unsigned long tmp; + unsigned long endbase; end_mem &= PAGE_MASK; high_memory = (void *) end_mem; @@ -417,8 +418,10 @@ __initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem)) * IBM messed up *AGAIN* in their thinkpad: 0xA0000 -> 0x9F000. * They seem to have done something stupid with the floppy * controller as well.. + * The amount of available base memory is in WORD 40:13. */ - while (start_low_mem < 0x9f000+PAGE_OFFSET) { + endbase = PAGE_OFFSET + ((*(unsigned short *)__va(0x413) * 1024) & PAGE_MASK); + while (start_low_mem < endbase) { clear_bit(PG_reserved, &mem_map[MAP_NR(start_low_mem)].flags); start_low_mem += PAGE_SIZE; } diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index 28250b0bd..32f3c33fd 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c @@ -93,12 +93,17 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag { void * addr; struct vm_struct * area; - unsigned long offset; + unsigned long offset, last_addr; + + /* Don't allow wraparound or zero size */ + last_addr = phys_addr + size - 1; + if (!size || last_addr < phys_addr) + return NULL; /* * Don't remap the low PCI/ISA area, it's always mapped.. */ - if (phys_addr >= 0xA0000 && (phys_addr+size) <= 0x100000) + if (phys_addr >= 0xA0000 && last_addr < 0x100000) return phys_to_virt(phys_addr); /* @@ -112,13 +117,7 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag */ offset = phys_addr & ~PAGE_MASK; phys_addr &= PAGE_MASK; - size = PAGE_ALIGN(size + offset); - - /* - * Don't allow mappings that wrap.. - */ - if (!size || size > phys_addr + size) - return NULL; + size = PAGE_ALIGN(last_addr) - phys_addr; /* * Ok, go for it.. |