Changeset cfffb290 in mainline
- Timestamp:
- 2006-08-05T16:05:25Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2882a7
- Parents:
- b006a2c8
- Location:
- kernel/generic
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/arch.h
rb006a2c8 rcfffb290 44 44 #include <arch/asm.h> 45 45 46 #define DEFAULT_CONTEXT 0 47 46 48 #define CPU THE->cpu 47 49 #define THREAD THE->thread 48 50 #define TASK THE->task 49 51 #define AS THE->as 52 #define CONTEXT (THE->task ? THE->task->context : DEFAULT_CONTEXT) 50 53 #define PREEMPTION_DISABLED THE->preemption_disabled 54 55 #define context_check(ctx1, ctx2) ((ctx1) == (ctx2)) 51 56 52 57 /** … … 61 66 cpu_t *cpu; /**< Executing cpu. */ 62 67 as_t *as; /**< Current address space. */ 63 context_id_t context; /**< Current security context. */64 68 }; 65 69 66 #define THE ((the_t *)(get_stack_base())) 70 #define THE ((the_t *)(get_stack_base())) 67 71 68 72 extern void the_initialize(the_t *the); -
kernel/generic/include/proc/thread.h
rb006a2c8 rcfffb290 147 147 int priority; /**< Thread's priority. Implemented as index to CPU->rq */ 148 148 uint32_t tid; /**< Thread ID. */ 149 context_id_t context; /**< Thread security context */150 149 151 150 thread_arch_t arch; /**< Architecture-specific data. */ -
kernel/generic/src/ddi/ddi.c
rb006a2c8 rcfffb290 130 130 t = task_find_by_id(id); 131 131 132 if ( !t) {132 if ((!t) || (!context_check(CONTEXT, t->context))) { 133 133 /* 134 * There is no task with the specified ID. 134 * There is no task with the specified ID 135 * or the task belongs to a different security 136 * context. 135 137 */ 136 138 spinlock_unlock(&tasks_lock); -
kernel/generic/src/proc/task.c
rb006a2c8 rcfffb290 116 116 ta->main_thread = NULL; 117 117 ta->refcount = 0; 118 ta->context = THE->context;118 ta->context = CONTEXT; 119 119 120 120 ta->capabilities = 0; … … 122 122 123 123 ipc_answerbox_init(&ta->answerbox); 124 for (i =0; i < IPC_MAX_PHONES;i++)124 for (i = 0; i < IPC_MAX_PHONES; i++) 125 125 ipc_phone_init(&ta->phones[i]); 126 if ( ipc_phone_0)126 if ((ipc_phone_0) && (context_check(ipc_phone_0->task->context, ta->context))) 127 127 ipc_phone_connect(&ta->phones[0], ipc_phone_0); 128 128 atomic_set(&ta->active_calls, 0); -
kernel/generic/src/proc/the.c
rb006a2c8 rcfffb290 59 59 the->task = NULL; 60 60 the->as = NULL; 61 the->context = 0;62 61 } 63 62 -
kernel/generic/src/proc/thread.c
rb006a2c8 rcfffb290 319 319 memcpy(t->name, name, THREAD_NAME_BUFLEN); 320 320 321 t->context = THE->context;322 321 t->thread_code = func; 323 322 t->thread_arg = arg; … … 535 534 536 535 t = (thread_t *) node->value[i]; 537 printf("%s: address=%#zx, tid=%zd, context=%ld, state=%s, task=%#zx, code=%#zx, stack=%#zx, cpu=",538 t->name, t, t->tid, t ->context, thread_states[t->state], t->task, t->thread_code, t->kstack);536 printf("%s: address=%#zx, tid=%zd, state=%s, task=%#zx, context=%ld, code=%#zx, stack=%#zx, cpu=", 537 t->name, t, t->tid, thread_states[t->state], t->task, t->task->context, t->thread_code, t->kstack); 539 538 if (t->cpu) 540 539 printf("cpu%zd", t->cpu->id); -
kernel/generic/src/security/cap.c
rb006a2c8 rcfffb290 112 112 spinlock_lock(&tasks_lock); 113 113 t = task_find_by_id((task_id_t) taskid_arg.value); 114 if ( !t) {114 if ((!t) || (!context_check(CONTEXT, t->context))) { 115 115 spinlock_unlock(&tasks_lock); 116 116 interrupts_restore(ipl); … … 123 123 124 124 spinlock_unlock(&tasks_lock); 125 126 127 128 125 interrupts_restore(ipl); 129 126 return 0; … … 154 151 spinlock_lock(&tasks_lock); 155 152 t = task_find_by_id((task_id_t) taskid_arg.value); 156 if ( !t) {153 if ((!t) || (!context_check(CONTEXT, t->context))) { 157 154 spinlock_unlock(&tasks_lock); 158 155 interrupts_restore(ipl);
Note:
See TracChangeset
for help on using the changeset viewer.