Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1273 → Rev 1278

/kernel/trunk/generic/include/ddi/ddi.h
39,8 → 39,6
/*
* Interface to be implemented by all architectures.
*/
extern __native ddi_int_control_arch(__native enable, __native *flags);
extern __native ddi_int_control(__native enable, __native *flags);
extern int ddi_iospace_enable_arch(task_t *task, __address ioaddr, size_t size);
 
#endif
/kernel/trunk/generic/include/security/cap.h
63,9 → 63,9
#define CAP_IO_MANAGER (1<<2)
 
/**
* CAP_INT_CONTROL allows its holder to disable interrupts
* CAP_PREEMPT_CONTROL allows its holder to disable interrupts
*/
#define CAP_INT_CONTROL (1<<3)
#define CAP_PREEMPT_CONTROL (1<<3)
 
typedef __u32 cap_t;
 
/kernel/trunk/generic/include/syscall/syscall.h
32,7 → 32,7
typedef enum {
SYS_IO = 0,
SYS_TLS_SET = 1, /* Hardcoded in AMD64,IA32 uspace - psthread.S */
SYS_INT_CONTROL = 2, /* Hardcoded in all SYSCALL handlers */
SYS_PREEMPT_CONTROL,
SYS_THREAD_CREATE,
SYS_THREAD_EXIT,
SYS_TASK_GET_ID,
/kernel/trunk/generic/src/ddi/ddi.c
203,10 → 203,3
copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
return (__native) ddi_iospace_enable((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size);
}
 
__native ddi_int_control(__native enable, __native *flags)
{
if (! cap_get(TASK) & CAP_INT_CONTROL)
return EPERM;
return ddi_int_control_arch(enable, flags);
}
/kernel/trunk/generic/src/syscall/syscall.c
56,9 → 56,15
return count;
}
 
static __native sys_int_control(int enable)
static __native sys_preempt_control(int enable)
{
panic("Not implemented.");
if (! cap_get(TASK) & CAP_PREEMPT_CONTROL)
return EPERM;
if (enable)
preemption_enable();
else
preemption_disable();
return 0;
}
 
/** Dispatch system call */
74,7 → 80,7
syshandler_t syscall_table[SYSCALL_END] = {
sys_io,
sys_tls_set,
sys_int_control,
sys_preempt_control,
 
/* Thread and task related syscalls. */
sys_thread_create,