int pagemap_alloc(ptptr p)
{
+#ifdef SWAPDEV
if (pfptr == 0)
swapneeded(p, 1);
+#endif
if (pfptr == 0)
return ENOMEM;
p->p_page = pfree[--pfptr];
*/
int swapout(ptptr p)
{
+#ifndef SWAPDEV
+ p; /* to shut the compiler */
+#else
uint16_t blk;
uint16_t map;
p->p_page2 = map;
#ifdef DEBUG
kprintf("%x: swapout done %d\n", p, p->p_page);
+#endif
#endif
return 0;
}
*/
void swapin(ptptr p, uint16_t map)
{
+#ifndef SWAPDEV
+ p;map; /* to shut the compiler */
+#else
uint16_t blk = map * SWAP_SIZE;
#ifdef DEBUG
#ifdef DEBUG
kprintf("%x: swapin done %d\n", p, p->p_page);
#endif
+#endif
}
#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 */
#include <printf.h>
#include <devfd.h>
+#include "disciple.h"
+
#define MAX_FD 2
#define OPDIR_NONE 0
#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
}
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();
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
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