mirror of
https://github.com/drasko/codezero.git
synced 2026-02-18 04:43:18 +01:00
Changes since April
Clean up of build directories. Simplifications to capability model.
This commit is contained in:
17
conts/userlibs/libl4/include/l4lib/linux/api/cache.h
Normal file
17
conts/userlibs/libl4/include/l4lib/linux/api/cache.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Generic macros for cache operations
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __CACHE_CONTROL_H__
|
||||
#define __CACHE_CONTROL_H__
|
||||
|
||||
#include L4LIB_INC_GLUE(cache.h)
|
||||
|
||||
#define L4_INVALIDATE_ICACHE ARCH_INVALIDATE_ICACHE
|
||||
#define L4_INVALIDATE_DCACHE ARCH_INVALIDATE_DCACHE
|
||||
#define L4_CLEAN_DCACHE ARCH_CLEAN_DCACHE
|
||||
#define L4_CLEAN_INVALIDATE_DCACHE ARCH_CLEAN_INVALIDATE_DCACHE
|
||||
#define L4_INVALIDATE_TLB ARCH_INVALIDATE_TLB
|
||||
|
||||
#endif /* __CACHE_CONTROL_H__ */
|
||||
96
conts/userlibs/libl4/include/l4lib/linux/api/capability.h
Normal file
96
conts/userlibs/libl4/include/l4lib/linux/api/capability.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Syscall API for capability manipulation
|
||||
*
|
||||
* Copyright (C) 2009 Bahadir Balban
|
||||
*/
|
||||
#ifndef __API_CAPABILITY_H__
|
||||
#define __API_CAPABILITY_H__
|
||||
|
||||
#include <l4lib/lib/list.h>
|
||||
#include L4LIB_INC_ARCH(types.h)
|
||||
|
||||
/* Capability syscall request types */
|
||||
#define CAP_CONTROL_NCAPS 0x00000000
|
||||
#define CAP_CONTROL_READ 0x00000001
|
||||
#define CAP_CONTROL_SHARE 0x00000002
|
||||
#define CAP_CONTROL_GRANT 0x00000003
|
||||
#define CAP_CONTROL_REPLICATE 0x00000004
|
||||
#define CAP_CONTROL_SPLIT 0x00000005
|
||||
#define CAP_CONTROL_DEDUCE 0x00000006
|
||||
#define CAP_CONTROL_DESTROY 0x00000007
|
||||
|
||||
#define CAP_SHARE_MASK 0x0000000F
|
||||
#define CAP_SHARE_SINGLE 0x00000001
|
||||
#define CAP_SHARE_ALL_CONTAINER 0x00000002
|
||||
#define CAP_SHARE_ALL_SPACE 0x00000003
|
||||
|
||||
#define CAP_GRANT_MASK 0x0000000F
|
||||
#define CAP_GRANT_SINGLE 0x00000001
|
||||
#define CAP_GRANT_IMMUTABLE 0x00000004
|
||||
|
||||
#define CAP_SPLIT_MASK 0x0000000F
|
||||
#define CAP_SPLIT_SIZE 0x00000001
|
||||
#define CAP_SPLIT_ACCESS 0x00000002
|
||||
#define CAP_SPLIT_RANGE 0x00000003 /* Returns -EPERM */
|
||||
|
||||
/*
|
||||
* A capability is a unique representation of security
|
||||
* qualifiers on a particular resource.
|
||||
*
|
||||
* In this structure:
|
||||
*
|
||||
* The capid denotes the unique capability ID.
|
||||
* The resid denotes the unique ID of targeted resource.
|
||||
* The owner denotes the unique ID of the one and only capability owner. This is
|
||||
* almost always a thread ID.
|
||||
*
|
||||
* The type field contains two types:
|
||||
* - The capability type,
|
||||
* - The targeted resource type.
|
||||
*
|
||||
* The targeted resouce type denotes what type of resource the capability is
|
||||
* allowed to operate on. For example a thread, a thread group, an address space
|
||||
* or a memory can be of this type.
|
||||
*
|
||||
* The capability type defines the general set of operations allowed on a
|
||||
* particular resource. For example a capability type may be thread_control,
|
||||
* exchange_registers, ipc, or map operations. A resource type may be such as a
|
||||
* thread, a thread group, a virtual or physical memory region.
|
||||
*
|
||||
* There are also quantitative capability types. While their names denote
|
||||
* quantitative objects such as memory, threads, and address spaces, these
|
||||
* types actually define the quantitative operations available on those
|
||||
* resources such as creation and deletion of a thread, allocation and
|
||||
* deallocation of a memory region etc.
|
||||
*
|
||||
* The access field denotes the fine-grain operations available on a particular
|
||||
* resource. The meaning of each bitfield differs according to the type of the
|
||||
* capability. For example, for a capability type thread_control, the bitfields
|
||||
* may mean suspend, resume, create, delete etc.
|
||||
*/
|
||||
struct capability {
|
||||
struct link list;
|
||||
|
||||
/* Capability identifiers */
|
||||
l4id_t capid; /* Unique capability ID */
|
||||
l4id_t owner; /* Capability owner ID */
|
||||
l4id_t resid; /* Targeted resource ID */
|
||||
unsigned int type; /* Capability and target resource type */
|
||||
|
||||
/* Capability limits/permissions */
|
||||
u32 access; /* Permitted operations */
|
||||
|
||||
/* Limits on the resource (NOTE: must never have signed type) */
|
||||
unsigned long start; /* Resource start value */
|
||||
unsigned long end; /* Resource end value */
|
||||
unsigned long size; /* Resource size */
|
||||
|
||||
/* Use count of resource */
|
||||
unsigned long used;
|
||||
|
||||
/* Device attributes, if this is a device. */
|
||||
unsigned int attr;
|
||||
l4id_t irq;
|
||||
};
|
||||
|
||||
#endif /* __API_CAPABILITY_H__ */
|
||||
148
conts/userlibs/libl4/include/l4lib/linux/api/errno.h
Normal file
148
conts/userlibs/libl4/include/l4lib/linux/api/errno.h
Normal file
@@ -0,0 +1,148 @@
|
||||
#ifndef __ERRNO_H__
|
||||
#define __ERRNO_H__
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
||||
#define ECANCELED 125 /* Operation Canceled */
|
||||
#define ENOKEY 126 /* Required key not available */
|
||||
#define EKEYEXPIRED 127 /* Key has expired */
|
||||
#define EKEYREVOKED 128 /* Key has been revoked */
|
||||
#define EKEYREJECTED 129 /* Key was rejected by service */
|
||||
|
||||
/* Codezero specific error codes */
|
||||
#define EACTIVE 132 /* Task active */
|
||||
#define ENOIPC 133 /* General IPC error */
|
||||
#define ENOCAP 134 /* None or insufficient capability */
|
||||
#define ENOUTCB 135 /* Task has no utcb set up */
|
||||
#define ENOMAP 136 /* The memory area has unmapped regions */
|
||||
#define ENOIRQ 137 /* Irq cannot be registered */
|
||||
#define EABORT 138 /* Abort cannot be handled */
|
||||
#define ENOCHILD 139 /* Task is not paged by caller */
|
||||
|
||||
#endif /* __ERRNO_H__ */
|
||||
50
conts/userlibs/libl4/include/l4lib/linux/api/exregs.h
Normal file
50
conts/userlibs/libl4/include/l4lib/linux/api/exregs.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Exchange registers system call data.
|
||||
*
|
||||
* Copyright (C) 2008 Bahadir Balban
|
||||
*/
|
||||
#ifndef __EXREGS_H__
|
||||
#define __EXREGS_H__
|
||||
|
||||
#include L4LIB_INC_GLUE(syscall.h)
|
||||
#include L4LIB_INC_GLUE(context.h)
|
||||
#include <l4lib/types.h>
|
||||
|
||||
#define EXREGS_SET_PAGER 1
|
||||
#define EXREGS_SET_UTCB 2
|
||||
#define EXREGS_READ 4
|
||||
|
||||
#define EXREGS_VALID_REGULAR_REGS \
|
||||
(FIELD_TO_BIT(exregs_context_t, r0) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r1) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r2) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r3) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r4) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r5) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r6) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r7) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r8) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r9) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r10) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r11) | \
|
||||
FIELD_TO_BIT(exregs_context_t, r12) | \
|
||||
FIELD_TO_BIT(exregs_context_t, lr)) \
|
||||
|
||||
#define EXREGS_VALID_SP \
|
||||
FIELD_TO_BIT(exregs_context_t, sp) \
|
||||
|
||||
#define EXREGS_VALID_PC \
|
||||
FIELD_TO_BIT(exregs_context_t, pc) \
|
||||
|
||||
/* Structure passed by userspace pagers for exchanging registers */
|
||||
struct exregs_data {
|
||||
exregs_context_t context;
|
||||
u32 valid_vect;
|
||||
u32 flags;
|
||||
l4id_t pagerid;
|
||||
unsigned long utcb_address;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* __EXREGS_H__ */
|
||||
27
conts/userlibs/libl4/include/l4lib/linux/api/ipc.h
Normal file
27
conts/userlibs/libl4/include/l4lib/linux/api/ipc.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __IPC_H__
|
||||
#define __IPC_H__
|
||||
|
||||
#define L4_NILTHREAD 0xFFFFFFFF
|
||||
#define L4_ANYTHREAD 0xFFFFFFFE
|
||||
|
||||
#define L4_IPC_TAG_MR_OFFSET 0
|
||||
|
||||
/* Pagefault */
|
||||
#define L4_IPC_TAG_PFAULT 0
|
||||
#define L4_IPC_TAG_UNDEF_FAULT 1
|
||||
|
||||
#define L4_IPC_FLAGS_TYPE_MASK 0x0000000F
|
||||
#define L4_IPC_FLAGS_SHORT 0x00000000 /* Short IPC involves just primary message registers */
|
||||
#define L4_IPC_FLAGS_FULL 0x00000001 /* Full IPC involves full UTCB copy */
|
||||
#define L4_IPC_FLAGS_EXTENDED 0x00000002 /* Extended IPC can page-fault and copy up to 2KB */
|
||||
|
||||
/* Extended IPC extra fields */
|
||||
#define L4_IPC_FLAGS_MSG_INDEX_MASK 0x00000FF0 /* Index of message register with buffer pointer */
|
||||
#define L4_IPC_FLAGS_SIZE_MASK 0x0FFF0000
|
||||
#define L4_IPC_FLAGS_SIZE_SHIFT 16
|
||||
#define L4_IPC_FLAGS_MSG_INDEX_SHIFT 4
|
||||
|
||||
|
||||
#define L4_IPC_EXTENDED_MAX_SIZE (SZ_1K*2)
|
||||
|
||||
#endif /* __IPC_H__ */
|
||||
10
conts/userlibs/libl4/include/l4lib/linux/api/irq.h
Normal file
10
conts/userlibs/libl4/include/l4lib/linux/api/irq.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __API_IRQ_H__
|
||||
#define __API_IRQ_H__
|
||||
|
||||
|
||||
#define IRQ_CONTROL_REGISTER 0
|
||||
#define IRQ_CONTROL_RELEASE 1
|
||||
#define IRQ_CONTROL_WAIT 2
|
||||
|
||||
|
||||
#endif /* __API_IRQ_H__ */
|
||||
82
conts/userlibs/libl4/include/l4lib/linux/api/kip.h
Normal file
82
conts/userlibs/libl4/include/l4lib/linux/api/kip.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Kernel Interface Page
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
|
||||
#ifndef __KIP_H__
|
||||
#define __KIP_H__
|
||||
#include <l4lib/types.h>
|
||||
|
||||
#define __YEAR__ ((((__DATE__ [7] - '0') * 10 + (__DATE__ [8] - '0')) * 10 \
|
||||
+ (__DATE__ [9] - '0')) * 10 + (__DATE__ [10] - '0'))
|
||||
|
||||
#define __MONTH__ (__DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 0 : 5) \
|
||||
: __DATE__ [2] == 'b' ? 1 \
|
||||
: __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 2 : 3) \
|
||||
: __DATE__ [2] == 'y' ? 4 \
|
||||
: __DATE__ [2] == 'l' ? 6 \
|
||||
: __DATE__ [2] == 'g' ? 7 \
|
||||
: __DATE__ [2] == 'p' ? 8 \
|
||||
: __DATE__ [2] == 't' ? 9 \
|
||||
: __DATE__ [2] == 'v' ? 10 : 11)
|
||||
|
||||
#define __DAY__ ((__DATE__ [4] == ' ' ? 0 : __DATE__ [4] - '0') * 10 \
|
||||
+ (__DATE__ [5] - '0'))
|
||||
|
||||
|
||||
#define CODEZERO_VERSION 0
|
||||
#define CODEZERO_SUBVERSION 2
|
||||
#define KDESC_DATE_SIZE 12
|
||||
#define KDESC_TIME_SIZE 9
|
||||
|
||||
struct kernel_descriptor {
|
||||
u32 version;
|
||||
u32 subversion;
|
||||
u32 magic;
|
||||
char date[KDESC_DATE_SIZE];
|
||||
char time[KDESC_TIME_SIZE];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
/* Experimental KIP with non-standard offsets */
|
||||
struct kip {
|
||||
/* System descriptions */
|
||||
u32 magic;
|
||||
u16 version_rsrv;
|
||||
u8 api_subversion;
|
||||
u8 api_version;
|
||||
u32 api_flags;
|
||||
|
||||
u32 container_control;
|
||||
u32 time;
|
||||
|
||||
u32 irq_control;
|
||||
u32 thread_control;
|
||||
u32 ipc_control;
|
||||
u32 map;
|
||||
u32 ipc;
|
||||
u32 capability_control;
|
||||
u32 unmap;
|
||||
u32 exchange_registers;
|
||||
u32 thread_switch;
|
||||
u32 schedule;
|
||||
u32 getid;
|
||||
u32 mutex_control;
|
||||
u32 cache_control;
|
||||
|
||||
u32 arch_syscall0;
|
||||
u32 arch_syscall1;
|
||||
u32 arch_syscall2;
|
||||
|
||||
u32 utcb;
|
||||
|
||||
struct kernel_descriptor kdesc;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
|
||||
#if defined (__KERNEL__)
|
||||
extern struct kip kip;
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
||||
#endif /* __KIP_H__ */
|
||||
60
conts/userlibs/libl4/include/l4lib/linux/api/mutex.h
Normal file
60
conts/userlibs/libl4/include/l4lib/linux/api/mutex.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef __MUTEX_CONTROL_H__
|
||||
#define __MUTEX_CONTROL_H__
|
||||
|
||||
#if !defined(__LINUX_CONTAINER__)
|
||||
|
||||
/* Request ids for mutex_control syscall */
|
||||
|
||||
#if defined (__KERNEL__)
|
||||
#define MUTEX_CONTROL_LOCK L4_MUTEX_LOCK
|
||||
#define MUTEX_CONTROL_UNLOCK L4_MUTEX_UNLOCK
|
||||
|
||||
#define MUTEX_CONTROL_OPMASK L4_MUTEX_OPMASK
|
||||
|
||||
#define mutex_operation(x) ((x) & MUTEX_CONTROL_OPMASK)
|
||||
#define mutex_contenders(x) ((x) & ~MUTEX_CONTROL_OPMASK)
|
||||
|
||||
#include <l4lib/lib/wait.h>
|
||||
#include <l4lib/lib/list.h>
|
||||
#include <l4lib/lib/mutex.h>
|
||||
|
||||
/*
|
||||
* Contender threashold is the total number of contenders
|
||||
* who are expected to sleep on the mutex, and will be waited
|
||||
* for a wakeup.
|
||||
*/
|
||||
struct mutex_queue {
|
||||
int contenders;
|
||||
unsigned long physical;
|
||||
struct link list;
|
||||
struct waitqueue_head wqh_contenders;
|
||||
struct waitqueue_head wqh_holders;
|
||||
};
|
||||
|
||||
/*
|
||||
* Mutex queue head keeps the list of all userspace mutexes.
|
||||
*
|
||||
* Here, mutex_control_mutex is a single lock for:
|
||||
* (1) Mutex_queue create/deletion
|
||||
* (2) List add/removal.
|
||||
* (3) Wait synchronization:
|
||||
* - Both waitqueue spinlocks need to be acquired for
|
||||
* rendezvous inspection to occur atomically. Currently
|
||||
* it's not done since we rely on this mutex for that.
|
||||
*/
|
||||
struct mutex_queue_head {
|
||||
struct link list;
|
||||
struct mutex mutex_control_mutex;
|
||||
int count;
|
||||
};
|
||||
|
||||
void init_mutex_queue_head(struct mutex_queue_head *mqhead);
|
||||
|
||||
#endif
|
||||
|
||||
#define L4_MUTEX_OPMASK 0xF0000000
|
||||
#define L4_MUTEX_LOCK 0x10000000
|
||||
#define L4_MUTEX_UNLOCK 0x20000000
|
||||
|
||||
#endif /* __LINUX_CONTAINER__ */
|
||||
#endif /* __MUTEX_CONTROL_H__*/
|
||||
5
conts/userlibs/libl4/include/l4lib/linux/api/space.h
Normal file
5
conts/userlibs/libl4/include/l4lib/linux/api/space.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef __API_SPACE_H__
|
||||
#define __API_SPACE_H__
|
||||
|
||||
|
||||
#endif /* __API_SPACE_H__ */
|
||||
25
conts/userlibs/libl4/include/l4lib/linux/api/thread.h
Normal file
25
conts/userlibs/libl4/include/l4lib/linux/api/thread.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __API_THREAD_H__
|
||||
#define __API_THREAD_H__
|
||||
|
||||
#define THREAD_ACTION_MASK 0xF0000000
|
||||
#define THREAD_CREATE 0x00000000
|
||||
#define THREAD_RUN 0x10000000
|
||||
#define THREAD_SUSPEND 0x20000000
|
||||
#define THREAD_DESTROY 0x30000000
|
||||
#define THREAD_RECYCLE 0x40000000
|
||||
#define THREAD_WAIT 0x50000000
|
||||
|
||||
#define THREAD_SHARE_MASK 0x00F00000
|
||||
#define THREAD_SPACE_MASK 0x0F000000
|
||||
#define THREAD_CREATE_MASK (THREAD_SHARE_MASK | THREAD_SPACE_MASK)
|
||||
#define TC_SHARE_CAPS 0x00100000 /* Share all thread capabilities */
|
||||
#define TC_SHARE_UTCB 0x00200000 /* Share utcb location (same space */
|
||||
#define TC_SHARE_GROUP 0x00400000 /* Share thread group id */
|
||||
|
||||
#define TC_SHARE_SPACE 0x01000000 /* New thread, use given space */
|
||||
#define TC_COPY_SPACE 0x02000000 /* New thread, copy given space */
|
||||
#define TC_NEW_SPACE 0x04000000 /* New thread, new space */
|
||||
|
||||
/* #define THREAD_USER_MASK 0x000F0000 Reserved for userspace */
|
||||
#define THREAD_EXIT_MASK 0x0000FFFF /* Thread exit code */
|
||||
#endif /* __API_THREAD_H__ */
|
||||
Reference in New Issue
Block a user