mirror of
https://github.com/drasko/codezero.git
synced 2026-03-04 03:23:16 +01:00
Removed posix container files, moved libl4 to conts, moving linux module to conts as well
This commit is contained in:
1
conts/libl4/include/l4lib/arch
Symbolic link
1
conts/libl4/include/l4lib/arch
Symbolic link
@@ -0,0 +1 @@
|
||||
arch-arm
|
||||
15
conts/libl4/include/l4lib/arch-arm/asm.h
Normal file
15
conts/libl4/include/l4lib/arch-arm/asm.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __ARM_ASM_H__
|
||||
#define __ARM_ASM_H__
|
||||
|
||||
#define BEGIN_PROC(name) \
|
||||
.global name; \
|
||||
.type name,function; \
|
||||
.align; \
|
||||
name:
|
||||
|
||||
#define END_PROC(name) \
|
||||
.fend_##name: \
|
||||
.size name,.fend_##name - name;
|
||||
|
||||
#endif /* __ARM_ASM_H__ */
|
||||
|
||||
92
conts/libl4/include/l4lib/arch-arm/syscalls.h
Normal file
92
conts/libl4/include/l4lib/arch-arm/syscalls.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* System call prototypes.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#ifndef __ARM_SYSCALLS_H__
|
||||
#define __ARM_SYSCALLS_H__
|
||||
|
||||
|
||||
#include <l4lib/arch/types.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
#include <l4/generic/space.h>
|
||||
#include <l4/api/space.h>
|
||||
#include <l4/api/kip.h>
|
||||
#include <l4/api/ipc.h>
|
||||
#include <l4/api/thread.h>
|
||||
|
||||
struct task_ids {
|
||||
int tid;
|
||||
int spid;
|
||||
int tgid;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
l4_kernel_interface(unsigned int *api_version, unsigned int *api_flags,
|
||||
unsigned int *kernel_id)
|
||||
{
|
||||
return (void *)L4_KIP_ADDRESS;
|
||||
}
|
||||
|
||||
typedef unsigned int (*__l4_thread_switch_t)(u32);
|
||||
extern __l4_thread_switch_t __l4_thread_switch;
|
||||
unsigned int l4_thread_switch (u32 dest);
|
||||
|
||||
typedef int (*__l4_getid_t)(struct task_ids *ids);
|
||||
extern __l4_getid_t __l4_getid;
|
||||
int l4_getid(struct task_ids *ids);
|
||||
|
||||
typedef int (*__l4_ipc_t)(l4id_t to, l4id_t from, u32 flags);
|
||||
extern __l4_ipc_t __l4_ipc;
|
||||
int l4_ipc(l4id_t to, l4id_t from, u32 flags);
|
||||
|
||||
typedef int (*__l4_capability_control_t)(unsigned int req, unsigned int flags, void *buf);
|
||||
extern __l4_capability_control_t __l4_capability_control;
|
||||
int l4_capability_control(unsigned int req, unsigned int flags, void *buf);
|
||||
|
||||
typedef int (*__l4_map_t)(void *phys, void *virt,
|
||||
u32 npages, u32 flags, l4id_t tid);
|
||||
extern __l4_map_t __l4_map;
|
||||
int l4_map(void *p, void *v, u32 npages, u32 flags, l4id_t tid);
|
||||
|
||||
typedef int (*__l4_unmap_t)(void *virt, unsigned long npages, l4id_t tid);
|
||||
extern __l4_unmap_t __l4_unmap;
|
||||
int l4_unmap(void *virtual, unsigned long numpages, l4id_t tid);
|
||||
|
||||
typedef int (*__l4_thread_control_t)(unsigned int action, struct task_ids *ids);
|
||||
extern __l4_thread_control_t __l4_thread_control;
|
||||
int l4_thread_control(unsigned int action, struct task_ids *ids);
|
||||
|
||||
typedef int (*__l4_space_control_t)(unsigned int action, void *kdata);
|
||||
extern __l4_space_control_t __l4_space_control;
|
||||
int l4_space_control(unsigned int action, void *kdata);
|
||||
|
||||
typedef int (*__l4_ipc_control_t)(unsigned int action, l4id_t blocked_sender,
|
||||
u32 blocked_tag);
|
||||
extern __l4_ipc_control_t __l4_ipc_control;
|
||||
int l4_ipc_control(unsigned int, l4id_t blocked_sender, u32 blocked_tag);
|
||||
|
||||
typedef int (*__l4_exchange_registers_t)(void *exregs_struct, l4id_t tid);
|
||||
extern __l4_exchange_registers_t __l4_exchange_registers;
|
||||
int l4_exchange_registers(void *exregs_struct, l4id_t tid);
|
||||
|
||||
typedef int (*__l4_container_control_t)(unsigned int req, unsigned int flags, void *buf);
|
||||
extern __l4_container_control_t __l4_container_control;
|
||||
int l4_container_control(unsigned int req, unsigned int flags, void *buf);
|
||||
|
||||
typedef int (*__l4_time_t)(void *timeval, int set);
|
||||
extern __l4_time_t __l4_time;
|
||||
int l4_time(void *timeval, int set);
|
||||
|
||||
typedef int (*__l4_mutex_control_t)(void *mutex_word, int op);
|
||||
extern __l4_mutex_control_t __l4_mutex_control;
|
||||
int l4_mutex_control(void *mutex_word, int op);
|
||||
|
||||
|
||||
/* To be supplied by server tasks. */
|
||||
void *virt_to_phys(void *);
|
||||
void *phys_to_virt(void *);
|
||||
|
||||
|
||||
#endif /* __ARM_SYSCALLS_H__ */
|
||||
|
||||
292
conts/libl4/include/l4lib/arch-arm/syslib.h
Normal file
292
conts/libl4/include/l4lib/arch-arm/syslib.h
Normal file
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Helper functions that wrap raw l4 syscalls.
|
||||
*
|
||||
* Copyright (C) 2007-2009 Bahadir Bilgehan Balban
|
||||
*/
|
||||
|
||||
#ifndef __L4LIB_SYSLIB_H__
|
||||
#define __L4LIB_SYSLIB_H__
|
||||
|
||||
#include <printf.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4/macros.h>
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* Its best to use these wrappers because they generalise the way
|
||||
* common ipc data like sender id, error, ipc tag are passed
|
||||
* between ipc parties.
|
||||
*
|
||||
* The arguments to l4_ipc() are used by the microkernel to initiate
|
||||
* the ipc. Any data passed in message registers may or may not be
|
||||
* a duplicate of this data, but the distinction is that anything
|
||||
* that is passed via the mrs are meant to be used by the other party
|
||||
* participating in the ipc.
|
||||
*/
|
||||
|
||||
/* For system call arguments */
|
||||
#define L4SYS_ARG0 (MR_UNUSED_START)
|
||||
#define L4SYS_ARG1 (MR_UNUSED_START + 1)
|
||||
#define L4SYS_ARG2 (MR_UNUSED_START + 2)
|
||||
#define L4SYS_ARG3 (MR_UNUSED_START + 3)
|
||||
|
||||
|
||||
#define L4_IPC_TAG_MASK 0x00000FFF
|
||||
|
||||
|
||||
/*
|
||||
* Servers get sender.
|
||||
*/
|
||||
static inline l4id_t l4_get_sender(void)
|
||||
{
|
||||
return (l4id_t)read_mr(MR_SENDER);
|
||||
}
|
||||
|
||||
/*
|
||||
* When doing an ipc the sender never has to be explicitly set in
|
||||
* the utcb via this function since this information is found out
|
||||
* by the microkernel by checking the system caller's id. This is
|
||||
* only used for restoring the sender on the utcb in order to
|
||||
* complete an earlier ipc.
|
||||
*/
|
||||
static inline void l4_set_sender(l4id_t sender)
|
||||
{
|
||||
write_mr(MR_SENDER, sender);
|
||||
}
|
||||
|
||||
static inline unsigned int l4_set_ipc_size(unsigned int word, unsigned int size)
|
||||
{
|
||||
word &= ~L4_IPC_FLAGS_SIZE_MASK;
|
||||
word |= ((size << L4_IPC_FLAGS_SIZE_SHIFT) & L4_IPC_FLAGS_SIZE_MASK);
|
||||
return word;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_ipc_size(unsigned int word)
|
||||
{
|
||||
return (word & L4_IPC_FLAGS_SIZE_MASK) >> L4_IPC_FLAGS_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_set_ipc_msg_index(unsigned int word, unsigned int index)
|
||||
{
|
||||
/* FIXME: Define MR_PRIMARY_TOTAL, MR_TOTAL etc. and use MR_TOTAL HERE! */
|
||||
BUG_ON(index > UTCB_SIZE);
|
||||
|
||||
word &= ~L4_IPC_FLAGS_MSG_INDEX_MASK;
|
||||
word |= (index << L4_IPC_FLAGS_MSG_INDEX_SHIFT) &
|
||||
L4_IPC_FLAGS_MSG_INDEX_MASK;
|
||||
return word;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_ipc_msg_index(unsigned int word)
|
||||
{
|
||||
return (word & L4_IPC_FLAGS_MSG_INDEX_MASK)
|
||||
>> L4_IPC_FLAGS_MSG_INDEX_SHIFT;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_set_ipc_flags(unsigned int word, unsigned int flags)
|
||||
{
|
||||
word &= ~L4_IPC_FLAGS_TYPE_MASK;
|
||||
word |= flags & L4_IPC_FLAGS_TYPE_MASK;
|
||||
return word;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_ipc_flags(unsigned int word)
|
||||
{
|
||||
return word & L4_IPC_FLAGS_TYPE_MASK;
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_tag(void)
|
||||
{
|
||||
return read_mr(MR_TAG) & L4_IPC_TAG_MASK;
|
||||
}
|
||||
|
||||
static inline void l4_set_tag(unsigned int 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);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're about to do another ipc, this saves the last ipc's
|
||||
* parameters such as the sender and tag information.
|
||||
* Any previously saved data in save slots are destroyed.
|
||||
*/
|
||||
static inline void l4_save_ipcregs(void)
|
||||
{
|
||||
l4_get_utcb()->saved_sender = l4_get_sender();
|
||||
l4_get_utcb()->saved_tag = l4_get_tag();
|
||||
}
|
||||
|
||||
static inline void l4_restore_ipcregs(void)
|
||||
{
|
||||
l4_set_tag(l4_get_utcb()->saved_tag);
|
||||
l4_set_sender(l4_get_utcb()->saved_sender);
|
||||
}
|
||||
|
||||
static inline l4id_t self_tid(void)
|
||||
{
|
||||
struct task_ids ids;
|
||||
|
||||
l4_getid(&ids);
|
||||
return ids.tid;
|
||||
}
|
||||
|
||||
static inline int l4_send_full(l4id_t to, unsigned int tag)
|
||||
{
|
||||
l4_set_tag(tag);
|
||||
return l4_ipc(to, L4_NILTHREAD, L4_IPC_FLAGS_FULL);
|
||||
}
|
||||
|
||||
static inline int l4_receive_full(l4id_t from)
|
||||
{
|
||||
return l4_ipc(L4_NILTHREAD, from, L4_IPC_FLAGS_FULL);
|
||||
}
|
||||
|
||||
static inline int l4_sendrecv_full(l4id_t to, l4id_t from, unsigned int tag)
|
||||
{
|
||||
int err;
|
||||
|
||||
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
||||
l4_set_tag(tag);
|
||||
|
||||
err = l4_ipc(to, from, L4_IPC_FLAGS_FULL);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline int l4_send_extended(l4id_t to, unsigned int tag,
|
||||
unsigned int size, void *buf)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
|
||||
l4_set_tag(tag);
|
||||
|
||||
/* Set up flags word for extended ipc */
|
||||
flags = l4_set_ipc_flags(flags, L4_IPC_FLAGS_EXTENDED);
|
||||
flags = l4_set_ipc_size(flags, size);
|
||||
flags = l4_set_ipc_msg_index(flags, L4SYS_ARG0);
|
||||
|
||||
/* Write buffer pointer to MR index that we specified */
|
||||
write_mr(L4SYS_ARG0, (unsigned long)buf);
|
||||
|
||||
return l4_ipc(to, L4_NILTHREAD, flags);
|
||||
}
|
||||
|
||||
static inline int l4_receive_extended(l4id_t from, unsigned int size, void *buf)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
|
||||
/* Indicate extended receive */
|
||||
flags = l4_set_ipc_flags(flags, L4_IPC_FLAGS_EXTENDED);
|
||||
|
||||
/* How much data is accepted */
|
||||
flags = l4_set_ipc_size(flags, size);
|
||||
|
||||
/* Indicate which MR index buffer pointer is stored */
|
||||
flags = l4_set_ipc_msg_index(flags, L4SYS_ARG0);
|
||||
|
||||
/* Set MR with buffer to receive data */
|
||||
write_mr(L4SYS_ARG0, (unsigned long)buf);
|
||||
|
||||
return l4_ipc(L4_NILTHREAD, from, flags);
|
||||
}
|
||||
|
||||
static inline int l4_sendrecv_extended(l4id_t to, l4id_t from,
|
||||
unsigned int tag, void *buf)
|
||||
{
|
||||
/* Need to imitate sendrecv but with extended send/recv flags */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int l4_send(l4id_t to, unsigned int tag)
|
||||
{
|
||||
l4_set_tag(tag);
|
||||
|
||||
return l4_ipc(to, L4_NILTHREAD, 0);
|
||||
}
|
||||
|
||||
static inline int l4_sendrecv(l4id_t to, l4id_t from, unsigned int tag)
|
||||
{
|
||||
int err;
|
||||
|
||||
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
||||
l4_set_tag(tag);
|
||||
|
||||
err = l4_ipc(to, from, 0);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline int l4_receive(l4id_t from)
|
||||
{
|
||||
return l4_ipc(L4_NILTHREAD, from, 0);
|
||||
}
|
||||
|
||||
/* Servers:
|
||||
* Sets the message register for returning errors back to client task.
|
||||
* These are usually posix error codes.
|
||||
*/
|
||||
static inline void l4_set_retval(int retval)
|
||||
{
|
||||
write_mr(MR_RETURN, retval);
|
||||
}
|
||||
|
||||
/* Clients:
|
||||
* Learn result of request.
|
||||
*/
|
||||
static inline int l4_get_retval(void)
|
||||
{
|
||||
return read_mr(MR_RETURN);
|
||||
}
|
||||
|
||||
static inline void l4_print_mrs()
|
||||
{
|
||||
printf("Message registers: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
|
||||
read_mr(0), read_mr(1), read_mr(2), read_mr(3),
|
||||
read_mr(4), read_mr(5));
|
||||
}
|
||||
|
||||
/* Servers:
|
||||
* Return the ipc result back to requesting task.
|
||||
*/
|
||||
static inline int l4_ipc_return(int retval)
|
||||
{
|
||||
l4id_t sender = l4_get_sender();
|
||||
|
||||
l4_set_retval(retval);
|
||||
|
||||
/* Setting the tag may overwrite retval so we l4_send without tagging */
|
||||
return l4_ipc(sender, L4_NILTHREAD, 0);
|
||||
}
|
||||
|
||||
void *l4_new_virtual(int npages);
|
||||
void *l4_del_virtual(void *virt, int npages);
|
||||
|
||||
/* A helper that translates and maps a physical address to virtual */
|
||||
static inline void *l4_map_helper(void *phys, int npages)
|
||||
{
|
||||
struct task_ids ids;
|
||||
void *virt = l4_new_virtual(npages);
|
||||
|
||||
l4_getid(&ids);
|
||||
l4_map(phys, virt, npages, MAP_USR_RW_FLAGS, ids.tid);
|
||||
return virt;
|
||||
}
|
||||
|
||||
|
||||
/* A helper that translates and maps a physical address to virtual */
|
||||
static inline void *l4_unmap_helper(void *virt, int npages)
|
||||
{
|
||||
struct task_ids ids;
|
||||
|
||||
l4_getid(&ids);
|
||||
l4_unmap(virt, npages, ids.tid);
|
||||
l4_del_virtual(virt, npages);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __L4LIB_SYSLIB_H__ */
|
||||
8
conts/libl4/include/l4lib/arch-arm/types.h
Normal file
8
conts/libl4/include/l4lib/arch-arm/types.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __L4LIB_ARM_TYPES_H___
|
||||
#define __L4LIB_ARM_TYPES_H__
|
||||
|
||||
#define TASK_ID_INVALID -1
|
||||
|
||||
#include <l4/arch/arm/types.h>
|
||||
|
||||
#endif /* __L4LIB_ARM_TYPES_H__ */
|
||||
71
conts/libl4/include/l4lib/arch-arm/utcb.h
Normal file
71
conts/libl4/include/l4lib/arch-arm/utcb.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Bahadir Bilgehan Balban
|
||||
*/
|
||||
#ifndef __ARM_UTCB_H__
|
||||
#define __ARM_UTCB_H__
|
||||
|
||||
#define USER_UTCB_REF 0xFF000050
|
||||
#define L4_KIP_ADDRESS 0xFF000000
|
||||
#define UTCB_KIP_OFFSET 0x50
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <l4lib/types.h>
|
||||
#include <l4/macros.h>
|
||||
#include INC_GLUE(message.h)
|
||||
#include INC_GLUE(memory.h)
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* UTCB implementation */
|
||||
|
||||
/*
|
||||
* NOTE: In syslib.h the first few mrs are used by data frequently
|
||||
* needed for all ipcs. Those mrs are defined the kernel message.h
|
||||
*/
|
||||
|
||||
struct utcb {
|
||||
u32 mr[MR_TOTAL]; /* MRs that are mapped to real registers */
|
||||
u32 saved_tag; /* Saved tag field for stacked ipcs */
|
||||
u32 saved_sender; /* Saved sender field for stacked ipcs */
|
||||
u32 mr_rest[MR_REST]; /* Complete the utcb for up to 64 words */
|
||||
};
|
||||
|
||||
extern struct kip *kip;
|
||||
|
||||
|
||||
/*
|
||||
* Pointer to Kernel Interface Page's UTCB pointer offset.
|
||||
*/
|
||||
extern struct utcb **kip_utcb_ref;
|
||||
|
||||
static inline struct utcb *l4_get_utcb()
|
||||
{
|
||||
/*
|
||||
* By double dereferencing, we get the private TLS (aka UTCB). First
|
||||
* reference is to the KIP's utcb offset, second is to the utcb itself,
|
||||
* to which the KIP's utcb reference had been updated during context
|
||||
* switch.
|
||||
*/
|
||||
return *kip_utcb_ref;
|
||||
}
|
||||
|
||||
/* Functions to read/write utcb registers */
|
||||
static inline unsigned int read_mr(int offset)
|
||||
{
|
||||
if (offset < MR_TOTAL)
|
||||
return l4_get_utcb()->mr[offset];
|
||||
else
|
||||
return l4_get_utcb()->mr_rest[offset - MR_TOTAL];
|
||||
}
|
||||
|
||||
static inline void write_mr(unsigned int offset, unsigned int val)
|
||||
{
|
||||
if (offset < MR_TOTAL)
|
||||
l4_get_utcb()->mr[offset] = val;
|
||||
else
|
||||
l4_get_utcb()->mr_rest[offset - MR_TOTAL] = val;
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __ARM_UTCB_H__ */
|
||||
24
conts/libl4/include/l4lib/exregs.h
Normal file
24
conts/libl4/include/l4lib/exregs.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef __MM0_EXREGS_H__
|
||||
#define __MM0_EXREGS_H__
|
||||
|
||||
#include <l4/api/exregs.h>
|
||||
|
||||
void exregs_set_stack(struct exregs_data *s, unsigned long sp);
|
||||
void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val);
|
||||
void exregs_set_pc(struct exregs_data *s, unsigned long pc);
|
||||
void exregs_set_pager(struct exregs_data *s, l4id_t pagerid);
|
||||
void exregs_set_utcb(struct exregs_data *s, unsigned long virt);
|
||||
|
||||
/*
|
||||
exregs_set_stack(unsigned long sp)
|
||||
exregs_set_pc(unsigned long pc)
|
||||
exregs_set_return(unsigned long retreg)
|
||||
exregs_set_arg0(unsigned long arg0)
|
||||
exregs_set_mr0(unsigned long mr0)
|
||||
exregs_set_mr_sender(unsigned long sender)
|
||||
exregs_set_mr_return(unsigned long retreg)
|
||||
exregs_set_all(unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3,
|
||||
unsigned long sp, unsigned long pc, u32 valid_vector, l4id_t pager);
|
||||
*/
|
||||
|
||||
#endif /* __MM0_EXREGS_H__ */
|
||||
6
conts/libl4/include/l4lib/init.h
Normal file
6
conts/libl4/include/l4lib/init.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __L4LIB_INIT__
|
||||
#define __L4LIB_INIT__
|
||||
|
||||
void __l4_init(void);
|
||||
|
||||
#endif
|
||||
65
conts/libl4/include/l4lib/ipcdefs.h
Normal file
65
conts/libl4/include/l4lib/ipcdefs.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2007, 2008 Bahadir Balban
|
||||
*
|
||||
* This file contains ipc definitions that are needed for server tasks
|
||||
* to communicate with each other. For example common shared memory ids
|
||||
* between two servers, or common ipc tags used between two servers are
|
||||
* defined here.
|
||||
*/
|
||||
#ifndef __IPCDEFS_H__
|
||||
#define __IPCDEFS_H__
|
||||
|
||||
#include <l4/api/ipc.h>
|
||||
|
||||
/* SHMID used betweeen FS0 and BLKDEV0 servers */
|
||||
#define FS_BLKDEV_SHMID 0
|
||||
|
||||
/*** IPC Tags used between server tasks ***/
|
||||
|
||||
/* For ping ponging */
|
||||
#define L4_IPC_TAG_SYNC_EXTENDED 1
|
||||
#define L4_IPC_TAG_SYNC_FULL 2
|
||||
#define L4_IPC_TAG_SYNC 3
|
||||
|
||||
/* To obtain default shared page address */
|
||||
#define L4_IPC_TAG_SHPAGE 4
|
||||
|
||||
/* XXX: unused */
|
||||
#define L4_IPC_TAG_GRANT 5
|
||||
|
||||
/* Posix system call tags */
|
||||
#define L4_IPC_TAG_SHMGET 6
|
||||
#define L4_IPC_TAG_SHMAT 7
|
||||
#define L4_IPC_TAG_SHMDT 8
|
||||
#define L4_IPC_TAG_MMAP 9
|
||||
#define L4_IPC_TAG_MUNMAP 10
|
||||
#define L4_IPC_TAG_MSYNC 11
|
||||
#define L4_IPC_TAG_OPEN 12
|
||||
#define L4_IPC_TAG_READ 13
|
||||
#define L4_IPC_TAG_WRITE 14
|
||||
#define L4_IPC_TAG_LSEEK 15
|
||||
#define L4_IPC_TAG_CLOSE 16
|
||||
#define L4_IPC_TAG_BRK 17
|
||||
#define L4_IPC_TAG_READDIR 18
|
||||
#define L4_IPC_TAG_MKDIR 19
|
||||
#define L4_IPC_TAG_EXECVE 20
|
||||
#define L4_IPC_TAG_CHDIR 21
|
||||
#define L4_IPC_TAG_FORK 22
|
||||
#define L4_IPC_TAG_STAT 23
|
||||
#define L4_IPC_TAG_FSTAT 24
|
||||
#define L4_IPC_TAG_FSYNC 25
|
||||
#define L4_IPC_TAG_CLONE 26
|
||||
#define L4_IPC_TAG_EXIT 27
|
||||
#define L4_IPC_TAG_WAIT 28
|
||||
|
||||
/* Tags for ipc between fs0 and mm0 */
|
||||
#define L4_IPC_TAG_TASKDATA 40
|
||||
#define L4_IPC_TAG_PAGER_OPEN 41 /* vfs sends the pager open file data. */
|
||||
#define L4_IPC_TAG_PAGER_READ 42 /* Pager reads file contents from vfs */
|
||||
#define L4_IPC_TAG_PAGER_WRITE 43 /* Pager writes file contents to vfs */
|
||||
#define L4_IPC_TAG_PAGER_CLOSE 44 /* Pager notifies vfs of file close */
|
||||
#define L4_IPC_TAG_PAGER_UPDATE_STATS 45 /* Pager updates file stats in vfs */
|
||||
#define L4_IPC_TAG_NOTIFY_FORK 46 /* Pager notifies vfs of process fork */
|
||||
#define L4_IPC_TAG_NOTIFY_EXIT 47 /* Pager notifies vfs of process exit */
|
||||
#define L4_IPC_TAG_PAGER_OPEN_BYPATH 48 /* Pager opens a vfs file by pathname */
|
||||
#endif /* __IPCDEFS_H__ */
|
||||
15
conts/libl4/include/l4lib/kip.h
Normal file
15
conts/libl4/include/l4lib/kip.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Kernel Interface Page
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
#ifndef __L4LIB_KIP_H__
|
||||
#define __L4LIB_KIP_H__
|
||||
|
||||
/* Use the kernel header */
|
||||
#include <l4lib/types.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4/api/kip.h>
|
||||
|
||||
#endif /* __KIP_H__ */
|
||||
38
conts/libl4/include/l4lib/mutex.h
Normal file
38
conts/libl4/include/l4lib/mutex.h
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
/*
|
||||
* User space locking
|
||||
*
|
||||
* Copyright (C) 2009 Bahadir Bilgehan Balban
|
||||
*/
|
||||
|
||||
#ifndef __L4_MUTEX_H__
|
||||
#define __L4_MUTEX_H__
|
||||
|
||||
|
||||
#if !defined(__ASSEMBLY__)
|
||||
|
||||
#include <l4/api/mutex.h>
|
||||
|
||||
struct l4_mutex {
|
||||
unsigned int lock;
|
||||
} __attribute__((aligned(sizeof(int))));
|
||||
|
||||
|
||||
void l4_mutex_init(struct l4_mutex *m);
|
||||
int l4_mutex_lock(struct l4_mutex *m);
|
||||
int l4_mutex_unlock(struct l4_mutex *m);
|
||||
|
||||
#endif
|
||||
|
||||
/* Mutex return value - don't mix up with mutes state */
|
||||
#define L4_MUTEX_CONTENDED -1
|
||||
#define L4_MUTEX_SUCCESS 0
|
||||
|
||||
/* Mutex states - Any valid tid value is a locked state */
|
||||
#define L4_MUTEX_UNLOCKED -1
|
||||
#define L4_MUTEX(m) \
|
||||
struct l4_mutex m = { L4_MUTEX_UNLOCKED }
|
||||
|
||||
|
||||
|
||||
#endif /* __L4_MUTEX_H__ */
|
||||
23
conts/libl4/include/l4lib/os/posix/kstat.h
Normal file
23
conts/libl4/include/l4lib/os/posix/kstat.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef __OS_KSTAT_H__
|
||||
#define __OS_KSTAT_H__
|
||||
|
||||
#include <l4lib/types.h>
|
||||
|
||||
/*
|
||||
* Internal codezero-specific stat structure.
|
||||
* This is converted to posix stat in userspace
|
||||
*/
|
||||
struct kstat {
|
||||
u64 vnum;
|
||||
u32 mode;
|
||||
int links;
|
||||
u16 uid;
|
||||
u16 gid;
|
||||
u64 size;
|
||||
int blksize;
|
||||
u64 atime;
|
||||
u64 mtime;
|
||||
u64 ctime;
|
||||
};
|
||||
|
||||
#endif
|
||||
7
conts/libl4/include/l4lib/os/posix/readdir.h
Normal file
7
conts/libl4/include/l4lib/os/posix/readdir.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __OS_READDIR_H__
|
||||
#define __OS_READDIR_H__
|
||||
|
||||
/* Any os syscall related data that is not in posix */
|
||||
ssize_t os_readdir(int fd, void *buf, size_t count);
|
||||
|
||||
#endif
|
||||
14
conts/libl4/include/l4lib/thread.h
Normal file
14
conts/libl4/include/l4lib/thread.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __L4_THREAD_H__
|
||||
#define __L4_THREAD_H__
|
||||
|
||||
#include <libl4/arch/utcb.h>
|
||||
#include <libl4/arch/types.h>
|
||||
|
||||
struct l4_thread_struct {
|
||||
l4id_t tlid; /* Thread local id */
|
||||
struct task_ids ids; /* Thread L4-defined ids */
|
||||
struct utcb *utcb; /* Thread utcb */
|
||||
unsigned long stack_start; /* Thread start of stack */
|
||||
};
|
||||
|
||||
#endif /* __L4_THREAD_H__ */
|
||||
6
conts/libl4/include/l4lib/types.h
Normal file
6
conts/libl4/include/l4lib/types.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __TYPES_H__
|
||||
#define __TYPES_H__
|
||||
|
||||
#include <l4lib/arch/types.h>
|
||||
|
||||
#endif /* __TYPES_H__ */
|
||||
12
conts/libl4/include/l4lib/utcb.h
Normal file
12
conts/libl4/include/l4lib/utcb.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#ifndef __UTCB_H__
|
||||
#define __UTCB_H__
|
||||
|
||||
#include <l4lib/types.h>
|
||||
#include <l4lib/arch/utcb.h>
|
||||
|
||||
int utcb_init(void);
|
||||
|
||||
#endif /* __UTCB_H__ */
|
||||
Reference in New Issue
Block a user