From 680d20ff94592d9b70ba95e31015cabd6aecd09f Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Wed, 13 May 2009 16:08:37 +0300 Subject: [PATCH] Initial changes to libl4 for full and extended ipc. - Tag word will be used to specify full and extended ipc, and its size. --- tasks/libl4/include/l4lib/arch-arm/syslib.h | 46 ++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/tasks/libl4/include/l4lib/arch-arm/syslib.h b/tasks/libl4/include/l4lib/arch-arm/syslib.h index ba6fc7c..3af2ece 100644 --- a/tasks/libl4/include/l4lib/arch-arm/syslib.h +++ b/tasks/libl4/include/l4lib/arch-arm/syslib.h @@ -50,14 +50,56 @@ static inline void l4_set_sender(l4id_t sender) write_mr(MR_SENDER, sender); } +#define L4_IPC_FLAGS_FULL 0x00001000 /* Full IPC involves full UTCB copy */ +#define L4_IPC_FLAGS_EXTENDED 0x00002000 /* Extended IPC can page-fault and copy up to 2KB */ +#define L4_IPC_FLAGS_MASK 0x0000F000 +#define L4_IPC_TAG_MASK 0x00000FFF +#define L4_IPC_SIZE_MASK 0x0FFF0000 +#define L4_IPC_SIZE_SHIFT 16 + +static inline void l4_set_ipc_size(unsigned int size) +{ + unsigned int tag_flags = read_mr(MR_TAG); + + tag_flags &= ~L4_IPC_SIZE_MASK; + tag_flags |= ((size << L4_IPC_SIZE_SHIFT) & L4_IPC_SIZE_MASK); + + write_mr(MR_TAG, size); +} + +static inline unsigned int l4_get_ipc_size(void) +{ + return (read_mr(MR_TAG) >> L4_IPC_SIZE_SHIFT) & L4_IPC_SIZE_MASK; +} + +static inline void l4_set_ipc_flags(unsigned int flags) +{ + unsigned int tag_flags = read_mr(MR_TAG); + + tag_flags &= ~L4_IPC_FLAGS_MASK; + tag_flags |= L4_IPC_FLAGS_MASK & flags; + + write_mr(MR_TAG, tag_flags); +} + +static inline unsigned int l4_get_ipc_flags(unsigned int flags) +{ + return read_mr(MR_TAG) & L4_IPC_FLAGS_MASK; +} + static inline unsigned int l4_get_tag(void) { - return read_mr(MR_TAG); + return read_mr(MR_TAG) & L4_IPC_TAG_MASK; } static inline void l4_set_tag(unsigned int tag) { - write_mr(MR_TAG, tag); + unsigned int tag_flags = read_mr(MR_TAG); + + tag_flags &= ~L4_IPC_TAG_MASK; + tag_flags |= tag & L4_IPC_TAG_MASK; + + write_mr(MR_TAG, tag_flags); } /*