From: Alan Cox Date: Sun, 4 Dec 2016 14:31:30 +0000 (+0000) Subject: coco2cart: reclaim buffers X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7b0da50926eae56fdf91410d4aa62395e84a79b8;p=FUZIX.git coco2cart: reclaim buffers Tidy up the oddments that need deleting, and update the README --- diff --git a/Kernel/platform-coco2cart/README b/Kernel/platform-coco2cart/README index 6c060952..1e4ccf37 100644 --- a/Kernel/platform-coco2cart/README +++ b/Kernel/platform-coco2cart/README @@ -47,17 +47,9 @@ Make the boot loader robust (timeout handling) Add hash of code not just simple magic - so we know bits match Support for a real time clock and clock locking -Review irq disabling. We shouldn't need much of this at all as we don't have -floppy hell to contend with, but the switchin/switchout logic needs to be -reviewed for interrupt safety and the IRQs re-enabled during swap in and -out. We should also be totally clean now on FIR blocking, so audio might -actually be doable if not doing drivewire. - -MPI switching -- Fix IDE to support the map flip on transfers (needs little asm code - adding) -- reclaim discard space by packing bss, then buffers then discard +We should be totally clean now on FIR blocking, so audio might +actually be doable if not doing drivewire. We have about 2K left to try and jam those bits in which might just about be enough to add support for very minimal MBR parsing and offsets. That would diff --git a/Kernel/platform-coco2cart/coco2.s b/Kernel/platform-coco2cart/coco2.s index c32267e9..a0c967e9 100644 --- a/Kernel/platform-coco2cart/coco2.s +++ b/Kernel/platform-coco2cart/coco2.s @@ -22,6 +22,7 @@ .globl _ramsize .globl _procmem .globl _bufpool + .globl _discard_size ; imported .globl unix_syscall_entry @@ -241,3 +242,7 @@ _bufpool: .ds 520*6 ; initial buffers ; Discard follows this so will be reclaimed + + .area .discard +_discard_size: + .db __sectionlen_.discard__/BUFSIZE diff --git a/Kernel/platform-coco2cart/main.c b/Kernel/platform-coco2cart/main.c index 0c2114c7..2bba5970 100644 --- a/Kernel/platform-coco2cart/main.c +++ b/Kernel/platform-coco2cart/main.c @@ -9,12 +9,8 @@ uint8_t membanks; uint8_t system_id; -#if 0 -uint8_t cartslots = 1; -uint8_t carttype[4]; -uint8_t bootslot = 0; -#endif uint16_t swap_dev; +struct blkbuf *bufpool_end = bufpool + NBUFS; void platform_idle(void) { @@ -31,24 +27,18 @@ void do_beep(void) void platform_discard(void) { -} -#if 0 -/* Find a cartridge or it's slot */ -int cart_find(int id) -{ - int i; - for (i = 0; i < id; i++) { - if (carttype[i] == id) - return i; + extern uint8_t discard_size; + bufptr bp = bufpool_end; + + kprintf("%d buffers reclaimed from discard\n", discard_size); + + bufpool_end += discard_size; /* Reclaim the discard space */ + + memset(bp, 0, discard_size * sizeof(struct blkbuf)); + /* discard_size is in discard so it dies here */ + for (bp = bufpool + NBUFS; bp < bufpool_end; ++bp) { + bp->bf_dev = NO_DEVICE; + bp->bf_busy = BF_FREE; } - return -1; } -#endif -unsigned char vt_mangle_6847(unsigned char c) -{ - if (c >= 96) - c -= 32; - c &= 0x3F; - return c; -}