ESALP / ESALP-1

The Endangered Soaring African Lynx-Pidgeon Operating System
MIT License
4 stars 1 forks source link

Syscall interface #15

Open jjgarzella opened 7 years ago

jjgarzella commented 7 years ago

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.

4e554c4c commented 7 years ago

I believe that we should create two syscalls at first:

Syscalls should probably be done in the basic linux int 0x80 fashion with the syscall identifier being passed in rax.

jjgarzella commented 7 years ago

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.

4e554c4c commented 7 years ago

syscall and sysretare 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 rsts 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).