POK(kernelpart)
syscalls.c File Reference

This file implement system-calls for x86 platform. More...

#include <errno.h>
#include <core/debug.h>
#include <core/partition.h>
#include <core/syscall.h>
#include "gdt.h"
#include "event.h"

Go to the source code of this file.

Macros

#define PARTITION_ID(cs)   (((cs >> 3) - 4) / 2)

Functions

 INTERRUPT_HANDLER_syscall (syscall_gate)
pok_ret_t pok_syscall_init ()

Detailed Description

This file implement system-calls for x86 platform.

Author:
Julian Pidancet
Julien Delange
Laurent Lec

Definition in file syscalls.c.


Macro Definition Documentation

#define PARTITION_ID (   cs)    (((cs >> 3) - 4) / 2)

Definition at line 33 of file syscalls.c.


Function Documentation

INTERRUPT_HANDLER_syscall ( syscall_gate  )

Definition at line 35 of file syscalls.c.

{
pok_syscall_info_t syscall_info;
pok_ret_t syscall_ret;
pok_syscall_args_t* syscall_args;
pok_syscall_id_t syscall_id;
/*
* Give informations about syscalls: which partition, thread
* initiates the syscall, the base addr of the partition and so on.
*/
syscall_info.partition = PARTITION_ID (frame->cs);
syscall_info.base_addr = pok_partitions[syscall_info.partition].base_addr;
syscall_info.thread = POK_SCHED_CURRENT_THREAD;
syscall_args = (pok_syscall_args_t*) (frame->ebx + syscall_info.base_addr);
/*
* Get the syscall id in the eax register
*/
syscall_id = (pok_syscall_id_t) frame->eax;
/*
* Check that pointer is inside the adress space
*/
if (POK_CHECK_PTR_IN_PARTITION(syscall_info.partition, syscall_args) == 0)
{
syscall_ret = POK_ERRNO_EINVAL;
}
else
{
/*
* Perform the syscall baby !
*/
syscall_ret = pok_core_syscall (syscall_id, syscall_args, &syscall_info);
}
/*
* And finally, put the return value in eax register
*/
asm ("movl %0, %%eax \n"
:
: "m" (syscall_ret));
}
pok_ret_t pok_syscall_init ( )

Init system calls

Definition at line 83 of file syscalls.c.