AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
syscall.c File Reference

aarch64: 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 aarch64_preempt (void)
 Switches away from this CPU's running thread, which stays ready, to the next ready thread.
void arch_syscall (struct aarch64_regs *r)
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.

Detailed Description

aarch64: system calls.

A program makes one with the svc #0 instruction, as on Linux: the number in x8, the arguments in x0 to x4, and the result comes back in x0. See docs/kernel/syscalls.md.

Definition in file syscall.c.

Function Documentation

◆ aarch64_preempt()

void aarch64_preempt ( void )

Switches away from this CPU's running thread, which stays ready, to the next ready thread.

When the thread is chosen again, it goes on from here.

Definition at line 188 of file trap.c.

References aarch64_ctx_save(), aarch64_preempt(), aarch64_thread::ctx, curthread, and schedule().

Referenced by aarch64_irq(), aarch64_preempt(), arch_syscall(), and arch_yield().

◆ arch_syscall()

◆ arch_syscall_return()

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.

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.

Parameters
threadthe thread
valthe result

Definition at line 43 of file syscall.c.

References thread::arch, arch_syscall_return(), aarch64_thread::regs, thread::spawned, aarch64_regs::x, and aarch64_thread::x0.

Referenced by arch_syscall_return(), proc_fork(), and syscall_dispatch().