From 19b4c6c4c1979f7d2dadfa95f8fd0b162012df18 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sun, 22 Nov 2009 15:08:29 +0200 Subject: [PATCH] Moved capability struct to api/capability.h for userspace coherence Userspace often breaks as we change the capability structure. Now structure is under api/ so userspace can also update with changes. --- config/cml/examples/helloworld/config.cml | 709 ++++++++++++++++++++++ conts/libl4/include/l4lib/capability.h | 22 +- conts/posix/mm0/mm/capability.c | 5 +- include/l4/api/capability.h | 63 ++ include/l4/generic/capability.h | 60 +- 5 files changed, 778 insertions(+), 81 deletions(-) create mode 100644 config/cml/examples/helloworld/config.cml diff --git a/config/cml/examples/helloworld/config.cml b/config/cml/examples/helloworld/config.cml new file mode 100644 index 0000000..9538f24 --- /dev/null +++ b/config/cml/examples/helloworld/config.cml @@ -0,0 +1,709 @@ +# +# Automatically generated, don't edit +# +# Generated on: bahadir-laptop +# At: Sun, 22 Nov 2009 12:50:07 +0000 +# Linux version 2.6.24-22-generic (buildd@vernadsky) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Mon Nov 24 18:32:42 UTC 2008 + +# +# Codezero Microkernel Configurator +# + +# +# Main architecture +# +CONFIG_ARCH_ARM=y + + +# +# ARM Architecture Configuration +# + +# +# ARM Architecture Family +# +CONFIG_SUBARCH_V5=y +CONFIG_SUBARCH_V6=n +CONFIG_SUBARCH_V7=n + + +# +# ARM CPU type +# + +# +# ARM Processor Type +# +CONFIG_CPU_ARM926=y + + + +# +# ARM Platform Type +# + +# +# ARM Platform Type +# +CONFIG_PLATFORM_EB=n +CONFIG_PLATFORM_AB926=n +CONFIG_PLATFORM_PB926=y + + + + +# +# Toolchain Prefix +# +CONFIG_TOOLCHAIN_KERNEL="arm-none-eabi-" +CONFIG_TOOLCHAIN_USER="arm-none-linux-gnueabi-" + +CONFIG_CONTAINERS=4 + +# +# Container Setup +# +CONFIG_CAPABILITIES=y + +# +# Container 0 Parameters +# + +# +# Container 0 Type +# +CONFIG_CONT0_TYPE_BAREMETAL=y +CONFIG_CONT0_TYPE_POSIX=n +CONFIG_CONT0_TYPE_CUSTOM=n +CONFIG_CONT0_TYPE_LINUX=n + + +# +# Container 0 Options +# +CONFIG_CONT0_OPT_NAME="hello0" + +# +# Baremetal Project +# +CONFIG_CONT0_BAREMETAL_PROJ0=n +CONFIG_CONT0_BAREMETAL_PROJ1=y +CONFIG_CONT0_BAREMETAL_PROJ2=n +CONFIG_CONT0_BAREMETAL_PROJ3=n + + +# +# Container 0 Default Pager Parameters +# +CONFIG_CONT0_PAGER_LMA=0x40000 +CONFIG_CONT0_PAGER_VMA=0x10000000 + + +# +# Container 0 Physical Memory Regions (Capabilities) +# +CONFIG_CONT0_PHYSMEM_REGIONS=1 +CONFIG_CONT0_PHYS0_START=0x40000 +CONFIG_CONT0_PHYS0_END=0x100000 + + +# +# Container 0 Virtual Memory Regions (Capabilities) +# +CONFIG_CONT0_VIRTMEM_REGIONS=1 +CONFIG_CONT0_VIRT0_START=0x10000000 +CONFIG_CONT0_VIRT0_END=0x20000000 + + +# +# Container 0 Capability List +# + +# +# Container 0 Thread Pool Capability +# +CONFIG_CONT0_CAP_THREADPOOL_USE=y +CONFIG_CONT0_CAP_THREADPOOL_SIZE=64 + + +# +# Container 0 Space Pool Capability +# +CONFIG_CONT0_CAP_SPACEPOOL_USE=y +CONFIG_CONT0_CAP_SPACEPOOL_SIZE=64 + + +# +# Container 0 Mutex Pool Capability +# +CONFIG_CONT0_CAP_MUTEXPOOL_USE=y +CONFIG_CONT0_CAP_MUTEXPOOL_SIZE=100 + + +# +# Container 0 Map Pool Capability +# +CONFIG_CONT0_CAP_MAPPOOL_USE=y +CONFIG_CONT0_CAP_MAPPOOL_SIZE=800 + + +# +# Container 0 Capability Pool Capability +# +CONFIG_CONT0_CAP_CAPPOOL_USE=y +CONFIG_CONT0_CAP_CAPPOOL_SIZE=32 + + +# +# Container 0 Thread Control Capability +# +CONFIG_CONT0_CAP_TCTRL_USE=y +CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT0_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 0 Exchange Registers Capability +# +CONFIG_CONT0_CAP_EXREGS_USE=y +CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT0_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 0 IPC Capability +# +CONFIG_CONT0_CAP_IPC_USE=y +CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT0_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n +CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_CONTAINER=n +CONFIG_CONT0_CAP_IPC_TARGET_ANOTHER_PAGER=n + + +# +# Container 0 Capability Control Capability +# +CONFIG_CONT0_CAP_CAPCTRL_USE=y +CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT0_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 0 Userspace Mutex Control Capability +# +CONFIG_CONT0_CAP_UMUTEX_USE=y +CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT0_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 0 Custom Capability 0 Parameters +# +CONFIG_CONT0_CAP_CUSTOM0_USE=n + + +# +# Container 0 Custom Capability 1 Parameters +# +CONFIG_CONT0_CAP_CUSTOM1_USE=n + + +# +# Container 0 Custom Capability 2 Parameters +# +CONFIG_CONT0_CAP_CUSTOM2_USE=n + + +# +# Container 0 Custom Capability 3 Parameters +# +CONFIG_CONT0_CAP_CUSTOM3_USE=n + + + + + +# +# Container 1 Parameters +# + +# +# Container 1 Type +# +CONFIG_CONT1_TYPE_BAREMETAL=y +CONFIG_CONT1_TYPE_POSIX=n +CONFIG_CONT1_TYPE_CUSTOM=n +CONFIG_CONT1_TYPE_LINUX=n + + +# +# Container 1 Options +# +CONFIG_CONT1_OPT_NAME="hello1" + +# +# Baremetal Project +# +CONFIG_CONT1_BAREMETAL_PROJ0=n +CONFIG_CONT1_BAREMETAL_PROJ1=y +CONFIG_CONT1_BAREMETAL_PROJ2=n +CONFIG_CONT1_BAREMETAL_PROJ3=n + + +# +# Container 1 Default Pager Parameters +# +CONFIG_CONT1_PAGER_LMA=0x100000 +CONFIG_CONT1_PAGER_VMA=0x20000000 + + +# +# Container 1 Physical Memory Regions (Capabilities) +# +CONFIG_CONT1_PHYSMEM_REGIONS=1 +CONFIG_CONT1_PHYS0_START=0x100000 +CONFIG_CONT1_PHYS0_END=0x200000 + + +# +# Container 1 Virtual Memory Regions (Capabilities) +# +CONFIG_CONT1_VIRTMEM_REGIONS=1 +CONFIG_CONT1_VIRT0_START=0x20000000 +CONFIG_CONT1_VIRT0_END=0x30000000 + + +# +# Container 1 Capability List +# + +# +# Container 1 Thread Pool Capability +# +CONFIG_CONT1_CAP_THREADPOOL_USE=y +CONFIG_CONT1_CAP_THREADPOOL_SIZE=64 + + +# +# Container 1 Space Pool Capability +# +CONFIG_CONT1_CAP_SPACEPOOL_USE=y +CONFIG_CONT1_CAP_SPACEPOOL_SIZE=64 + + +# +# Container 1 Mutex Pool Capability +# +CONFIG_CONT1_CAP_MUTEXPOOL_USE=y +CONFIG_CONT1_CAP_MUTEXPOOL_SIZE=100 + + +# +# Container 1 Map Pool Capability +# +CONFIG_CONT1_CAP_MAPPOOL_USE=y +CONFIG_CONT1_CAP_MAPPOOL_SIZE=800 + + +# +# Container 1 Capability Pool Capability +# +CONFIG_CONT1_CAP_CAPPOOL_USE=y +CONFIG_CONT1_CAP_CAPPOOL_SIZE=32 + + +# +# Container 1 Thread Control Capability +# +CONFIG_CONT1_CAP_TCTRL_USE=y +CONFIG_CONT1_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT1_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 1 Exchange Registers Capability +# +CONFIG_CONT1_CAP_EXREGS_USE=y +CONFIG_CONT1_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT1_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 1 IPC Capability +# +CONFIG_CONT1_CAP_IPC_USE=y +CONFIG_CONT1_CAP_IPC_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT1_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n +CONFIG_CONT1_CAP_IPC_TARGET_ANOTHER_CONTAINER=n +CONFIG_CONT1_CAP_IPC_TARGET_ANOTHER_PAGER=n + + +# +# Container 1 Capability Control Capability +# +CONFIG_CONT1_CAP_CAPCTRL_USE=y +CONFIG_CONT1_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT1_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 1 Userspace Mutex Control Capability +# +CONFIG_CONT1_CAP_UMUTEX_USE=y +CONFIG_CONT1_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT1_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 1 Custom Capability 0 Parameters +# +CONFIG_CONT1_CAP_CUSTOM0_USE=n + + +# +# Container 1 Custom Capability 1 Parameters +# +CONFIG_CONT1_CAP_CUSTOM1_USE=n + + +# +# Container 1 Custom Capability 2 Parameters +# +CONFIG_CONT1_CAP_CUSTOM2_USE=n + + +# +# Container 1 Custom Capability 3 Parameters +# +CONFIG_CONT1_CAP_CUSTOM3_USE=n + + + + + +# +# Container 2 Parameters +# + +# +# Container 2 Type +# +CONFIG_CONT2_TYPE_BAREMETAL=y +CONFIG_CONT2_TYPE_POSIX=n +CONFIG_CONT2_TYPE_CUSTOM=n +CONFIG_CONT2_TYPE_LINUX=n + + +# +# Container 2 Options +# +CONFIG_CONT2_OPT_NAME="hello2" + +# +# Baremetal Project +# +CONFIG_CONT2_BAREMETAL_PROJ0=n +CONFIG_CONT2_BAREMETAL_PROJ1=y +CONFIG_CONT2_BAREMETAL_PROJ2=n +CONFIG_CONT2_BAREMETAL_PROJ3=n + + +# +# Container 2 Default Pager Parameters +# +CONFIG_CONT2_PAGER_LMA=0x200000 +CONFIG_CONT2_PAGER_VMA=0x30000000 + + +# +# Container 2 Physical Memory Regions (Capabilities) +# +CONFIG_CONT2_PHYSMEM_REGIONS=1 +CONFIG_CONT2_PHYS0_START=0x200000 +CONFIG_CONT2_PHYS0_END=0x300000 + + +# +# Container 2 Virtual Memory Regions (Capabilities) +# +CONFIG_CONT2_VIRTMEM_REGIONS=1 +CONFIG_CONT2_VIRT0_START=0x30000000 +CONFIG_CONT2_VIRT0_END=0x40000000 + + +# +# Container 2 Capability List +# + +# +# Container 2 Thread Pool Capability +# +CONFIG_CONT2_CAP_THREADPOOL_USE=y +CONFIG_CONT2_CAP_THREADPOOL_SIZE=64 + + +# +# Container 2 Space Pool Capability +# +CONFIG_CONT2_CAP_SPACEPOOL_USE=y +CONFIG_CONT2_CAP_SPACEPOOL_SIZE=64 + + +# +# Container 2 Mutex Pool Capability +# +CONFIG_CONT2_CAP_MUTEXPOOL_USE=y +CONFIG_CONT2_CAP_MUTEXPOOL_SIZE=100 + + +# +# Container 2 Map Pool Capability +# +CONFIG_CONT2_CAP_MAPPOOL_USE=y +CONFIG_CONT2_CAP_MAPPOOL_SIZE=800 + + +# +# Container 2 Capability Pool Capability +# +CONFIG_CONT2_CAP_CAPPOOL_USE=y +CONFIG_CONT2_CAP_CAPPOOL_SIZE=32 + + +# +# Container 2 Thread Control Capability +# +CONFIG_CONT2_CAP_TCTRL_USE=y +CONFIG_CONT2_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT2_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 2 Exchange Registers Capability +# +CONFIG_CONT2_CAP_EXREGS_USE=y +CONFIG_CONT2_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT2_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 2 IPC Capability +# +CONFIG_CONT2_CAP_IPC_USE=y +CONFIG_CONT2_CAP_IPC_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT2_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n +CONFIG_CONT2_CAP_IPC_TARGET_ANOTHER_CONTAINER=n +CONFIG_CONT2_CAP_IPC_TARGET_ANOTHER_PAGER=n + + +# +# Container 2 Capability Control Capability +# +CONFIG_CONT2_CAP_CAPCTRL_USE=y +CONFIG_CONT2_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT2_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 2 Userspace Mutex Control Capability +# +CONFIG_CONT2_CAP_UMUTEX_USE=y +CONFIG_CONT2_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT2_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 2 Custom Capability 0 Parameters +# +CONFIG_CONT2_CAP_CUSTOM0_USE=n + + +# +# Container 2 Custom Capability 1 Parameters +# +CONFIG_CONT2_CAP_CUSTOM1_USE=n + + +# +# Container 2 Custom Capability 2 Parameters +# +CONFIG_CONT2_CAP_CUSTOM2_USE=n + + +# +# Container 2 Custom Capability 3 Parameters +# +CONFIG_CONT2_CAP_CUSTOM3_USE=n + + + + + +# +# Container 3 Parameters +# + +# +# Container 3 Type +# +CONFIG_CONT3_TYPE_BAREMETAL=y +CONFIG_CONT3_TYPE_POSIX=n +CONFIG_CONT3_TYPE_CUSTOM=n +CONFIG_CONT3_TYPE_LINUX=n + + +# +# Container 3 Options +# +CONFIG_CONT3_OPT_NAME="hello3" + +# +# Baremetal Project +# +CONFIG_CONT3_BAREMETAL_PROJ0=n +CONFIG_CONT3_BAREMETAL_PROJ1=y +CONFIG_CONT3_BAREMETAL_PROJ2=n +CONFIG_CONT3_BAREMETAL_PROJ3=n + + +# +# Container 3 Default Pager Parameters +# +CONFIG_CONT3_PAGER_LMA=0x300000 +CONFIG_CONT3_PAGER_VMA=0x40000000 + + +# +# Container 3 Physical Memory Regions (Capabilities) +# +CONFIG_CONT3_PHYSMEM_REGIONS=1 +CONFIG_CONT3_PHYS0_START=0x300000 +CONFIG_CONT3_PHYS0_END=0x400000 + + +# +# Container 3 Virtual Memory Regions (Capabilities) +# +CONFIG_CONT3_VIRTMEM_REGIONS=1 +CONFIG_CONT3_VIRT0_START=0x40000000 +CONFIG_CONT3_VIRT0_END=0x50000000 + + +# +# Container 3 Capability List +# + +# +# Container 3 Thread Pool Capability +# +CONFIG_CONT3_CAP_THREADPOOL_USE=y +CONFIG_CONT3_CAP_THREADPOOL_SIZE=64 + + +# +# Container 3 Space Pool Capability +# +CONFIG_CONT3_CAP_SPACEPOOL_USE=y +CONFIG_CONT3_CAP_SPACEPOOL_SIZE=64 + + +# +# Container 3 Mutex Pool Capability +# +CONFIG_CONT3_CAP_MUTEXPOOL_USE=y +CONFIG_CONT3_CAP_MUTEXPOOL_SIZE=100 + + +# +# Container 3 Map Pool Capability +# +CONFIG_CONT3_CAP_MAPPOOL_USE=y +CONFIG_CONT3_CAP_MAPPOOL_SIZE=800 + + +# +# Container 3 Capability Pool Capability +# +CONFIG_CONT3_CAP_CAPPOOL_USE=y +CONFIG_CONT3_CAP_CAPPOOL_SIZE=32 + + +# +# Container 3 Thread Control Capability +# +CONFIG_CONT3_CAP_TCTRL_USE=y +CONFIG_CONT3_CAP_TCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT3_CAP_TCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 3 Exchange Registers Capability +# +CONFIG_CONT3_CAP_EXREGS_USE=y +CONFIG_CONT3_CAP_EXREGS_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT3_CAP_EXREGS_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 3 IPC Capability +# +CONFIG_CONT3_CAP_IPC_USE=y +CONFIG_CONT3_CAP_IPC_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT3_CAP_IPC_TARGET_CURRENT_PAGER_SPACE=n +CONFIG_CONT3_CAP_IPC_TARGET_ANOTHER_CONTAINER=n +CONFIG_CONT3_CAP_IPC_TARGET_ANOTHER_PAGER=n + + +# +# Container 3 Capability Control Capability +# +CONFIG_CONT3_CAP_CAPCTRL_USE=y +CONFIG_CONT3_CAP_CAPCTRL_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT3_CAP_CAPCTRL_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 3 Userspace Mutex Control Capability +# +CONFIG_CONT3_CAP_UMUTEX_USE=y +CONFIG_CONT3_CAP_UMUTEX_TARGET_CURRENT_CONTAINER=y +CONFIG_CONT3_CAP_UMUTEX_TARGET_CURRENT_PAGER_SPACE=n + + +# +# Container 3 Custom Capability 0 Parameters +# +CONFIG_CONT3_CAP_CUSTOM0_USE=n + + +# +# Container 3 Custom Capability 1 Parameters +# +CONFIG_CONT3_CAP_CUSTOM1_USE=n + + +# +# Container 3 Custom Capability 2 Parameters +# +CONFIG_CONT3_CAP_CUSTOM2_USE=n + + +# +# Container 3 Custom Capability 3 Parameters +# +CONFIG_CONT3_CAP_CUSTOM3_USE=n + + + + + + +# +# Derived symbols +# +CONFIG_DRIVER_IRQ_PL190=y +CONFIG_DRIVER_TIMER_SP804=y +CONFIG_DRIVER_IRQ_GIC=n +CONFIG_DRIVER_UART_PL011=y +# +# That's all, folks! diff --git a/conts/libl4/include/l4lib/capability.h b/conts/libl4/include/l4lib/capability.h index 13571e2..362efaa 100644 --- a/conts/libl4/include/l4lib/capability.h +++ b/conts/libl4/include/l4lib/capability.h @@ -8,33 +8,13 @@ #include #include +#include struct cap_list { int ncaps; struct link caps; }; -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 */ - unsigned long start; /* Resource start value */ - unsigned long end; /* Resource end value */ - unsigned long size; /* Resource size */ - - unsigned long used; /* Resource used size */ -}; - - static inline void cap_list_init(struct cap_list *clist) { clist->ncaps = 0; diff --git a/conts/posix/mm0/mm/capability.c b/conts/posix/mm0/mm/capability.c index a3010fb..64245e6 100644 --- a/conts/posix/mm0/mm/capability.c +++ b/conts/posix/mm0/mm/capability.c @@ -364,9 +364,12 @@ int cap_read_all() BUG(); } + /* Copy them to real allocated structures */ copy_boot_capabilities(ncaps); + cap_list_print(&capability_list); + memset(&cont_mem_regions, 0, sizeof(cont_mem_regions)); /* Set up pointers to important capabilities */ @@ -394,7 +397,7 @@ int cap_read_all() BUG(); } - if (!(cap->access & CAP_MAP_UTCB_BIT)) { + if (!(cap->access & CAP_MAP_UTCB)) { printf("FATAL: Region designated " "for UTCB allocation does not " "have UTCB map permissions"); diff --git a/include/l4/api/capability.h b/include/l4/api/capability.h index df177a4..72ecc80 100644 --- a/include/l4/api/capability.h +++ b/include/l4/api/capability.h @@ -6,6 +6,10 @@ #ifndef __API_CAPABILITY_H__ #define __API_CAPABILITY_H__ +#if defined(__KERNEL__) +#include +#endif + /* Capability syscall request types */ #define CAP_CONTROL_NCAPS 0x00000000 #define CAP_CONTROL_READ 0x00000001 @@ -30,4 +34,63 @@ #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; + + /* User-defined attributes on capability (like devtypes) */ + unsigned int uattr; +}; + #endif /* __API_CAPABILITY_H__ */ diff --git a/include/l4/generic/capability.h b/include/l4/generic/capability.h index 172f912..b16feea 100644 --- a/include/l4/generic/capability.h +++ b/include/l4/generic/capability.h @@ -6,8 +6,8 @@ #ifndef __GENERIC_CAPABILITY_H__ #define __GENERIC_CAPABILITY_H__ -#include #include +#include /* * Some resources that capabilities possess don't @@ -19,64 +19,6 @@ */ #define CAP_RESID_NONE -1 -/* - * 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; - - /* User-defined attributes on capability (like devtypes) */ - unsigned int uattr; -}; struct cap_list { int ktcb_refs;