.globl map_restore
.globl _need_resched
.globl _hz
+ .globl _bufpool
+ .globl _discard_size
; exported debugging tools
.globl _trap_monitor
include "kernel.def"
include "../kernel09.def"
+
+ .area .buffers
+
+_bufpool:
+ .ds BUFSIZE*NBUFS
+
+ .area .discard
+_discard_size:
+ .db __sectionlen_.discard__/BUFSIZE
+
; -----------------------------------------------------------------------------
; COMMON MEMORY BANK
; -----------------------------------------------------------------------------
/* Use C helpers for usermem */
#undef CONFIG_USERMEM_C
+/* Reclaim discard space for buffers */
+#define CONFIG_DYNAMIC_BUFPOOL
+
/* We use flexible 16K banks so use the helper */
#define CONFIG_BANK16
#define CONFIG_BANKS 4
#define MAX_BLKDEV 4 /* 2 IDE + 2 SDC */
#define DEVICE_IDE /* enable if IDE interface present */
-#define platform_discard()
section .text.hot
section .test.unlikely
section .data
-section .bss
+section .buffers
section .discard
+section .bss
section .udata load 0xe000
section .common
section .cpage load 0xfe00
;; asm/c shared IDE stuff
IDEDATA equ 0xFF50
-IDEDATA_L equ 0xFF58
\ No newline at end of file
+IDEDATA_L equ 0xFF58
+
+
+NBUFS equ 5
\ No newline at end of file
#include <devtty.h>
+struct blkbuf *bufpool_end = bufpool + NBUFS;
+
+void platform_discard(void)
+{
+ extern uint8_t discard_size;
+ bufptr bp = bufpool_end;
+
+ kprintf("%d buffers reclaimed from discard\n", discard_size);
+
+ bufpool_end += discard_size;
+
+ memset( bp, 0, discard_size * sizeof(struct blkbuf) );
+
+ for( bp = bufpool + NBUFS; bp < bufpool_end; ++bp ){
+ bp->bf_dev = NO_DEVICE;
+ bp->bf_busy = BF_FREE;
+ }
+}
+
+
void platform_idle(void)
{
}