Changeset e3c762cd in mainline for generic/src/proc/thread.c


Ignore:
Timestamp:
2006-05-05T11:59:19Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de07bcf
Parents:
22cf454d
Message:

Complete implementation of copy_from_uspace() and copy_to_uspace()
for amd64 and ia32. Other architectures still compile and run,
but need to implement their own assembly-only memcpy(), memcpy_from_uspace(),
memcpy_to_uspace() and their failover parts. For these architectures
only dummy implementations are provided.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/proc/thread.c

    r22cf454d re3c762cd  
    6161#include <debug.h>
    6262#include <main/uinit.h>
     63#include <syscall/copy.h>
     64#include <errno.h>
    6365
    6466char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
     
    304306        t->sleep_queue = NULL;
    305307        t->timeout_pending = 0;
     308
     309        t->in_copy_from_uspace = false;
     310        t->in_copy_to_uspace = false;
    306311       
    307312        t->rwlock_holder_type = RWLOCK_NONE;
     
    463468        uspace_arg_t *kernel_uarg;
    464469        __u32 tid;
    465 
    466         copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN);
     470        int rc;
     471
     472        rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN);
     473        if (rc != 0)
     474                return (__native) rc;
    467475
    468476        kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
    469         copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
     477        rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
     478        if (rc != 0) {
     479                free(kernel_uarg);
     480                return (__native) rc;
     481        }
    470482
    471483        if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) {
     
    477489        }
    478490
    479         return (__native) -1;
     491        return (__native) ENOMEM;
    480492}
    481493
Note: See TracChangeset for help on using the changeset viewer.