Turnstone Operating System
Loading...
Searching...
No Matches
syscall.64.c File Reference

64-bit system call support. More...

#include <apic.h>
#include <cpu.h>
#include <cpu/syscall.h>
#include <cpu/smp.h>
#include <logging.h>
#include <memory.h>

Macros

#define SYSCALL_TABLE_SIZE   (sizeof(SYSCALL_TABLE) / sizeof(SYSCALL_TABLE[0]))
 

Typedefs

typedef int64_t(* syscall_f) (uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
 System call function type. More...
 

Functions

 MODULE ("turnstone.kernel.cpu.syscall")
 
uint64_t syscall_handler_create_stack (uint64_t old_stack)
 creates stack for system call handler. More...
 
int64_t syscall_handler_null_handler_error (uint64_t handler_no, uint64_t syscall_handler_offset)
 null handler error. when system call handler is null, this function is called. prints error message about null handler and returns -1. More...
 
int64_t syscall_handler_notfound_error (uint64_t syscall_no)
 not found error. when system call handler is not found, this function is called. prints error message about not found handler and returns -1. More...
 
int64_t syscall_function_hlt (uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
 cpu halt system call handler. More...
 
int64_t syscall_function_cli_and_hlt (uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
 cpu cli and hlt system call handler. after this system call, cpu is halted forever. More...
 
void syscall_init (void)
 
void syscall_handler (void)
 syscall handler.
 

Variables

const syscall_f SYSCALL_TABLE []
 system call table. More...
 

Detailed Description

64-bit system call support.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ SYSCALL_TABLE_SIZE

#define SYSCALL_TABLE_SIZE   (sizeof(SYSCALL_TABLE) / sizeof(SYSCALL_TABLE[0]))

system call table size

Typedef Documentation

◆ syscall_f

syscall_f

System call function type.

Parameters
[in]arg1Argument 1.
[in]arg2Argument 2.
[in]arg3Argument 3.
[in]arg4Argument 4.
[in]arg5Argument 5.
[in]arg6Argument 6.
Returns
Return value.

Function Documentation

◆ MODULE()

MODULE ( "turnstone.kernel.cpu.syscall"  )

module name

◆ syscall_function_cli_and_hlt()

int64_t syscall_function_cli_and_hlt ( uint64_t  arg1,
uint64_t  arg2,
uint64_t  arg3,
uint64_t  arg4,
uint64_t  arg5,
uint64_t  arg6 
)

cpu cli and hlt system call handler. after this system call, cpu is halted forever.

Parameters
[in]arg1Argument 1. (not used)
[in]arg2Argument 2. (not used)
[in]arg3Argument 3. (not used)
[in]arg4Argument 4. (not used)
[in]arg5Argument 5. (not used)
[in]arg6Argument 6. (not used)
Returns
always 0.

◆ syscall_function_hlt()

int64_t syscall_function_hlt ( uint64_t  arg1,
uint64_t  arg2,
uint64_t  arg3,
uint64_t  arg4,
uint64_t  arg5,
uint64_t  arg6 
)

cpu halt system call handler.

Parameters
[in]arg1Argument 1. (not used)
[in]arg2Argument 2. (not used)
[in]arg3Argument 3. (not used)
[in]arg4Argument 4. (not used)
[in]arg5Argument 5. (not used)
[in]arg6Argument 6. (not used)
Returns
always 0.

◆ syscall_handler_create_stack()

uint64_t syscall_handler_create_stack ( uint64_t  old_stack)

creates stack for system call handler.

Parameters
[in]old_stackOld stack pointer.
Returns
New stack pointer.

◆ syscall_handler_notfound_error()

int64_t syscall_handler_notfound_error ( uint64_t  syscall_no)

not found error. when system call handler is not found, this function is called. prints error message about not found handler and returns -1.

Parameters
[in]syscall_noSystem call number.
Returns
always -1.

◆ syscall_handler_null_handler_error()

int64_t syscall_handler_null_handler_error ( uint64_t  handler_no,
uint64_t  syscall_handler_offset 
)

null handler error. when system call handler is null, this function is called. prints error message about null handler and returns -1.

Parameters
[in]handler_noHandler number.
[in]syscall_handler_offsetSystem call handler offset.
Returns
always -1.

Variable Documentation

◆ SYSCALL_TABLE

const syscall_f SYSCALL_TABLE[]
Initial value:
= {
}
int64_t syscall_function_hlt(uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
cpu halt system call handler.
Definition: syscall.64.c:221
int64_t syscall_function_cli_and_hlt(uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
cpu cli and hlt system call handler. after this system call, cpu is halted forever.
Definition: syscall.64.c:233

system call table.