diff --git a/include/l4/generic/tcb.h b/include/l4/generic/tcb.h index 7f18565..575e740 100644 --- a/include/l4/generic/tcb.h +++ b/include/l4/generic/tcb.h @@ -12,7 +12,7 @@ #include #include INC_GLUE(memory.h) #include INC_GLUE(syscall.h) -#include INC_GLUE(utcb.h) +#include INC_GLUE(message.h) #include INC_SUBARCH(mm.h) enum task_state { diff --git a/include/l4/glue/arm/message.h b/include/l4/glue/arm/message.h new file mode 100644 index 0000000..5ceb86e --- /dev/null +++ b/include/l4/glue/arm/message.h @@ -0,0 +1,19 @@ +/* + * Userspace thread control block + * + * Copyright (C) 2007 Bahadir Balban + */ +#ifndef __GLUE_ARM_MESSAGE_H__ +#define __GLUE_ARM_MESSAGE_H__ + +#define MR_TOTAL 6 +#define MR_TAG 0 /* Contains the purpose of message */ +#define MR_SENDER 1 /* For anythread receivers to discover sender */ +#define MR_RETURN 0 /* Contains the posix return value. */ + +/* These define the mr start - end range that isn't used by userspace syslib */ +#define MR_UNUSED_START 2 /* The first mr that's not used by syslib.h */ +#define MR_UNUSED_TOTAL (MR_TOTAL - MR_UNUSED_START) +#define MR_USABLE_TOTAL MR_UNUSED_TOTAL + +#endif /* __GLUE_ARM_MESSAGE_H__ */ diff --git a/include/l4/glue/arm/utcb.h b/include/l4/glue/arm/utcb.h deleted file mode 100644 index 97f5285..0000000 --- a/include/l4/glue/arm/utcb.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Userspace thread control block - * - * Copyright (C) 2007 Bahadir Balban - */ -#ifndef __GLUE_ARM_UTCB_H__ -#define __GLUE_ARM_UTCB_H__ - -#define MR_TOTAL 6 - -#define MR_TAG 0 -#define MR_SENDER 1 -#define MR_UNUSED_START 2 - -/* Compact utcb for now! 8-) */ -struct utcb { - u32 mr[MR_TOTAL]; - u32 global_id; /* Thread id */ - u32 usr_handle; /* Use as TLS */ -}; - -#endif /* __GLUE_ARM_UTCB_H__ */ diff --git a/src/api/ipc.c b/src/api/ipc.c index aa6389e..0c4ebc4 100644 --- a/src/api/ipc.c +++ b/src/api/ipc.c @@ -12,7 +12,7 @@ #include #include #include INC_API(syscall.h) -#include INC_GLUE(utcb.h) +#include INC_GLUE(message.h) enum IPC_TYPE { IPC_INVALID = 0, diff --git a/src/arch/arm/exception.c b/src/arch/arm/exception.c index 01aa427..b4c1847 100644 --- a/src/arch/arm/exception.c +++ b/src/arch/arm/exception.c @@ -13,7 +13,7 @@ #include INC_ARCH(exception.h) #include INC_GLUE(memlayout.h) #include INC_GLUE(memory.h) -#include INC_GLUE(utcb.h) +#include INC_GLUE(message.h) #include INC_SUBARCH(mm.h) /* Send data fault ipc to the faulty task's pager */ diff --git a/src/glue/arm/init.c b/src/glue/arm/init.c index d46ca84..7dac98a 100644 --- a/src/glue/arm/init.c +++ b/src/glue/arm/init.c @@ -20,7 +20,7 @@ #include INC_SUBARCH(mmu_ops.h) #include INC_GLUE(memlayout.h) #include INC_GLUE(memory.h) -#include INC_GLUE(utcb.h) +#include INC_GLUE(message.h) #include INC_GLUE(syscall.h) #include INC_PLAT(platform.h) #include INC_PLAT(printascii.h) diff --git a/tasks/fs0/main.c b/tasks/fs0/main.c index 2855c79..a3d074f 100644 --- a/tasks/fs0/main.c +++ b/tasks/fs0/main.c @@ -5,7 +5,6 @@ */ #include #include -#include #include #include #include diff --git a/tasks/libl4/SConstruct b/tasks/libl4/SConstruct index 4140060..d4a47f1 100644 --- a/tasks/libl4/SConstruct +++ b/tasks/libl4/SConstruct @@ -13,8 +13,9 @@ kernel_headers = join(project_root, "include") config_h = join(project_root, "include/l4/config.h") env = Environment(CC = 'arm-none-linux-gnueabi-gcc', - CCFLAGS = ['-g', '-nostdinc', '-nostdlib', '-ffreestanding'], + CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'], LINKFLAGS = ['-nostdlib'], + ASFLAGS = ['-D__ASSEMBLY__'], ENV = {'PATH' : os.environ['PATH']}, LIBS = 'gcc') diff --git a/tasks/libl4/include/l4lib/arch-arm/message.h b/tasks/libl4/include/l4lib/arch-arm/message.h deleted file mode 100644 index ed893a5..0000000 --- a/tasks/libl4/include/l4lib/arch-arm/message.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __ARM_MESSAGE_H__ -#define __ARM_MESSAGE_H__ - -#include -#include - -/* Functions to read/write utcb registers */ -static inline unsigned int read_mr(int offset) -{ - return __L4_ARM_Utcb()->mr[offset]; -} - -static inline void write_mr(unsigned int offset, unsigned int val) -{ - __L4_ARM_Utcb()->mr[offset] = val; -} - -/* Tag definitions */ -#define L4_TAG_PFLAG (1 << 12) /* Propagation */ -#define L4_TAG_NFLAG (1 << 13) /* Notify */ -#define L4_TAG_RFLAG (1 << 14) /* Block-on-receive */ -#define L4_TAG_SFLAG (1 << 15) /* Block-on-send */ -#define L4_TAG_XFLAG (1 << 14) /* Crosscall (inter-cpu ipc) */ -#define L4_TAG_EFLAG (1 << 15) /* Error */ - -#endif /* __ARM_MESSAGE_H__ */ diff --git a/tasks/libl4/include/l4lib/arch-arm/syscalls.h b/tasks/libl4/include/l4lib/arch-arm/syscalls.h index fccfce6..6e47cb4 100644 --- a/tasks/libl4/include/l4lib/arch-arm/syscalls.h +++ b/tasks/libl4/include/l4lib/arch-arm/syscalls.h @@ -7,8 +7,7 @@ #define __ARM_SYSCALLS_H__ #include -#include -#include +#include #include #include #include diff --git a/tasks/libl4/include/l4lib/arch-arm/utcb.h b/tasks/libl4/include/l4lib/arch-arm/utcb.h index 124f2a1..4065c95 100644 --- a/tasks/libl4/include/l4lib/arch-arm/utcb.h +++ b/tasks/libl4/include/l4lib/arch-arm/utcb.h @@ -1,30 +1,21 @@ #ifndef __ARM_UTCB_H__ #define __ARM_UTCB_H__ -#include -#include +#define USER_UTCB_REF 0xFF000FF0 +#define L4_KIP_ADDRESS 0xFF000000 +#define UTCB_KIP_OFFSET 0xFF0 -/* FIXME: LICENSE/LICENCE */ +#ifndef __ASSEMBLY__ +#include +#include +#include INC_GLUE(message.h) /* * NOTE: In syslib.h the first few mrs are used by data frequently - * needed for all ipcs. Those mrs are defined here. + * needed for all ipcs. Those mrs are defined the kernel message.h */ -/* MRs always used on receive by syslib */ -#define MR_RETURN 0 /* Contains the posix return value. */ - -/* MRs always used on send by syslib */ -#define MR_TAG 0 /* Defines the message purpose */ -#define MR_SENDER 1 /* For anythread receivers to discover sender */ - -/* These define the mr start - end range that aren't used by syslib */ -#define MR_UNUSED_START 2 /* The first mr that's not used by syslib.h */ -#define MR_TOTAL 6 -#define MR_UNUSED_TOTAL (MR_TOTAL - MR_UNUSED_START) -#define MR_USABLE_TOTAL MR_UNUSED_TOTAL - - /* Compact utcb for now! :-) */ +/* Compact utcb for now! :-) */ struct utcb { u32 mr[MR_TOTAL]; u32 tid; /* Thread id */ @@ -36,9 +27,22 @@ struct utcb { unsigned long usr_handle; }; +/* FIXME: LICENSE/LICENCE */ static inline struct utcb *__L4_ARM_Utcb() { return (struct utcb *)(*(struct utcb **)USER_UTCB_REF); } +/* Functions to read/write utcb registers */ +static inline unsigned int read_mr(int offset) +{ + return __L4_ARM_Utcb()->mr[offset]; +} + +static inline void write_mr(unsigned int offset, unsigned int val) +{ + __L4_ARM_Utcb()->mr[offset] = val; +} +#endif /* !__ASSEMBLY__ */ + #endif /* __ARM_UTCB_H__ */ diff --git a/tasks/libl4/include/l4lib/arch-arm/vregs.h b/tasks/libl4/include/l4lib/arch-arm/vregs.h deleted file mode 100644 index 1bdc513..0000000 --- a/tasks/libl4/include/l4lib/arch-arm/vregs.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2007 Bahadir Balban - */ -#ifndef __L4_ARM_VREGS_H__ -#define __L4_ARM_VREGS_H__ - -/* FIXME: LICENSE/LICENCE */ -#define USER_UTCB_REF 0xFF000FF0 -#define L4_KIP_ADDRESS 0xFF000000 -#define UTCB_KIP_OFFSET 0xFF0 - -#endif /* __L4_ARM_VREGS_H__ */ - diff --git a/tasks/libl4/src/arm/syscalls.S b/tasks/libl4/src/arm/syscalls.S index c4f39cb..df390d8 100644 --- a/tasks/libl4/src/arm/syscalls.S +++ b/tasks/libl4/src/arm/syscalls.S @@ -4,7 +4,7 @@ * Copyright (C) 2007 Bahadir Balban */ #include -#include +#include #include .macro utcb_address rx diff --git a/tasks/mm0/main.c b/tasks/mm0/main.c index 6ff48ae..bc9ef1c 100644 --- a/tasks/mm0/main.c +++ b/tasks/mm0/main.c @@ -5,7 +5,7 @@ */ #include #include -#include +#include #include #include #include diff --git a/tasks/test0/main.c b/tasks/test0/main.c index 4a0e118..f5065e1 100644 --- a/tasks/test0/main.c +++ b/tasks/test0/main.c @@ -5,7 +5,6 @@ */ #include #include -#include #include #include #include