diff options
author | raj <raj@FreeBSD.org> | 2008-08-04 14:47:49 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2008-08-04 14:47:49 +0000 |
commit | f01384ca9cd73cda9dd50aba50877fd3228896fa (patch) | |
tree | 07ace65368d1f703280a65eb40c1dbedc15ff04e /sys/arm | |
parent | f262e1ff14f0fd3be77d380f3f1c8d7947f56566 (diff) | |
download | FreeBSD-src-f01384ca9cd73cda9dd50aba50877fd3228896fa.zip FreeBSD-src-f01384ca9cd73cda9dd50aba50877fd3228896fa.tar.gz |
Fix ARM nocache allocator:
- let the loop iterate every page (as intended), and not some multiplies
(which led to a fake exhaustion of the ARM_NOCACHE_KVA_SIZE)
- eliminate using MIN(): it compared number of pages vs. address
(ARM_TP_ADDRESS), which was bogus
Reviewed by: cognet, imp
Obtained from: Piotr Ziecik kosmo ! semihalf dot com
MFC after: 3 days
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/vm_machdep.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 4557b0f..0867153 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -410,10 +410,9 @@ void * arm_remap_nocache(void *addr, vm_size_t size) { int i, j; - + size = round_page(size); - for (i = 0; i < MIN(ARM_NOCACHE_KVA_SIZE / (PAGE_SIZE * BITS_PER_INT), - ARM_TP_ADDRESS); i++) { + for (i = 0; i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE; i++) { if (!(arm_nocache_allocated[i / BITS_PER_INT] & (1 << (i % BITS_PER_INT)))) { for (j = i; j < i + (size / (PAGE_SIZE)); j++) @@ -424,8 +423,7 @@ arm_remap_nocache(void *addr, vm_size_t size) break; } } - if (i < MIN(ARM_NOCACHE_KVA_SIZE / (PAGE_SIZE * BITS_PER_INT), - ARM_TP_ADDRESS)) { + if (i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE) { vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE; void *ret = (void *)tomap; vm_paddr_t physaddr = vtophys((vm_offset_t)addr); @@ -438,6 +436,7 @@ arm_remap_nocache(void *addr, vm_size_t size) } return (ret); } + return (NULL); } |