mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Changed l4id_t type to unsigned integer. Expanded task_ids to have cid
Task ids are now unsigned as the container ids will need to be encoded in the id fields as well. For requests who require even more comprehensive id input, (such as thread creation) also added is the container id so that threads _could_ potentially be created in other containers as well.
This commit is contained in:
@@ -16,9 +16,10 @@
|
||||
#include <l4/api/thread.h>
|
||||
|
||||
struct task_ids {
|
||||
int tid;
|
||||
int spid;
|
||||
int tgid;
|
||||
l4id_t tid;
|
||||
l4id_t spid;
|
||||
l4id_t tgid;
|
||||
l4id_t cid;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __L4LIB_ARM_TYPES_H___
|
||||
#define __L4LIB_ARM_TYPES_H__
|
||||
|
||||
#define TASK_ID_INVALID -1
|
||||
#define TASK_ID_INVALID 0xFFFFFFFF
|
||||
|
||||
#include <l4/arch/arm/types.h>
|
||||
|
||||
|
||||
@@ -226,13 +226,11 @@ int read_pager_capabilities()
|
||||
/* Set up pointers to important capabilities */
|
||||
list_foreach_struct(cap, &capability_list.caps, list) {
|
||||
/* Physical memory bank */
|
||||
if ((cap->type & CAP_RTYPE_MASK)
|
||||
== CAP_RTYPE_PHYSMEM)
|
||||
if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM)
|
||||
cont_mem_regions.physmem = cap;
|
||||
|
||||
/* Virtual regions */
|
||||
if ((cap->type & CAP_RTYPE_MASK)
|
||||
== CAP_RTYPE_VIRTMEM) {
|
||||
if (cap_type(cap) == CAP_TYPE_MAP_VIRTMEM) {
|
||||
|
||||
/* Pager address region (get from linker-defined) */
|
||||
if (__pfn_to_addr(cap->start)
|
||||
|
||||
@@ -26,7 +26,7 @@ void wait_pager(l4id_t partner)
|
||||
}
|
||||
|
||||
pid_t parent_of_all;
|
||||
pid_t pagerid;
|
||||
l4id_t pagerid;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ void wait_pager(l4id_t partner)
|
||||
// printf("Pager synced with us.\n");
|
||||
}
|
||||
|
||||
pid_t pagerid;
|
||||
l4id_t pagerid;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -66,12 +66,12 @@ int main(void)
|
||||
printf("%s: Container %s started\n",
|
||||
__CONTAINER__, __CONTAINER_NAME__);
|
||||
|
||||
//capability_test();
|
||||
capability_test();
|
||||
|
||||
exit_test();
|
||||
//exit_test();
|
||||
|
||||
/* Now quit to demo self-paging quit */
|
||||
l4_exit(0);
|
||||
//l4_exit(0);
|
||||
|
||||
/* Now quit by null pointer */
|
||||
// *((int *)0) = 5;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#define __IPC_H__
|
||||
|
||||
|
||||
#define L4_NILTHREAD -1
|
||||
#define L4_ANYTHREAD -2
|
||||
#define L4_NILTHREAD 0xFFFFFFFF
|
||||
#define L4_ANYTHREAD 0xFFFFFFFE
|
||||
|
||||
#define L4_IPC_TAG_MR_OFFSET 0
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef signed short s16;
|
||||
typedef signed char s8;
|
||||
|
||||
/* Thread/Space id type */
|
||||
typedef int l4id_t;
|
||||
typedef unsigned int l4id_t;
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* !__ARCH_TYPES_H__ */
|
||||
|
||||
@@ -39,11 +39,21 @@ enum task_state {
|
||||
TASK_DEAD = 3,
|
||||
};
|
||||
|
||||
#define TASK_ID_INVALID -1
|
||||
#define TASK_CID_MASK 0xFF000000
|
||||
#define TASK_ID_MASK 0x00FFFFFF
|
||||
|
||||
static inline int task_id_special(l4id_t id)
|
||||
{
|
||||
/* Special ids have top 2 nibbles all set */
|
||||
return (id & TASK_CID_MASK) == TASK_CID_MASK;
|
||||
}
|
||||
|
||||
#define TASK_ID_INVALID 0xFFFFFFFF
|
||||
struct task_ids {
|
||||
l4id_t tid;
|
||||
l4id_t spid;
|
||||
l4id_t tgid;
|
||||
l4id_t cid;
|
||||
};
|
||||
|
||||
struct container;
|
||||
|
||||
@@ -539,11 +539,14 @@ int sys_ipc(l4id_t to, l4id_t from, unsigned int flags)
|
||||
int ret = 0;
|
||||
|
||||
/* Check arguments */
|
||||
if (from < L4_ANYTHREAD) {
|
||||
if (task_id_special(from) &&
|
||||
from != L4_ANYTHREAD && from != L4_NILTHREAD) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
if (to < L4_ANYTHREAD) {
|
||||
|
||||
if (task_id_special(to) &&
|
||||
to != L4_ANYTHREAD && to != L4_NILTHREAD) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ int sys_getid(struct task_ids *ids)
|
||||
ids->tid = this->tid;
|
||||
ids->spid = this->space->spid;
|
||||
ids->tgid = this->tgid;
|
||||
ids->cid = this->container->cid;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user