Repository navigation
System Calls
Aquila Kernel is monolithic, the only way to request a kernel function is through a system call.
System Calls are requested in arch. specific manner, each arch. should export arch_syscall_return which is responsible for returning value to the calling process upon syscall satisfaction.
All kernel syscall are defined in kernel/sys/syscall.c in syscall_table with their numbers, arch calls a syscall by executing syscall_table[syscall_nr](arg0, arg1, ...)
On x86, syscalls are requested using int 0x80 instruction with syscall number in eax and arguments in ebx, ecx and edx. The interrupt is caught by interrupt function defined in kernel/arch/x86/cpu/isr.c and passed to arch_syscall function defined in kernel/arch/x86/sys/syscall.c which then calls the relevant syscall, its implementation looks like:
void arch_syscall(regs_t *r)
{
/* Sanity Checking */
void (*syscall)() = syscall_table[r->eax];
syscall(r->ebx, r->ecx, r->edx);
}- Standard
- Number: 1
- Arguments:
-
int status: Termination status of process
-
- Returns: N/A
- Errors: N/A
- Standard
- Number: 2
- Arguments:
-
int fildes: File Descriptor to close
-
- Returns:
int- Success: 0
- Error: -errno
- Errors:
-
-EBADFD: Bad File Descriptor
-
- Build Instructions
- Boot Process
- CPU Initialization
- Memory Management
- Processes
- Threads
- Scheduler
- System Calls
- Devices Manager
- Virtual Filesystem