mirror of
https://github.com/drasko/codezero.git
synced 2026-01-19 06:13:16 +01:00
Added per-task ipc flags checking instead of the active task flags.
Previously during ipc copy, only the currently active task flags were checked. This means the flags of whoever doing the actual copy was used in the ipc. Now flags are stored in the ktcb and checked by the copy routine. Current use of the flags is to determine short/full/extended ipc.
This commit is contained in:
@@ -146,6 +146,7 @@
|
||||
|
||||
/* Codezero specific error codes */
|
||||
#define EACTIVE 132 /* Task active */
|
||||
#define ENOIPC 133 /* General IPC error */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
#include INC_GLUE(context.h)
|
||||
#include INC_SUBARCH(mm.h)
|
||||
|
||||
/*
|
||||
* Bit mappings for the ktcb flags field
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are a mixture of flags that indicate the task is
|
||||
@@ -30,13 +27,6 @@
|
||||
#define TASK_SUSPENDING (1 << 1)
|
||||
#define TASK_RESUMING (1 << 2)
|
||||
|
||||
/* IPC resulted in a fault error (For ipcs that cannot page fault) */
|
||||
#define IPC_EFAULT (1 << 3)
|
||||
|
||||
/* IPC type is encoded in task flags in bits [7:4] */
|
||||
#define TASK_FLAGS_IPC_TYPE_MASK 0xF0
|
||||
#define TASK_FLAGS_IPC_TYPE_SHIFT 4
|
||||
|
||||
/* Task states */
|
||||
enum task_state {
|
||||
TASK_INACTIVE = 0,
|
||||
@@ -73,6 +63,9 @@ struct ktcb {
|
||||
/* Flags to indicate various task status */
|
||||
unsigned int flags;
|
||||
|
||||
/* IPC flags */
|
||||
unsigned int ipc_flags;
|
||||
|
||||
/* Lock for blocking thread state modifications via a syscall */
|
||||
struct mutex thread_control_lock;
|
||||
|
||||
@@ -144,21 +137,27 @@ static inline void set_task_ids(struct ktcb *task, struct task_ids *ids)
|
||||
static inline void tcb_set_ipc_flags(struct ktcb *task,
|
||||
unsigned int flags)
|
||||
{
|
||||
task->flags |= ((flags & L4_IPC_FLAGS_TYPE_MASK)
|
||||
<< TASK_FLAGS_IPC_TYPE_SHIFT) &
|
||||
TASK_FLAGS_IPC_TYPE_MASK;
|
||||
task->ipc_flags = flags;
|
||||
}
|
||||
|
||||
static inline unsigned int tcb_get_ipc_flags(struct ktcb *task)
|
||||
{
|
||||
return ((task->flags & TASK_FLAGS_IPC_TYPE_MASK)
|
||||
>> TASK_FLAGS_IPC_TYPE_SHIFT)
|
||||
& L4_IPC_FLAGS_TYPE_MASK;
|
||||
return task->ipc_flags;
|
||||
}
|
||||
|
||||
static inline void tcb_set_ipc_type(struct ktcb *task,
|
||||
unsigned int type)
|
||||
{
|
||||
task->ipc_flags = type & L4_IPC_FLAGS_TYPE_MASK;
|
||||
}
|
||||
|
||||
static inline unsigned int tcb_get_ipc_type(struct ktcb *task)
|
||||
{
|
||||
return task->ipc_flags & L4_IPC_FLAGS_TYPE_MASK;
|
||||
}
|
||||
|
||||
#define THREAD_IDS_MAX 1024
|
||||
#define SPACE_IDS_MAX 1024
|
||||
#define TGROUP_IDS_MAX 1024
|
||||
|
||||
|
||||
extern struct id_pool *thread_id_pool;
|
||||
|
||||
@@ -87,6 +87,13 @@
|
||||
#include INC_GLUE(memlayout.h)
|
||||
|
||||
#if defined (__KERNEL__)
|
||||
|
||||
/* Kernel-only flags */
|
||||
#define L4_IPC_FLAGS_ERROR_MASK 0xF0000000
|
||||
#define L4_IPC_FLAGS_ERROR_SHIFT 28
|
||||
#define L4_IPC_EFAULT (1 << 28)
|
||||
#define L4_IPC_ENOIPC (1 << 29)
|
||||
|
||||
struct utcb {
|
||||
u32 mr[MR_TOTAL]; /* MRs that are mapped to real registers */
|
||||
u32 saved_tag; /* Saved tag field for stacked ipcs */
|
||||
|
||||
Reference in New Issue
Block a user