Changeset bb68433 in mainline for generic/src/proc/thread.c
- Timestamp:
- 2006-02-08T22:58:06Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7e4e532
- Parents:
- 85dc2e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/proc/thread.c
r85dc2e7 rbb68433 227 227 { 228 228 thread_t *t; 229 229 ipl_t ipl; 230 230 231 t = (thread_t *) slab_alloc(thread_slab, 0); 231 if (t) { 232 ipl_t ipl; 233 234 /* Not needed, but good for debugging */ 235 memsetb((__address)t->kstack, THREAD_STACK_SIZE, 0); 236 237 ipl = interrupts_disable(); 238 spinlock_lock(&tidlock); 239 t->tid = ++last_tid; 240 spinlock_unlock(&tidlock); 241 interrupts_restore(ipl); 232 233 /* Not needed, but good for debugging */ 234 memsetb((__address)t->kstack, THREAD_STACK_SIZE, 0); 235 236 ipl = interrupts_disable(); 237 spinlock_lock(&tidlock); 238 t->tid = ++last_tid; 239 spinlock_unlock(&tidlock); 240 interrupts_restore(ipl); 241 242 context_save(&t->saved_context); 243 context_set(&t->saved_context, FADDR(cushion), (__address) t->kstack, THREAD_STACK_SIZE); 244 245 the_initialize((the_t *) t->kstack); 246 247 ipl = interrupts_disable(); 248 t->saved_context.ipl = interrupts_read(); 249 interrupts_restore(ipl); 250 251 t->thread_code = func; 252 t->thread_arg = arg; 253 t->ticks = -1; 254 t->priority = -1; /* start in rq[0] */ 255 t->cpu = NULL; 256 t->flags = 0; 257 t->state = Entering; 258 t->call_me = NULL; 259 t->call_me_with = NULL; 260 261 timeout_initialize(&t->sleep_timeout); 262 t->sleep_queue = NULL; 263 t->timeout_pending = 0; 264 265 t->rwlock_holder_type = RWLOCK_NONE; 242 266 243 context_save(&t->saved_context); 244 context_set(&t->saved_context, FADDR(cushion), (__address) t->kstack, THREAD_STACK_SIZE); 245 246 the_initialize((the_t *) t->kstack); 247 248 ipl = interrupts_disable(); 249 t->saved_context.ipl = interrupts_read(); 250 interrupts_restore(ipl); 251 252 t->thread_code = func; 253 t->thread_arg = arg; 254 t->ticks = -1; 255 t->priority = -1; /* start in rq[0] */ 256 t->cpu = NULL; 257 t->flags = 0; 258 t->state = Entering; 259 t->call_me = NULL; 260 t->call_me_with = NULL; 261 262 timeout_initialize(&t->sleep_timeout); 263 t->sleep_queue = NULL; 264 t->timeout_pending = 0; 265 266 t->rwlock_holder_type = RWLOCK_NONE; 267 268 t->task = task; 269 270 t->fpu_context_exists=0; 271 t->fpu_context_engaged=0; 272 273 /* 274 * Register this thread in the system-wide list. 275 */ 276 ipl = interrupts_disable(); 277 spinlock_lock(&threads_lock); 278 list_append(&t->threads_link, &threads_head); 279 spinlock_unlock(&threads_lock); 280 281 /* 282 * Attach to the containing task. 283 */ 284 spinlock_lock(&task->lock); 285 list_append(&t->th_link, &task->th_head); 286 spinlock_unlock(&task->lock); 287 288 interrupts_restore(ipl); 289 } 267 t->task = task; 268 269 t->fpu_context_exists=0; 270 t->fpu_context_engaged=0; 271 272 /* 273 * Register this thread in the system-wide list. 274 */ 275 ipl = interrupts_disable(); 276 spinlock_lock(&threads_lock); 277 list_append(&t->threads_link, &threads_head); 278 spinlock_unlock(&threads_lock); 279 280 /* 281 * Attach to the containing task. 282 */ 283 spinlock_lock(&task->lock); 284 list_append(&t->th_link, &task->th_head); 285 spinlock_unlock(&task->lock); 286 287 interrupts_restore(ipl); 290 288 291 289 return t;
Note:
See TracChangeset
for help on using the changeset viewer.