I'm quite new to OS Development, but my kernel already supports monotasking! Until now, everything went fine. But...
I want to make 2 versions of my C library: a hosted version, and a freestanding version. Using the preprocessor variable __STDC_HOSTED__ I can throw an error when a systemcall is called in the freestanding version, like:
Code: Select all
void syscall()
{
#if __STDC_HOSTED__ == 1
...
#else
#error System calls not allowed in kernel!
#endif
}
Code: Select all
CC=tcc -Wall -I../include
OBJS=$(patsubst %.c,%.o,$(wildcard *.c))
all : libc.a
.c.o:
$(CC) -D__STDC_HOSTED__=1 -c -o$@ $<
# Rules
libc.a: $(OBJS)
tiny_libmaker.exe libc.a $(OBJS)
PS: sorry for my bad english