Changeset 9f52563 in mainline for generic/src/proc
- Timestamp:
- 2006-03-17T01:34:36Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8a0b0669
- Parents:
- 5fceec7
- Location:
- generic/src/proc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/proc/task.c
r5fceec7 r9f52563 116 116 thread_t *t; 117 117 task_t *task; 118 uspace_arg_t *uarg; 118 119 119 120 as = as_create(0); … … 125 126 } 126 127 128 uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); 129 uarg->uspace_entry = (__address) ((elf_header_t *) program_addr)->e_entry; 130 uarg->uspace_stack = USTACK_ADDRESS; 131 127 132 task = task_create(as, name); 128 t = thread_create(uinit, (void *)((elf_header_t *)program_addr)->e_entry, 129 task, 0, "uinit"); 133 t = thread_create(uinit, uarg, task, 0, "uinit"); 130 134 131 135 /* -
generic/src/proc/thread.c
r5fceec7 r9f52563 54 54 #include <mm/slab.h> 55 55 #include <debug.h> 56 #include <main/uinit.h> 56 57 57 58 char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ … … 281 282 interrupts_restore(ipl); 282 283 283 t->name = name; 284 memcpy(t->name, name, THREAD_NAME_BUFLEN); 285 284 286 t->thread_code = func; 285 287 t->thread_arg = arg; … … 424 426 interrupts_restore(ipl); 425 427 } 428 429 /** Process syscall to create new thread. 430 * 431 */ 432 __native sys_thread_create(__address function, void *arg, void *stack, char *name) 433 { 434 thread_t *t; 435 char namebuf[THREAD_NAME_BUFLEN]; 436 uspace_arg_t *uarg; 437 __u32 tid; 438 439 copy_from_uspace(namebuf, name, THREAD_NAME_BUFLEN); 440 uarg = (uspace_arg_t *) malloc(sizeof(uarg), 0); 441 442 uarg->uspace_entry = function; 443 uarg->uspace_stack = (__address) stack; 444 445 if ((t = thread_create(uinit, uarg, TASK, 0, namebuf))) { 446 tid = t->tid; 447 thread_ready(t); 448 return (__native) tid; 449 } else { 450 free(namebuf); 451 } 452 453 return (__native) -1; 454 } 455 456 /** Process syscall to terminate thread. 457 * 458 */ 459 __native sys_thread_exit(int status) 460 { 461 thread_exit(); 462 /* Unreachable */ 463 return 0; 464 }
Note:
See TracChangeset
for help on using the changeset viewer.
