diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/00.build/Makefile | 8 | ||||
| -rw-r--r-- | include/08.heap/heap.c | 1 | ||||
| -rw-r--r-- | include/08.heap/heap23.c | 10 | ||||
| -rw-r--r-- | include/08.heap/heap24.c | 13 | ||||
| -rw-r--r-- | include/08.heap/heap25.c | 4 | ||||
| -rw-r--r-- | include/08.heap/heap26.c | 5 | ||||
| -rw-r--r-- | include/08.heap/heap27.c | 4 | ||||
| -rw-r--r-- | include/08.heap/heap28.c | 4 | ||||
| -rw-r--r-- | include/08.heap/heap29.c | 4 | ||||
| -rw-r--r-- | include/08.heap/heap30.c | 4 |
10 files changed, 30 insertions, 27 deletions
diff --git a/include/00.build/Makefile b/include/00.build/Makefile index 406447a..ae4f8af 100644 --- a/include/00.build/Makefile +++ b/include/00.build/Makefile @@ -18,7 +18,9 @@ export CFLAGS=-std=gnu99 -O3 $(WARNINGS) -ffreestanding -fstack-protector-all export MKDIR=mkdir -p export RM=rm -rf export CP=cp -r -QEMU=qemu-system-i386 +QEMU=qemu-system-x86_64 +QEMU_FLAGS=-enable-kvm +QEMU_DEBUG= @@ -98,7 +100,7 @@ iso: compile $(MAKE) $(ISO) run: compile - $(QEMU) -kernel $(BINARY) $(QEMU_DEBUG) + $(QEMU) $(QEMU_FLAGS) -kernel $(BINARY) $(QEMU_DEBUG) run-iso: iso - $(QEMU) -cdrom $(ISO) + $(QEMU) $(QEMU_FLAGS) -cdrom $(ISO) diff --git a/include/08.heap/heap.c b/include/08.heap/heap.c index 3120ed8..954a220 100644 --- a/include/08.heap/heap.c +++ b/include/08.heap/heap.c @@ -129,6 +129,7 @@ void k_heapBMFree(KHEAPBM *heap, void *ptr) bi = ptroff / b->bsize; /* .. */ bm = (uint8_t*)&b[1]; + /* clear allocation */ id = bm[bi]; /* oddly.. GCC did not optimize this */ diff --git a/include/08.heap/heap23.c b/include/08.heap/heap23.c index 70305b7..4eaf953 100644 --- a/include/08.heap/heap23.c +++ b/include/08.heap/heap23.c @@ -9,13 +9,3 @@ bi = ptroff / b->bsize; /* .. */ bm = (uint8_t*)&b[1]; - /* clear allocation */ - id = bm[bi]; - /* oddly.. GCC did not optimize this */ - max = b->size / b->bsize; - for (x = bi; bm[x] == id && x < max; ++x) bm[x] = 0; - /* update free block count */ - b->used -= x - bi; - return; - } - } diff --git a/include/08.heap/heap24.c b/include/08.heap/heap24.c index 11a4697..221bc4f 100644 --- a/include/08.heap/heap24.c +++ b/include/08.heap/heap24.c @@ -1,3 +1,10 @@ - /* this error needs to be raised or reported somehow */ - return; -} + /* clear allocation */ + id = bm[bi]; + /* oddly.. GCC did not optimize this */ + max = b->size / b->bsize; + for (x = bi; bm[x] == id && x < max; ++x) bm[x] = 0; + /* update free block count */ + b->used -= x - bi; + return; + } + } diff --git a/include/08.heap/heap25.c b/include/08.heap/heap25.c index 6ac75a9..11a4697 100644 --- a/include/08.heap/heap25.c +++ b/include/08.heap/heap25.c @@ -1 +1,3 @@ -KHEAPBM kheap; + /* this error needs to be raised or reported somehow */ + return; +} diff --git a/include/08.heap/heap26.c b/include/08.heap/heap26.c index 6d7223d..6ac75a9 100644 --- a/include/08.heap/heap26.c +++ b/include/08.heap/heap26.c @@ -1,4 +1 @@ -void kheapinit() -{ - k_heapBMInit(&kheap); -} +KHEAPBM kheap; diff --git a/include/08.heap/heap27.c b/include/08.heap/heap27.c index de767a2..6d7223d 100644 --- a/include/08.heap/heap27.c +++ b/include/08.heap/heap27.c @@ -1,4 +1,4 @@ -int kheapaddblock(uintptr_t addr,uint32_t size,uint32_t bsize) +void kheapinit() { - return k_heapBMAddBlock(&kheap,addr,size,bsize); + k_heapBMInit(&kheap); } diff --git a/include/08.heap/heap28.c b/include/08.heap/heap28.c index 22972f4..de767a2 100644 --- a/include/08.heap/heap28.c +++ b/include/08.heap/heap28.c @@ -1,4 +1,4 @@ -void *kmalloc(uint32_t size) +int kheapaddblock(uintptr_t addr,uint32_t size,uint32_t bsize) { - return k_heapBMAlloc(&kheap,size); + return k_heapBMAddBlock(&kheap,addr,size,bsize); } diff --git a/include/08.heap/heap29.c b/include/08.heap/heap29.c index d4d5941..22972f4 100644 --- a/include/08.heap/heap29.c +++ b/include/08.heap/heap29.c @@ -1,4 +1,4 @@ -void kfree(void *ptr) +void *kmalloc(uint32_t size) { - k_heapBMFree(&kheap,ptr); + return k_heapBMAlloc(&kheap,size); } diff --git a/include/08.heap/heap30.c b/include/08.heap/heap30.c new file mode 100644 index 0000000..d4d5941 --- /dev/null +++ b/include/08.heap/heap30.c @@ -0,0 +1,4 @@ +void kfree(void *ptr) +{ + k_heapBMFree(&kheap,ptr); +} |
