bank16/32k: compute common area allowance
authorAlan Cox <alan@etchedpixels.co.uk>
Fri, 21 Nov 2014 15:05:04 +0000 (15:05 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Fri, 21 Nov 2014 15:05:04 +0000 (15:05 +0000)
We propogate the common into each high bank so must allow for it. Remove
the hardcoded 4K assumption as it's trivial to do so, and also socz80 at
least doesn't need 0xF000 to be the common base.

Kernel/bank16k.c
Kernel/bank32k.c

index a575ff6..cfb8059 100644 (file)
@@ -40,8 +40,10 @@ void pagemap_free(ptptr p)
 
 static int maps_needed(uint16_t top)
 {
-       /* FIXME: unhardwire the 0x1000 common assumption ! */
-       uint16_t needed = top + 0xFFF;  /* 0x1000 common - 1 for shift and inc */
+       /* On many platforms if you touch this or PROGTOP you must
+          touch tricks.s */
+       uint16_t needed = top + 0xFFFF - PROGTOP;
+       /* Usually we have 0x1000 common - 1 for shift and inc */
        needed >>= 14;          /* in banks */
        needed++;               /* rounded */
        return needed;
index 5b193fb..e9b388d 100644 (file)
@@ -67,8 +67,10 @@ void pagemap_free(ptptr p)
 
 static int maps_needed(uint16_t top)
 {
-       /* FIXME: unhardwire the 4K common assumption */
-       uint16_t needed = top + 0xFFF;  /* 0x1000 common - 1 for shift and inc */
+       /* On many platforms if you touch this or PROGTOP you must
+          touch tricks.s */
+       uint16_t needed = top + 0xFFFF - PROGTOP;
+       /* Usually we have 0x1000 common - 1 for shift and inc */
        if (needed & 0x8000)
                return 2;
        return return 1;