zx128: disabling microdrive swapping as it is broken for now
authorAlexander Tsidaev <a.tsidaev@gmail.com>
Sun, 31 Jul 2016 18:14:34 +0000 (23:14 +0500)
committerAlexander Tsidaev <a.tsidaev@gmail.com>
Sun, 31 Jul 2016 18:14:34 +0000 (23:14 +0500)
Kernel/platform-zx128/bank128.c
Kernel/platform-zx128/config.h
Kernel/platform-zx128/devfd.c
Kernel/platform-zx128/devices.c
Kernel/platform-zx128/devmdv.c
Kernel/platform-zx128/main.c

index 0a2823e..a55098e 100644 (file)
@@ -32,8 +32,10 @@ void pagemap_free(ptptr p)
 
 int pagemap_alloc(ptptr p)
 {
+#ifdef SWAPDEV
        if (pfptr == 0)
                swapneeded(p, 1);
+#endif
        if (pfptr == 0)
                return ENOMEM;
        p->p_page = pfree[--pfptr];
@@ -59,6 +61,9 @@ uint16_t pagemap_mem_used(void)
  */
 int swapout(ptptr p)
 {
+#ifndef SWAPDEV
+       p; /* to shut the compiler */
+#else
        uint16_t blk;
        uint16_t map;
 
@@ -88,6 +93,7 @@ int swapout(ptptr p)
        p->p_page2 = map;
 #ifdef DEBUG
        kprintf("%x: swapout done %d\n", p, p->p_page);
+#endif
 #endif
        return 0;
 }
@@ -99,6 +105,9 @@ int swapout(ptptr p)
  */
 void swapin(ptptr p, uint16_t map)
 {
+#ifndef SWAPDEV
+       p;map; /* to shut the compiler */
+#else
        uint16_t blk = map * SWAP_SIZE;
 
 #ifdef DEBUG
@@ -124,4 +133,5 @@ void swapin(ptptr p, uint16_t map)
 #ifdef DEBUG
        kprintf("%x: swapin done %d\n", p, p->p_page);
 #endif
+#endif
 }
index 5b87221..4928dbb 100644 (file)
@@ -52,7 +52,7 @@
 #define NUM_DEV_TTY 1
 
 #define TTYDEV   BOOT_TTY /* Device used by kernel for messages, panics */
-#define SWAPDEV  2051  /* Microdrive 3 : FIXME - configure and probe */
+/* #define SWAPDEV  2051 */ /* Microdrive 3 : FIXME - configure and probe */
 #define NBUFS    9       /* Number of block buffers */
 #define NMOUNTS         4        /* Number of mounts at a time */
 #define MAX_BLKDEV 2       /* 2 IDE drives, 1 SD drive */
index dcd2b7a..e1b017a 100644 (file)
@@ -3,6 +3,8 @@
 #include <printf.h>
 #include <devfd.h>
 
+#include "disciple.h"
+
 #define MAX_FD 2
 
 #define OPDIR_NONE     0
index bc9b296..72a43e2 100644 (file)
@@ -48,7 +48,10 @@ void device_init(void)
 #ifdef CONFIG_IDE
   devide_init();
 #endif
+
+#ifdef SWAPDEV
   /* Hack for now - we need to open the swap to get the map. Should
      we open swap nicely somewhere generic ? */
   d_open(SWAPDEV, 0);
+#endif
 }
index 3fd7cd6..2fb1156 100644 (file)
@@ -58,11 +58,16 @@ static int mdv_transfer(uint8_t minor, bool is_read, uint8_t rawflag)
                block = udata.u_offset >> 9;
                mdv_page = udata.u_page;
        } else {
+#ifdef SWAPDEV
                /* Microdrive swap awesomeness */
                mdv_buf = swapbase;
                nblock = swapcnt >> 9;
                block = swapblk;
                mdv_page = swappage;
+#else
+               /* Attempt to swap when swapping is disabled */
+               goto bad;
+#endif
        }
 
        irq = di();
index e02ff2f..614d16b 100644 (file)
@@ -9,10 +9,12 @@ uint16_t ramtop = PROGTOP;
 
 void pagemap_init(void)
 {
+#ifdef SWAPDEV
   /* Swap */
   swapmap_add(0);
   swapmap_add(1);
   swapmap_add(2);
+#endif
 }
 
 /* On idle we spin checking for the terminals. Gives us more responsiveness
@@ -42,3 +44,11 @@ void platform_interrupt(void)
 void map_init(void)
 {
 }
+
+#ifndef SWAPDEV
+/* Adding dummy swapper since it is referenced by tricks.s */
+void swapper(ptptr p)
+{
+  p;
+}
+#endif
\ No newline at end of file