setos

拙OS
Log | Files | Refs | LICENSE

commit 47d71278f948085b401f52654d207b949d48c0a8
parent 331c1f284ba77046dc4d7ffb869a9f87405247a4
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon,  1 Apr 2024 17:23:46 +0900

try to implement malloc

Diffstat:
Msys/include/libc.h | 13+++++++++++--
Msys/src/kernel/Makefile | 2+-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys/include/libc.h b/sys/include/libc.h @@ -1,12 +1,21 @@ +#define NULL 0L + typedef unsigned char uint8; typedef unsigned int uint32; typedef unsigned long long int uint64; typedef unsigned long long int uintptr; -typedef struct Memmap { +typedef struct Memblock { + void *start, *end; +} Memblock; +typedef struct Memmap { + Memblock *freespace; + int nfreespace; + Memblock *allocated; + int nallocated; } Memmap; -extern Memmap memmap[]; +extern Memmap memmap; void *malloc(uintptr); \ No newline at end of file diff --git a/sys/src/kernel/Makefile b/sys/src/kernel/Makefile @@ -2,7 +2,7 @@ CC = tcc LD = ld CFLAGS = -I ../../include -nostdlib -fpic -mno-red-zone -ffreestanding -Wall -g LDFLAGS = -e kernel_main -static -OBJS = main.o draw.o +OBJS = main.o draw.o alloc.o all: main.elf