Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Syscall interface #15

Open
jjgarzella opened this issue Oct 22, 2016 · 3 comments
Open

Syscall interface #15

jjgarzella opened this issue Oct 22, 2016 · 3 comments

Comments

@jjgarzella
Copy link
Contributor

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:

  • What syscalls should we provide
  • how exactly should we show that to the user?

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
Copy link
Contributor

I believe that we should create two syscalls at first:

  • void * puts(char *), this will be for testing the userspace process
  • and void exit() which will be used to clean up program resorces in order to prevent undefined behaviour on a return

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

@jjgarzella
Copy link
Contributor Author

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
Copy link
Contributor

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants