well if you support all the usual stuff (open/close files, write to stdout, read from stdin etc.) via syscalls, then your users can just use syscalls, but it would be nice for them if you give them a library that provides a nicer API to the syscalls. Something like
- Code: Select all
int fopen(char* filename, int flags, int mode)
{
int filedescriptor;
asm("int $0x80" : "=a"(filedescriptor) : "a"(5), "b"(filename), "c"(flags), "d"(mode));
return filedescriptor;
}
...
Then the users can statically link to that library and call fopen etc. as they are used to.
When they compile their programs, they need to turn off exceptions, disable linking dynamically against the usual libraries (glibc, glibc++ etc.) and statically link against your library instead.
Don't forget: you still need some way to start the programs. Reading something from the hard drive and attaching a function pointer to your processes list is discussed in the tutorials, but after reading the executable binary into ram, which function pointer do you attach to the processes? I would suggest that you implement the ELF file format, so that your users can just use gcc to compile (if you make up your own format, then you need to give your users a cross compiler).