Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (6 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_mmap.c

    r438 r440  
    33 *
    44 * Authors       Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *               Alain Greiner (2016,2017)
     5 *               Alain Greiner (2016,2017,2018)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    4444    xptr_t        mapper_xp;
    4545    error_t       error;
    46     paddr_t       paddr;        // unused, but required for user space checking
    4746    reg_t         save_sr;      // required to enable IRQs
    4847
     
    6059
    6160    // check arguments in user space
    62     error = vmm_v2p_translate( false , attr , &paddr );
     61    error = vmm_get_vseg( process , (intptr_t)attr , &vseg );
    6362
    6463    if ( error )
     
    6665
    6766#if DEBUG_SYSCALLS_ERROR
    68 printk("\n[ERROR] in %s : arguments not in used space = %x\n", __FUNCTION__ , (intptr_t)attr );
     67printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n",
     68__FUNCTION__ , (intptr_t)attr , this->trdid , process->pid );
     69vmm_display( process , false );
    6970#endif
    7071                this->errno = EINVAL;
     
    9293
    9394#if DEBUG_SYSCALLS_ERROR
    94 printk("\n[ERROR] in %s : MAP_FIXED not supported\n", __FUNCTION__ );
     95printk("\n[ERROR] in %s : MAP_FIXED not supported / thread %x / process %x\n",
     96__FUNCTION__ , this->trdid , process->pid );
    9597#endif
    9698        this->errno = EINVAL;
     
    102104
    103105#if DEBUG_SYSCALLS_ERROR
    104 printk("\n[ERROR] in %s : MAP_SHARED xor MAP_PRIVATE\n", __FUNCTION__ );
     106printk("\n[ERROR] in %s : MAP_SHARED == MAP_PRIVATE / thread %x / process %x\n",
     107__FUNCTION__ , this->trdid , process->pid );
    105108#endif
    106109        this->errno = EINVAL;
     
    124127
    125128#if DEBUG_SYSCALLS_ERROR
    126 printk("\n[ERROR] in %s: bad file descriptor = %d\n", __FUNCTION__ , fdid );
     129printk("\n[ERROR] in %s: bad file descriptor %d / thread %x / process %x\n",
     130__FUNCTION__ , fdid , this->trdid , process->pid );
    127131#endif
    128132            this->errno = EBADFD;
     
    137141
    138142#if DEBUG_SYSCALLS_ERROR
    139 printk("\n[ERROR] in %s: file %d not found\n", __FUNCTION__ , fdid );
     143printk("\n[ERROR] in %s: file %d not found / thread %x / process %x\n",
     144__FUNCTION__ , fdid , this->trdid , process->pid );
    140145#endif
    141146            this->errno = EBADFD;
     
    160165
    161166#if DEBUG_SYSCALLS_ERROR
    162 printk("\n[ERROR] in %s: offset (%d) + len (%d) >= file's size (%d)\n",
    163 __FUNCTION__, k_attr.offset, k_attr.length, size );
     167printk("\n[ERROR] in %s: offset(%d) + len(%d) >= file's size(%d) / thread %x / process %x\n",
     168__FUNCTION__, k_attr.offset, k_attr.length, size, this->trdid, process->pid );
    164169#endif
    165170            this->errno = ERANGE;
     
    173178
    174179#if DEBUG_SYSCALLS_ERROR
    175 printk("\n[ERROR] in %s: prot = %x / file_attr = %x)\n",
    176 __FUNCTION__ , k_attr.prot , file_attr );
     180printk("\n[ERROR] in %s: prot = %x / file_attr = %x / thread %x , process %x\n",
     181__FUNCTION__ , k_attr.prot , file_attr , this->trdid , process->pid );
    177182#endif
    178183                        this->errno = EACCES;
     
    206211
    207212#if DEBUG_SYSCALLS_ERROR
    208 printk("\n[ERROR] in %s : illegal cxy for MAP_REMOTE\n", __FUNCTION__ );
     213printk("\n[ERROR] in %s : illegal cxy for MAP_REMOTE / thread %x / process %x\n",
     214__FUNCTION__, this->trdid , process->pid );
    209215#endif
    210216                this->errno = EINVAL;
     
    255261
    256262#if DEBUG_SYSCALLS_ERROR
    257 printk("\n[ERROR] in %s : cannot create vseg\n", __FUNCTION__ );
     263printk("\n[ERROR] in %s : cannot create vseg / thread %x / process %x\n",
     264__FUNCTION__, this->trdid , process->pid );
    258265#endif
    259266        this->errno = ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.