From: Alan Cox Date: Fri, 13 Feb 2015 15:46:58 +0000 (+0000) Subject: zx128: switch to mainline bankfixed X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=36c0264272dc668f01d149eb70b9072e9ea35880;p=FUZIX.git zx128: switch to mainline bankfixed It now handles the cases that prevented it being used --- diff --git a/Kernel/platform-zx128/Makefile b/Kernel/platform-zx128/Makefile index 8ef7ed48..37f4a148 100644 --- a/Kernel/platform-zx128/Makefile +++ b/Kernel/platform-zx128/Makefile @@ -1,4 +1,4 @@ -CSRCS = devtty.c bankzx128.c devices.c main.c devmdv.c +CSRCS = devtty.c devices.c main.c devmdv.c DSRCS = ../dev/devide.c ../dev/mbr.c ../dev/blkdev.c DDSRCS = ../dev/devide_discard.c ASRCS = crt0.s zx128.s zxvideo.s microdrive.s diff --git a/Kernel/platform-zx128/bankzx128.c b/Kernel/platform-zx128/bankzx128.c deleted file mode 100644 index ef5b3208..00000000 --- a/Kernel/platform-zx128/bankzx128.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include - -/* This is copied version of bankfixed.c - The only difference is pagemap_realloc function. - Since we have PROGBASE at 0xC000, pagemap_realloc - returned ENOMEM even when 0 bytes were requested - - FIXME: need to redo this in pairs and add swap */ - -/* Kernel is 0, apps 1,2,3 etc */ -static unsigned char pfree[MAX_MAPS]; -static unsigned char pfptr = 0; -static unsigned char pfmax; - -void pagemap_add(uint8_t page) -{ - pfree[pfptr++] = page; - pfmax = pfptr; -} - -void pagemap_free(ptptr p) -{ - if (p->p_page == 0) - panic("free0"); - pfree[pfptr++] = p->p_page; -} - -int pagemap_alloc(ptptr p) -{ -#ifdef SWAP_DEV - if (pfptr == 0) { - swapneeded(p, 1); - } -#endif - if (pfptr == 0) - return ENOMEM; - p->p_page = pfree[--pfptr]; - return 0; -} - -/* Realloc is trivial - we can't do anything useful */ -int pagemap_realloc(uint16_t size) -{ - if (size - PROGBASE >= MAP_SIZE) - return ENOMEM; - return 0; -} - -uint16_t pagemap_mem_used(void) -{ - return (pfmax - pfptr) * (MAP_SIZE >> 10); -} diff --git a/Kernel/platform-zx128/config.h b/Kernel/platform-zx128/config.h index 4d352cdc..9235758d 100644 --- a/Kernel/platform-zx128/config.h +++ b/Kernel/platform-zx128/config.h @@ -31,11 +31,8 @@ #undef CONFIG_FONT8X8 #undef CONFIG_FONT8X8SMALL -/* We have 1 bank at C000 with 6 possible pages to map. - Our choice should be CONFIG_BANK_FIXED, but we are. - using custom implementation of it */ - -#undef CONFIG_BANK_FIXED +/* Two fixed banks in use */ +#define CONFIG_BANK_FIXED /* We have two mappings from our 128K of memory */ #define MAX_MAPS 2 diff --git a/Kernel/platform-zx128/fuzix.lnk b/Kernel/platform-zx128/fuzix.lnk index 0d3d2b6a..56a58d12 100644 --- a/Kernel/platform-zx128/fuzix.lnk +++ b/Kernel/platform-zx128/fuzix.lnk @@ -35,7 +35,7 @@ tty.rel vt.rel font8x8.rel mm.rel -platform-zx128/bankzx128.rel +bankfixed.rel swap.rel devsys.rel platform-zx128/devtty.rel