+#include <stdio.h>
#include "malloc.h"
#include "mem.h"
#include "asmutil.h"
if((first = alloc_blocks(numblk)) == -1) {
return -1;
}
+ pool = MK_FP(first << 6, 0);
pool->magic = MAGIC_FREE;
- pool = MK_FP(first >> 6, 0);
pool->len = (unsigned long)numblk * MEM_BLKSZ;
pool->next = pool->prev = 0;
#include "config.h"
#include <stdio.h>
+#include <malloc.h>
#include "intr.h"
#include "vid.h"
#include "ser.h"
#include "con.h"
+#include "mem.h"
#include "dbg.h"
void kmain(void)
vid_init();
ser_init();
con_init();
+ mem_init();
printf("eightysix kernel %s\n", VERSTR);
+ void __far *ptr = kmalloc(2000);
+ printf("allocated 2k at: %x:%x\n", FP_SEG(ptr), FP_OFFS(ptr));
+ kfree(ptr);
+ printf("freed\n");
+ ptr = kmalloc(256);
+ printf("allocated 256b, got: %x:%x\n", FP_SEG(ptr), FP_OFFS(ptr));
+ ptr = kmalloc(512);
+ printf("allocated 512 more at: %x:%x\n", FP_SEG(ptr), FP_OFFS(ptr));
+
init_intr();
}
+#include <stdio.h>
#include <inttypes.h>
#include "mem.h"
#include "malloc.h"
#define mark_alloc(blk, n) mark(blk, n, 1)
#define mark_free(blk, n) mark(blk, n, 0)
+/*
+static void print_mem_bitmap(void)
+{
+ int i;
+ for(i=0; i<BLKMAP_SZ/8; i++) {
+ printf("%04x: %04x %04x %04x %04x ", (unsigned int)i << 4,
+ blkmap[i*8], blkmap[i*8+1], blkmap[i*8+2], blkmap[i*8+3]);
+ printf("%04x %04x %04x %04x\n", blkmap[i*8+4], blkmap[i*8+5],
+ blkmap[i*8+6], blkmap[i*8+7]);
+ }
+}
+*/
int mem_init(void)
{