#define PROGBASE 0x0000 /* also data base */
#define PROGLOAD 0x0100 /* also data base */
#define PROGTOP 0xF800 /* Top of program, base of U_DATA copy */
+#define KERNTOP 0xF000 /* Kernel has lower 60KB */
#define PROC_SIZE 64 /* Memory needed per process */
/* We need a tidier way to do this from the loader */
#define NUM_DEV_TTY 5
#define TTYDEV (512+1) /* System console (used by kernel, init) */
-#define NBUFS 10 /* Number of block buffers */
+
+#define CONFIG_DYNAMIC_BUFPOOL /* we expand bufpool to overwrite the _DISCARD segment at boot */
+#define NBUFS 4 /* Number of block buffers, keep in line with space reserved in p112.s */
#define NMOUNTS 4 /* Number of mounts at a time */
/* Hardware parameters */
/* We have the P112 floppy controller */
#define CONFIG_P112_FLOPPY
-
-#define platform_discard()
.area _HEAP
; note that areas below here may be overwritten by the heap at runtime, so
; put initialisation stuff in here
+ .area _BUFFERS ; _BUFFERS grows to consume all before it (up to KERNTOP)
.area _INITIALIZER
.area _GSINIT
.area _GSFINAL
{
ramsize = 1024;
procmem = 1024 - 64 - (DEV_RD_RAM_PAGES<<2);
+ /* zero out the initial bufpool */
+ memset(bufpool, 0, (char*)bufpool_end - (char*)bufpool);
}
void pagemap_init(void)
uint16_t ramtop = PROGTOP;
extern unsigned char irqvector;
+struct blkbuf *bufpool_end = bufpool + NBUFS; /* minimal for boot -- expanded after we're done with _DISCARD */
+
+void platform_discard(void)
+{
+ while(bufpool_end < (struct blkbuf*)(KERNTOP - sizeof(struct blkbuf))){
+ memset(bufpool_end, 0, sizeof(struct blkbuf));
+#if BF_FREE != 0
+ bufpool_end->bf_busy = BF_FREE; /* redundant when BF_FREE == 0 */
+#endif
+ bufpool_end->bf_dev = NO_DEVICE;
+ bufpool_end++;
+ }
+}
void z180_timer_interrupt(void)
{
.globl outcharhex
.globl platform_interrupt_all
.globl _trap_reboot
+ .globl _bufpool
; imported symbols
.globl z180_init_hardware
.include "../cpu-z180/z180.def"
.include "../kernel.def"
+; -----------------------------------------------------------------------------
+; Buffers
+; -----------------------------------------------------------------------------
+ .area _BUFFERS
+_bufpool:
+ .ds (BUFSIZE * 4) ; adjust NBUFS in config.h in line with this
+
; -----------------------------------------------------------------------------
; Initialisation code
; -----------------------------------------------------------------------------