trs80m1: switch to separately banked buffers
authorAlan Cox <alan@linux.intel.com>
Fri, 13 Jul 2018 00:26:35 +0000 (01:26 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 13 Jul 2018 00:26:35 +0000 (01:26 +0100)
This is a first cut. The buffers.c code needs rewriting.

Kernel/platform-trs80m1/config.h
Kernel/platform-trs80m1/trs80.h
Kernel/platform-trs80m1/trs80.s

index 5cc1b4e..f1b1803 100644 (file)
@@ -23,6 +23,8 @@
 #define CONFIG_INPUT
 /* Full keycode level grabbing supported */
 #define CONFIG_INPUT_GRABMAX   3
+/* External buffers (so we can balance things better) */
+#define CONFIG_BLKBUF_EXTERNAL
 
 #define MAX_MAPS       16      /* 512K */
 
@@ -64,9 +66,7 @@
 #define NUM_DEV_TTY 3
 #define TTYDEV   BOOT_TTY /* Device used by kernel for messages, panics */
 #define SWAPDEV  (swap_dev)  /* Device for swapping (dynamic). */
-#define NBUFS    5        /* Number of block buffers - keep in sync with asm! */
-#define NMOUNTS         2        /* Number of mounts at a time */
-/* Reclaim the discard space for buffers */
-#define CONFIG_DYNAMIC_BUFPOOL
+#define NBUFS    10        /* Number of block buffers - keep in sync with asm! */
+#define NMOUNTS         3         /* Number of mounts at a time */
 
 extern void platform_discard(void);
index 7c62a01..3200310 100644 (file)
@@ -31,3 +31,5 @@ extern uint8_t trs80_mapper;
  *     Note that the Colour Genie is a very different beast.
  *     
  */
+
+extern void bufsetup(void);
index 9394f7d..90f95f2 100644 (file)
@@ -23,9 +23,6 @@
            .globl s__COMMONMEM
            .globl l__COMMONMEM
 
-           .globl _bufpool
-           .globl bufend
-
            .globl _trs80_model
 
            ; hard disk helpers
             .include "kernel.def"
             .include "../kernel.def"
 
-           .area _BUFFERS
-
-_bufpool:
-           .ds BUFSIZE * NBUFS
-bufend:
 ; -----------------------------------------------------------------------------
 ; COMMON MEMORY BANK (0xE800 upwards)
 ; -----------------------------------------------------------------------------
@@ -197,7 +189,12 @@ outchar:
             ret
 
 ;
-;      Swap helpers
+;      Swap helpers.
+;      We have our buffers mapepd in Bank 2 but we don't need to do
+;      anything here as we are in common memory and we've carefully
+;      arranged that the device driver callers are in BANK2 thus we'll
+;      have BANK2 mapped by default, although we may map a user bank
+;      in temporarily if going direct to user.
 ;
 _hd_xfer_in:
           pop de
@@ -233,3 +230,11 @@ _hd_xfer_out:
           call nz, map_kernel_restore
           ret
 
+
+;
+;      Storage for buffers. Must be banked with CODE2
+;
+           .area _DATA2
+           .globl _bufdata
+_bufdata:
+           .ds 512 * 10