mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Merged some libl4 utcb headers, moved mr defs to kernel message.h
Headers 3 headers related to message registers and utcbs are now merged under utcb.h in libl4. Some message register definitions used by the kernel are now moved into kernel's glue/message.h. This avoids the duplication of same definitions. Also the total number of mregs are now determined by arch-specific kernel header, which is good.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <l4/generic/pgalloc.h>
|
||||
#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 {
|
||||
|
||||
19
include/l4/glue/arm/message.h
Normal file
19
include/l4/glue/arm/message.h
Normal file
@@ -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__ */
|
||||
@@ -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__ */
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <l4/lib/bit.h>
|
||||
#include <l4/generic/kmalloc.h>
|
||||
#include INC_API(syscall.h)
|
||||
#include INC_GLUE(utcb.h)
|
||||
#include INC_GLUE(message.h)
|
||||
|
||||
enum IPC_TYPE {
|
||||
IPC_INVALID = 0,
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <l4lib/arch/message.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/kip.h>
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef __ARM_MESSAGE_H__
|
||||
#define __ARM_MESSAGE_H__
|
||||
|
||||
#include <l4lib/types.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
|
||||
/* 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__ */
|
||||
@@ -7,8 +7,7 @@
|
||||
#define __ARM_SYSCALLS_H__
|
||||
|
||||
#include <l4lib/arch/types.h>
|
||||
#include <l4lib/arch/vregs.h>
|
||||
#include <l4lib/arch/message.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
#include <l4/generic/space.h>
|
||||
#include <l4/api/space.h>
|
||||
#include <l4/api/kip.h>
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
#ifndef __ARM_UTCB_H__
|
||||
#define __ARM_UTCB_H__
|
||||
|
||||
#include <l4lib/types.h>
|
||||
#include <l4lib/arch/vregs.h>
|
||||
#define USER_UTCB_REF 0xFF000FF0
|
||||
#define L4_KIP_ADDRESS 0xFF000000
|
||||
#define UTCB_KIP_OFFSET 0xFF0
|
||||
|
||||
/* FIXME: LICENSE/LICENCE */
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <l4lib/types.h>
|
||||
#include <l4/macros.h>
|
||||
#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__ */
|
||||
|
||||
@@ -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__ */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#include <l4lib/arch/asm.h>
|
||||
#include <l4lib/arch/vregs.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
#include <l4/generic/space.h>
|
||||
|
||||
.macro utcb_address rx
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <init.h>
|
||||
#include <l4lib/arch/message.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/kip.h>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <l4lib/arch/message.h>
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/kip.h>
|
||||
#include <l4lib/utcb.h>
|
||||
|
||||
Reference in New Issue
Block a user