Updated ipc flag names with kernel-only versions without the L4 prefix.

This commit is contained in:
Bahadir Balban
2009-05-28 12:01:48 +03:00
parent b977e6597e
commit 391b0ca1d0
4 changed files with 44 additions and 34 deletions
+2 -2
View File
@@ -148,12 +148,12 @@ static inline unsigned int tcb_get_ipc_flags(struct ktcb *task)
static inline void tcb_set_ipc_type(struct ktcb *task, static inline void tcb_set_ipc_type(struct ktcb *task,
unsigned int type) unsigned int type)
{ {
task->ipc_flags = type & L4_IPC_FLAGS_TYPE_MASK; task->ipc_flags = type & IPC_FLAGS_TYPE_MASK;
} }
static inline unsigned int tcb_get_ipc_type(struct ktcb *task) static inline unsigned int tcb_get_ipc_type(struct ktcb *task)
{ {
return task->ipc_flags & L4_IPC_FLAGS_TYPE_MASK; return task->ipc_flags & IPC_FLAGS_TYPE_MASK;
} }
#define THREAD_IDS_MAX 1024 #define THREAD_IDS_MAX 1024
+14 -4
View File
@@ -89,10 +89,20 @@
#if defined (__KERNEL__) #if defined (__KERNEL__)
/* Kernel-only flags */ /* Kernel-only flags */
#define L4_IPC_FLAGS_ERROR_MASK 0xF0000000 #define IPC_FLAGS_SHORT L4_IPC_FLAGS_SHORT
#define L4_IPC_FLAGS_ERROR_SHIFT 28 #define IPC_FLAGS_FULL L4_IPC_FLAGS_FULL
#define L4_IPC_EFAULT (1 << 28) #define IPC_FLAGS_EXTENDED L4_IPC_FLAGS_EXTENDED
#define L4_IPC_ENOIPC (1 << 29) #define IPC_FLAGS_MSG_INDEX_MASK L4_IPC_FLAGS_MSG_INDEX_MASK
#define IPC_FLAGS_TYPE_MASK L4_IPC_FLAGS_TYPE_MASK
#define IPC_FLAGS_SIZE_MASK L4_IPC_FLAGS_SIZE_MASK
#define IPC_FLAGS_SIZE_SHIFT L4_IPC_FLAGS_SIZE_SHIFT
#define IPC_FLAGS_MSG_INDEX_SHIFT L4_IPC_FLAGS_MSG_INDEX_SHIFT
#define IPC_FLAGS_ERROR_MASK 0xF0000000
#define IPC_FLAGS_ERROR_SHIFT 28
#define IPC_EFAULT (1 << 28)
#define IPC_ENOIPC (1 << 29)
#define IPC_EXTENDED_MAX_SIZE (SZ_1K*2)
struct utcb { struct utcb {
u32 mr[MR_TOTAL]; /* MRs that are mapped to real registers */ u32 mr[MR_TOTAL]; /* MRs that are mapped to real registers */
+27 -27
View File
@@ -66,14 +66,14 @@ int ipc_full_copy(struct ktcb *to, struct ktcb *from)
static inline int extended_ipc_msg_index(unsigned int flags) static inline int extended_ipc_msg_index(unsigned int flags)
{ {
return (flags & L4_IPC_FLAGS_MSG_INDEX_MASK) return (flags & IPC_FLAGS_MSG_INDEX_MASK)
>> L4_IPC_FLAGS_MSG_INDEX_SHIFT; >> IPC_FLAGS_MSG_INDEX_SHIFT;
} }
static inline int extended_ipc_msg_size(unsigned int flags) static inline int extended_ipc_msg_size(unsigned int flags)
{ {
return (flags & L4_IPC_FLAGS_SIZE_MASK) return (flags & IPC_FLAGS_SIZE_MASK)
>> L4_IPC_FLAGS_SIZE_SHIFT; >> IPC_FLAGS_SIZE_SHIFT;
} }
/* /*
@@ -125,28 +125,28 @@ int ipc_msg_copy(struct ktcb *to, struct ktcb *from)
*/ */
switch(recv_ipc_type) { switch(recv_ipc_type) {
case L4_IPC_FLAGS_SHORT: case IPC_FLAGS_SHORT:
if (send_ipc_type == L4_IPC_FLAGS_SHORT) if (send_ipc_type == IPC_FLAGS_SHORT)
ret = ipc_short_copy(to, from); ret = ipc_short_copy(to, from);
if (send_ipc_type == L4_IPC_FLAGS_FULL) if (send_ipc_type == IPC_FLAGS_FULL)
ret = ipc_full_copy(to, from); ret = ipc_full_copy(to, from);
if (send_ipc_type == L4_IPC_FLAGS_EXTENDED) if (send_ipc_type == IPC_FLAGS_EXTENDED)
ret = -ENOIPC; ret = -ENOIPC;
break; break;
case L4_IPC_FLAGS_FULL: case IPC_FLAGS_FULL:
if (send_ipc_type == L4_IPC_FLAGS_SHORT) if (send_ipc_type == IPC_FLAGS_SHORT)
ret = ipc_full_copy(to, from); ret = ipc_full_copy(to, from);
if (send_ipc_type == L4_IPC_FLAGS_FULL) if (send_ipc_type == IPC_FLAGS_FULL)
ret = ipc_full_copy(to, from); ret = ipc_full_copy(to, from);
if (send_ipc_type == L4_IPC_FLAGS_EXTENDED) if (send_ipc_type == IPC_FLAGS_EXTENDED)
ret = -ENOIPC; ret = -ENOIPC;
break; break;
case L4_IPC_FLAGS_EXTENDED: case IPC_FLAGS_EXTENDED:
if (send_ipc_type == L4_IPC_FLAGS_EXTENDED) if (send_ipc_type == IPC_FLAGS_EXTENDED)
ret = ipc_extended_copy(to, from); ret = ipc_extended_copy(to, from);
if (send_ipc_type == L4_IPC_FLAGS_SHORT) if (send_ipc_type == IPC_FLAGS_SHORT)
ret = -ENOIPC; ret = -ENOIPC;
if (send_ipc_type == L4_IPC_FLAGS_FULL) if (send_ipc_type == IPC_FLAGS_FULL)
ret = -ENOIPC; ret = -ENOIPC;
break; break;
} }
@@ -180,9 +180,9 @@ void ipc_signal_error(struct ktcb *sleeper, int retval)
* Set ipc error flag for sleeper. * Set ipc error flag for sleeper.
*/ */
if (retval == -EFAULT) if (retval == -EFAULT)
sleeper->ipc_flags |= L4_IPC_EFAULT; sleeper->ipc_flags |= IPC_EFAULT;
if (retval == -ENOIPC) if (retval == -ENOIPC)
sleeper->ipc_flags |= L4_IPC_ENOIPC; sleeper->ipc_flags |= IPC_ENOIPC;
} }
/* /*
@@ -199,14 +199,14 @@ int ipc_handle_errors(void)
} }
/* Did ipc fail with a fault error? */ /* Did ipc fail with a fault error? */
if (current->ipc_flags & L4_IPC_EFAULT) { if (current->ipc_flags & IPC_EFAULT) {
current->ipc_flags &= ~L4_IPC_EFAULT; current->ipc_flags &= ~IPC_EFAULT;
return -EFAULT; return -EFAULT;
} }
/* Did ipc fail with a general ipc error? */ /* Did ipc fail with a general ipc error? */
if (current->ipc_flags & L4_IPC_ENOIPC) { if (current->ipc_flags & IPC_ENOIPC) {
current->ipc_flags &= ~L4_IPC_ENOIPC; current->ipc_flags &= ~IPC_ENOIPC;
return -ENOIPC; return -ENOIPC;
} }
@@ -413,7 +413,7 @@ int ipc_recv_extended(l4id_t sendertid, unsigned int flags)
size = extended_ipc_msg_size(flags); size = extended_ipc_msg_size(flags);
/* Check size is good */ /* Check size is good */
if (size > L4_IPC_EXTENDED_MAX_SIZE) if (size > IPC_EXTENDED_MAX_SIZE)
return -EINVAL; return -EINVAL;
/* Set extended ipc copy size */ /* Set extended ipc copy size */
@@ -473,7 +473,7 @@ int ipc_send_extended(l4id_t recv_tid, unsigned int flags)
size = extended_ipc_msg_size(flags); size = extended_ipc_msg_size(flags);
/* Check size is good */ /* Check size is good */
if (size > L4_IPC_EXTENDED_MAX_SIZE) if (size > IPC_EXTENDED_MAX_SIZE)
return -EINVAL; return -EINVAL;
/* Set extended ipc copy size */ /* Set extended ipc copy size */
@@ -508,19 +508,19 @@ static inline int __sys_ipc(l4id_t to, l4id_t from,
switch (ipc_type) { switch (ipc_type) {
case IPC_SEND: case IPC_SEND:
if (flags & L4_IPC_FLAGS_EXTENDED) if (flags & IPC_FLAGS_EXTENDED)
ret = ipc_send_extended(to, flags); ret = ipc_send_extended(to, flags);
else else
ret = ipc_send(to, flags); ret = ipc_send(to, flags);
break; break;
case IPC_RECV: case IPC_RECV:
if (flags & L4_IPC_FLAGS_EXTENDED) if (flags & IPC_FLAGS_EXTENDED)
ret = ipc_recv_extended(from, flags); ret = ipc_recv_extended(from, flags);
else else
ret = ipc_recv(from, flags); ret = ipc_recv(from, flags);
break; break;
case IPC_SENDRECV: case IPC_SENDRECV:
if (flags & L4_IPC_FLAGS_EXTENDED) if (flags & IPC_FLAGS_EXTENDED)
ret = ipc_sendrecv_extended(to, from, flags); ret = ipc_sendrecv_extended(to, from, flags);
else else
ret = ipc_sendrecv(to, from, flags); ret = ipc_sendrecv(to, from, flags);
+1 -1
View File
@@ -60,7 +60,7 @@ void fault_ipc_to_pager(u32 faulty_pc, u32 fsr, u32 far)
/* Save current ipc flags and set current flags to short ipc */ /* Save current ipc flags and set current flags to short ipc */
saved_flags = tcb_get_ipc_flags(current); saved_flags = tcb_get_ipc_flags(current);
tcb_set_ipc_flags(current, L4_IPC_FLAGS_SHORT); tcb_set_ipc_flags(current, IPC_FLAGS_SHORT);
/* Send ipc to the task's pager */ /* Send ipc to the task's pager */
ipc_sendrecv(current->pagerid, current->pagerid, 0); ipc_sendrecv(current->pagerid, current->pagerid, 0);