From e61e9e9533ea1a349bfcd017057968ccafc4864c Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Thu, 28 May 2009 13:02:37 +0300 Subject: [PATCH] Moved ipc flags manipulation to ipc.h glue file --- include/l4/generic/tcb.h | 36 ------------------------- include/l4/glue/arm/ipc.h | 55 +++++++++++++++++++++++++++++++++++++++ src/api/ipc.c | 14 +--------- src/arch/arm/exception.c | 1 + 4 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 include/l4/glue/arm/ipc.h diff --git a/include/l4/generic/tcb.h b/include/l4/generic/tcb.h index 1fa5dc6..b1ce0bc 100644 --- a/include/l4/generic/tcb.h +++ b/include/l4/generic/tcb.h @@ -134,42 +134,6 @@ static inline void set_task_ids(struct ktcb *task, struct task_ids *ids) task->tgid = ids->tgid; } -static inline void tcb_set_ipc_flags(struct ktcb *task, - unsigned int flags) -{ - task->ipc_flags = flags; -} - -static inline unsigned int tcb_get_ipc_flags(struct ktcb *task) -{ - return task->ipc_flags; -} - -static inline unsigned int -ipc_flags_set_type(unsigned int flags, unsigned int type) -{ - flags &= ~IPC_FLAGS_TYPE_MASK; - flags |= type & IPC_FLAGS_TYPE_MASK; - return flags; -} - -static inline unsigned int ipc_flags_get_type(unsigned int flags) -{ - return flags & IPC_FLAGS_TYPE_MASK; -} - -static inline void tcb_set_ipc_type(struct ktcb *task, - unsigned int type) -{ - task->ipc_flags = ipc_flags_set_type(task->ipc_flags, - type); -} - -static inline unsigned int tcb_get_ipc_type(struct ktcb *task) -{ - return ipc_flags_get_type(task->ipc_flags); -} - #define THREAD_IDS_MAX 1024 #define SPACE_IDS_MAX 1024 diff --git a/include/l4/glue/arm/ipc.h b/include/l4/glue/arm/ipc.h new file mode 100644 index 0000000..9b3eead --- /dev/null +++ b/include/l4/glue/arm/ipc.h @@ -0,0 +1,55 @@ +#ifndef __GLUE_ARM_IPC_H__ +#define __GLUE_ARM_IPC_H__ + +#include +#include INC_GLUE(message.h) + +static inline int extended_ipc_msg_index(unsigned int flags) +{ + return (flags & IPC_FLAGS_MSG_INDEX_MASK) + >> IPC_FLAGS_MSG_INDEX_SHIFT; +} + +static inline int extended_ipc_msg_size(unsigned int flags) +{ + return (flags & IPC_FLAGS_SIZE_MASK) + >> IPC_FLAGS_SIZE_SHIFT; +} + +static inline void tcb_set_ipc_flags(struct ktcb *task, + unsigned int flags) +{ + task->ipc_flags = flags; +} + +static inline unsigned int tcb_get_ipc_flags(struct ktcb *task) +{ + return task->ipc_flags; +} + +static inline unsigned int +ipc_flags_set_type(unsigned int flags, unsigned int type) +{ + flags &= ~IPC_FLAGS_TYPE_MASK; + flags |= type & IPC_FLAGS_TYPE_MASK; + return flags; +} + +static inline unsigned int ipc_flags_get_type(unsigned int flags) +{ + return flags & IPC_FLAGS_TYPE_MASK; +} + +static inline void tcb_set_ipc_type(struct ktcb *task, + unsigned int type) +{ + task->ipc_flags = ipc_flags_set_type(task->ipc_flags, + type); +} + +static inline unsigned int tcb_get_ipc_type(struct ktcb *task) +{ + return ipc_flags_get_type(task->ipc_flags); +} + +#endif /* __GLUE_ARM_IPC_H__ */ diff --git a/src/api/ipc.c b/src/api/ipc.c index d1680c8..c3a8856 100644 --- a/src/api/ipc.c +++ b/src/api/ipc.c @@ -14,6 +14,7 @@ #include #include INC_API(syscall.h) #include INC_GLUE(message.h) +#include INC_GLUE(ipc.h) /* * ipc syscall uses an ipc_type variable and send/recv @@ -63,19 +64,6 @@ int ipc_full_copy(struct ktcb *to, struct ktcb *from) return 0; } - -static inline int extended_ipc_msg_index(unsigned int flags) -{ - return (flags & IPC_FLAGS_MSG_INDEX_MASK) - >> IPC_FLAGS_MSG_INDEX_SHIFT; -} - -static inline int extended_ipc_msg_size(unsigned int flags) -{ - return (flags & IPC_FLAGS_SIZE_MASK) - >> IPC_FLAGS_SIZE_SHIFT; -} - /* * Extended copy is asymmetric in that the copying always occurs from * the sender's kernel stack to receivers userspace buffers. diff --git a/src/arch/arm/exception.c b/src/arch/arm/exception.c index df6445c..1ab760c 100644 --- a/src/arch/arm/exception.c +++ b/src/arch/arm/exception.c @@ -15,6 +15,7 @@ #include INC_GLUE(memlayout.h) #include INC_GLUE(memory.h) #include INC_GLUE(message.h) +#include INC_GLUE(ipc.h) #include INC_SUBARCH(mm.h) /* Abort debugging conditions */