|
AquilaOS documentation
How it works, and its code
|
x86: system calls. More...
#include <core/system.h>#include <core/arch.h>#include <sys/proc.h>#include <sys/sched.h>#include <sys/syscall.h>#include <sys/signal.h>#include <aquila/syscall.h>#include <aquila/errno.h>Go to the source code of this file.
Functions | |
| void | arch_syscall (struct x86_regs *r) |
| Runs a system call that user mode made: the trap handler calls it. | |
| void | arch_syscall_return (struct thread *thread, uintptr_t val) |
| Sets the result of a thread's system call, in the register that returns it to user mode. | |
x86: system calls.
A program makes one with int $0x80: the number in eax, the arguments in ebx, ecx, edx, esi and edi (i386), or in rdi, rsi, rdx, r10 and r8 (x86_64, as with Linux's syscall instruction), and the result comes back in eax. See docs/kernel/syscalls.md.
Definition in file syscall.c.
| void arch_syscall | ( | struct x86_regs * | r | ) |
Runs a system call that user mode made: the trap handler calls it.
It returns to user mode when the call is done, delivering the signals that came meanwhile. Each architecture has its own, with its own saved registers (sys/syscall.c).
| r | the registers user mode had, saved on the kernel stack |
Definition at line 22 of file syscall.c.
References arch_syscall(), curthread, x86_regs::r10, x86_regs::r8, x86_regs::rax, x86_regs::rdi, x86_regs::rdx, x86_regs::rsi, sched_urgent, syscall_dispatch(), and x86_return_to_user().
Sets the result of a thread's system call, in the register that returns it to user mode.
That's in the thread's saved registers, or, for a thread that has never run (a child of fork()), where it will start from.
| thread | the thread |
| val | the result |
Definition at line 50 of file syscall.c.
References thread::arch, arch_syscall_return(), x86_regs::rax, x86_thread::rax, x86_thread::regs, and thread::spawned.