Verified Commit 6d886d72 authored by Felix Kopp's avatar Felix Kopp
Browse files

syscall: refactor names

parent 6e269e02
......@@ -3,7 +3,7 @@
#include <ardix/atomic.h>
#include <ardix/atom.h>
static ATOM_DEFINE(atomic_context);
static ATOM(atomic_context);
void atomic_enter(void)
{
......
......@@ -3,15 +3,18 @@
#pragma once
/**
* Perform a syscall.
* @brief Perform a syscall.
*
* This is the first and only method called by the irq handler for system calls.
* It is responsible for finishing the context switch, obtaining the syscall
* number and arguments, and invoking the respective system call.
* This is called by the syscall exception handler. It is responsible for
* finishing the context switch, obtaining the syscall number and arguments,
* and invoking the respective system call. If the return value of this
* function is nonzero, the scheduler is invoked after the call and before
* returning to userspace.
*
* @param sp: The current stack pointer.
* @param sp current stack pointer
* @returns Whether rescheduling is required
*/
void arch_enter(void *sp);
int arch_enter(void *sp);
/*
* This file is part of Ardix.
......
......@@ -2,8 +2,8 @@
#pragma once
#define ARCH_SYSCALL_READ 0
#define ARCH_SYSCALL_WRITE 1
#define ARCH_SYS_read 0
#define ARCH_SYS_write 1
/*
* This file is part of Ardix.
......
......@@ -5,7 +5,7 @@
#include <ardix/types.h>
#include <toolchain.h>
#define ATOM_DEFINE(name) atom_t name = { .count = 0, }
#define ATOM(name) atom_t name = { .count = 0, }
void atom_init(atom_t *atom);
......
......@@ -10,8 +10,8 @@
#include <toolchain.h>
enum syscall {
SYSCALL_READ = ARCH_SYSCALL_READ,
SYSCALL_WRITE = ARCH_SYSCALL_WRITE,
SYS_read = ARCH_SYS_read,
SYS_write = ARCH_SYS_write,
NSYSCALLS
};
......
......@@ -10,8 +10,8 @@
__rodata
int (*const sys_table[NSYSCALLS])(sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
sysarg_t arg4, sysarg_t arg5, sysarg_t arg6) = {
sys_table_entry(SYSCALL_READ, &sys_read),
sys_table_entry(SYSCALL_WRITE, &sys_write),
sys_table_entry(SYS_read, sys_read),
sys_table_entry(SYS_write, sys_write),
};
int sys_stub(void)
......
......@@ -6,12 +6,12 @@
ssize_t read(int fildes, void *buf, size_t nbyte)
{
return syscall(SYSCALL_READ, (sysarg_t)fildes, (sysarg_t)buf, (sysarg_t)nbyte);
return syscall(SYS_read, (sysarg_t)fildes, (sysarg_t)buf, (sysarg_t)nbyte);
}
ssize_t write(int fildes, const void *buf, size_t nbyte)
{
return syscall(SYSCALL_WRITE, (sysarg_t)fildes, (sysarg_t)buf, (sysarg_t)nbyte);
return syscall(SYS_write, (sysarg_t)fildes, (sysarg_t)buf, (sysarg_t)nbyte);
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment