Open jjgarzella opened 7 years ago
I believe that we should create two syscalls at first:
void * puts(char *)
, this will be for testing the userspace processvoid exit()
which will be used to clean up program resorces in order to prevent undefined behaviour on a returnSyscalls should probably be done in the basic linux int 0x80
fashion with the syscall identifier being passed in rax
.
Are there any examples of an operating system that doesn't use int 0x80
or one of it's derivatives (syscall, sysenter, etc.)? I can't seem to find anything about that.
syscall
and sysret
are not derivatives of interrupt syscalls, they are their own thing. Also those instructions are used by Windows's NT kernel instead of an interrupt vector, though it reserves other interrupt vectors for other userspace tasks. Using none of those is impossible as ring changes can only really be done through interrupts and other provided instructions. Though some operating systems (like templeOS) have no ring changes so they could just use calls. Also exotic architectures like z80 use rst
s for syscalls which calls a specific address that cannot be changed. (Though the only OSes that I know run on z80 are TI-OS, KnightOS, and OS/2).
The kernel should provide a system call interface that will allow userspace programs to execute privileged operations, like printing to the screen. The big questions to answer are:
Rather than simply copy what other operating systems do, I think this is a good chance to think about what we want our system to look like. What do we like about the way that other operating systems do it? What don't we like? Right now is when we have the most freedom to decide what to do.