Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (4 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_get_config.c

    r438 r440  
    22 * sys_get_config.c - get hardware platform parameters.
    33 *
    4  * Author    Alain Greiner (2016,2017)
     4 * Author    Alain Greiner (2016,2017,2018)
    55 * 
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3737                    uint32_t * ncores )
    3838{
    39     paddr_t   paddr;
    40     uint32_t  k_x_size;
    41     uint32_t  k_y_size;
    42     uint32_t  k_ncores;
    43 
    44         error_t   error = 0;
     39        error_t    error;
     40    vseg_t   * vseg;
     41    uint32_t   k_x_size;
     42    uint32_t   k_y_size;
     43    uint32_t   k_ncores;
    4544
    4645    thread_t  * this    = CURRENT_THREAD;
     
    5655#endif
    5756
    58     // check buffer in user space
    59     error |= vmm_v2p_translate( false , x_size  , &paddr );
    60     error |= vmm_v2p_translate( false , y_size  , &paddr );
    61     error |= vmm_v2p_translate( false , ncores  , &paddr );
     57    // check x_size buffer in user space
     58    error = vmm_get_vseg( process , (intptr_t)x_size  , &vseg );
    6259
    6360        if( error )
     
    6562
    6663#if DEBUG_SYSCALLS_ERROR
    67 printk("\n[ERROR] in %s : user buffer unmapped for thread %x in process %x\n",
    68 __FUNCTION__ , this->trdid , process->pid );
     64printk("\n[ERROR] in %s : x_size buffer unmapped / thread %x / process %x\n",
     65__FUNCTION__ , (intptr_t)x_size , this->trdid , process->pid );
     66vmm_display( process , false );
    6967#endif
    70         this->errno = EFAULT;
     68        this->errno = EINVAL;
     69                return -1;
     70        }
     71
     72    // check y_size buffer in user space
     73    error = vmm_get_vseg( process , (intptr_t)y_size  , &vseg );
     74
     75        if( error )
     76        {
     77
     78#if DEBUG_SYSCALLS_ERROR
     79printk("\n[ERROR] in %s : y_size buffer unmapped / thread %x / process %x\n",
     80__FUNCTION__ , (intptr_t)y_size , this->trdid , process->pid );
     81vmm_display( process , false );
     82#endif
     83        this->errno = EINVAL;
     84                return -1;
     85        }
     86
     87    // check ncores buffer in user space
     88    error = vmm_get_vseg( process , (intptr_t)ncores  , &vseg );
     89
     90        if( error )
     91        {
     92
     93#if DEBUG_SYSCALLS_ERROR
     94printk("\n[ERROR] in %s : ncores buffer unmapped / thread %x / process %x\n",
     95__FUNCTION__ , (intptr_t)ncores , this->trdid , process->pid );
     96vmm_display( process , false );
     97#endif
     98        this->errno = EINVAL;
    7199                return -1;
    72100        }
Note: See TracChangeset for help on using the changeset viewer.