Function that performs the syscall. It is called by the architecture interruption handler.
Here is the default syscall handler. In this case, the syscall ID was not properly identified and thus, we should return an error. If error management is activated, we raise an error in kernel of partitions, calling the error handler.
{
switch (syscall_id)
{
#if defined (POK_NEEDS_CONSOLE) || defined (POK_NEEDS_DEBUG)
if (
pok_cons_write ((const
char*)args->arg1 + infos->base_addr, args->arg2))
{
}
else
{
}
break;
#endif
#ifdef POK_NEEDS_PORTS_VIRTUAL
case POK_SYSCALL_MIDDLEWARE_VIRTUAL_CREATE:
return pok_port_virtual_id ( (
char*) (args->arg1 + infos->base_addr), (
pok_port_id_t*) (args->arg2 + infos->base_addr));
break;
case POK_SYSCALL_MIDDLEWARE_VIRTUAL_NB_DESTINATIONS:
return pok_port_virtual_nb_destinations ( (
pok_port_id_t) (args->arg1), (
uint32_t*) (args->arg2 + infos->base_addr));
break;
case POK_SYSCALL_MIDDLEWARE_VIRTUAL_DESTINATION:
break;
case POK_SYSCALL_MIDDLEWARE_VIRTUAL_GET_GLOBAL:
break;
#endif
#if defined POK_NEEDS_GETTICK
return pok_gettick_by_pointer ((
uint64_t*) (args->arg1 + infos->base_addr));
break;
#endif
break;
#ifdef POK_NEEDS_THREAD_SLEEP
return pok_thread_sleep (args->
arg1);
break;
#endif
#ifdef POK_NEEDS_THREAD_SLEEP_UNTIL
return pok_thread_sleep_until (args->
arg1);
break;
#endif
return pok_sched_end_period ();
break;
#if defined (POK_NEEDS_THREAD_SUSPEND) || defined (POK_NEEDS_ERROR_HANDLING)
return pok_thread_suspend ();
break;
#endif
#ifdef POK_NEEDS_THREAD_ID
break;
#endif
return pok_thread_get_status (args->
arg1, (pok_thread_attr_t*) (args->
arg2 + infos->
base_addr));
break;
#ifdef POK_NEEDS_ERROR_HANDLING
return pok_partition_restart_thread (args->
arg1);
break;
return pok_partition_stop_thread (args->
arg1);
break;
pok_sched_stop_self ();
break;
#endif
#ifdef POK_NEEDS_PARTITIONS
case POK_SYSCALL_PARTITION_SET_MODE:
return pok_partition_set_mode_current ((pok_partition_mode_t)args->
arg1);
break;
case POK_SYSCALL_PARTITION_GET_ID:
break;
case POK_SYSCALL_PARTITION_GET_PERIOD:
break;
case POK_SYSCALL_PARTITION_GET_DURATION:
break;
case POK_SYSCALL_PARTITION_GET_LOCK_LEVEL:
break;
case POK_SYSCALL_PARTITION_GET_OPERATING_MODE:
return pok_current_partition_get_operating_mode ((pok_partition_mode_t*)(args->
arg1 + infos->
base_addr));
break;
case POK_SYSCALL_PARTITION_GET_START_CONDITION:
return pok_current_partition_get_start_condition ((pok_start_condition_t*)(args->
arg1 + infos->
base_addr));
break;
#endif
#ifdef POK_NEEDS_ERROR_HANDLING
case POK_SYSCALL_ERROR_HANDLER_CREATE:
return pok_error_thread_create (args->
arg1 , (
void*) (args->
arg2));
break;
case POK_SYSCALL_ERROR_RAISE_APPLICATION_ERROR:
pok_error_raise_application_error ((char*) (args->arg1 + infos->base_addr), args->arg2);
break;
case POK_SYSCALL_ERROR_GET:
return pok_error_get ((pok_error_status_t*) (args->arg1 + infos->base_addr));
break;
#endif
#ifdef POK_NEEDS_PORTS_SAMPLING
case POK_SYSCALL_MIDDLEWARE_SAMPLING_CREATE:
return pok_port_sampling_create ((char*)(args->arg1 + infos->base_addr),
break;
case POK_SYSCALL_MIDDLEWARE_SAMPLING_WRITE:
(const void*) ((void*)args->arg2 + infos->base_addr),
break;
case POK_SYSCALL_MIDDLEWARE_SAMPLING_READ:
(void*) args->arg2 + infos->base_addr,
(
bool_t*) (args->arg4 + infos->base_addr));
break;
case POK_SYSCALL_MIDDLEWARE_SAMPLING_ID:
return pok_port_sampling_id ((char*)(args->arg1 + infos->base_addr),
break;
#ifndef POK_GENERATED_CODE
case POK_SYSCALL_MIDDLEWARE_SAMPLING_STATUS:
return pok_port_sampling_status ((const
pok_port_id_t)args->arg1,
(pok_port_sampling_status_t*) (args->arg2 + infos->base_addr));
break;
#endif
#endif
#ifdef POK_NEEDS_PORTS_QUEUEING
case POK_SYSCALL_MIDDLEWARE_QUEUEING_CREATE:
return pok_port_queueing_create ((char*) (args->arg1 + infos->base_addr),
break;
case POK_SYSCALL_MIDDLEWARE_QUEUEING_SEND:
(const void*) ((void*)args->arg2 + infos->base_addr),
break;
case POK_SYSCALL_MIDDLEWARE_QUEUEING_RECEIVE:
return pok_port_queueing_receive ((const
pok_port_id_t) args->arg1,
(void*) ((void*)args->arg4 + infos->base_addr),
break;
case POK_SYSCALL_MIDDLEWARE_QUEUEING_ID:
return pok_port_queueing_id ((char*) (args->arg1 + infos->base_addr),
break;
#ifndef POK_GENERATED_CODE
case POK_SYSCALL_MIDDLEWARE_QUEUEING_STATUS:
return pok_port_queueing_status ((const
pok_port_id_t) args->arg1,
(pok_port_queueing_status_t*) (args->arg2 + infos->base_addr));
break;
#endif
#endif
#ifdef POK_NEEDS_LOCKOBJECTS
case POK_SYSCALL_LOCKOBJ_CREATE:
break;
case POK_SYSCALL_LOCKOBJ_OPERATION:
{
}
else
{
}
break;
#endif
#ifdef POK_NEEDS_IO
case POK_SYSCALL_INB:
{
}
else
{
return inb((
unsigned short) args->
arg1);
}
break;
case POK_SYSCALL_OUTB:
{
}
else
{
outb((
unsigned short) args->
arg1, (
unsigned char) args->
arg2);
}
break;
#endif
#ifdef POK_NEEDS_PCI
case POK_SYSCALL_PCI_REGISTER:
return pci_register((void*)args->arg1 + infos->base_addr, infos->partition);
break;
#endif
default:
#ifdef POK_NEEDS_ERROR_HANDLING
pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
pok_sched_activate_error_thread ();
#else
#ifdef POK_NEEDS_DEBUG
printf ("Tried to use syscall %d\n", syscall_id);
#endif
#endif
break;
}
}