Ignore:
Timestamp:
Nov 14, 2019, 11:50:09 AM (3 years ago)
Author:
alain
Message:

1) Improve the VMM MMAP allocator: implement the "buddy" algorithm
to allocate only aligned blocks.
2) fix a bug in the pthread_join() / pthread_exit() mmechanism.

File:
1 edited

Legend:

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

    r637 r651  
    112112    }
    113113
    114     // FIXME handle Copy_On_Write for MAP_PRIVATE...
     114// FIXME handle Copy_On_Write for MAP_PRIVATE...
    115115
    116116    // test mmap type : can be FILE / ANON / REMOTE
     
    127127#endif
    128128
    129             // FIXME: handle concurent delete of file by another thread
     129// FIXME: handle concurent delete of file by another thread
    130130
    131131                if( fdid >= CONFIG_PROCESS_FILE_MAX_NR )
     
    164164#endif
    165165
    166         // get inode pointer & mapper pointer
    167         vfs_inode_t * inode_ptr  = hal_remote_lpt(XPTR(file_cxy , &file_ptr->inode ));
     166        // get mapper pointer
    168167        mapper_t    * mapper_ptr = hal_remote_lpt(XPTR(file_cxy , &file_ptr->mapper));
    169168
    170         // get file size
    171                 uint32_t size = hal_remote_l32( XPTR( file_cxy , &inode_ptr->size ) );
    172 
    173 #if (DEBUG_SYS_MMAP & 1)
    174 if ( DEBUG_SYS_MMAP < tm_start )
    175 printk("\n[%s] thread[%x,%x] get file size : %d bytes\n",
    176 __FUNCTION__, process->pid, this->trdid, size );
    177 #endif
    178 
    179         // chek offset and length arguments
    180                 if( (offset + length) > size)
    181                 {
    182 
    183 #if DEBUG_SYSCALLS_ERROR
    184 printk("\n[ERROR] in %s: thread[%x,%x] / offset(%d) + len(%d) >= file's size(%d)\n",
    185 __FUNCTION__, process->pid, this->trdid, k_attr.offset, k_attr.length, size );
    186 #endif
    187             this->errno = ERANGE;
    188             return -1;
    189                 }
     169#if (DEBUG_SYS_MMAP & 1)
     170if ( DEBUG_SYS_MMAP < tm_start )
     171printk("\n[%s] thread[%x,%x] get file mapper %x\n",
     172__FUNCTION__, process->pid, this->trdid, mapper_ptr );
     173#endif
    190174
    191175/* TODO
Note: See TracChangeset for help on using the changeset viewer.