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_write.c

    r438 r440  
    22 * sys_write.c - write bytes to a file
    33 *
    4  * Author        Alain Greiner (2016,2017)
     4 * Author        Alain Greiner (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3535/* TODO: concurrent user page(s) unmap need to be handled [AG] */
    3636
     37extern uint32_t enter_sys_write;
     38extern uint32_t enter_devfs_write;
     39extern uint32_t enter_txt_write;
     40extern uint32_t enter_chdev_cmd_write;
     41extern uint32_t enter_chdev_server_write;
     42extern uint32_t enter_tty_cmd_write;
     43extern uint32_t enter_tty_isr_write;
     44extern uint32_t exit_tty_isr_write;
     45extern uint32_t exit_tty_cmd_write;
     46extern uint32_t exit_chdev_server_write;
     47extern uint32_t exit_chdev_cmd_write;
     48extern uint32_t exit_txt_write;
     49extern uint32_t exit_devfs_write;
     50extern uint32_t exit_sys_write;
     51
    3752//////////////////////////////////
    3853int sys_write( uint32_t   file_id,
     
    4156{
    4257    error_t      error;
    43     paddr_t      paddr;           // required for user space checking
     58    vseg_t     * vseg;            // required for user space checking
    4459        xptr_t       file_xp;         // remote file extended pointer
    4560    uint32_t     nbytes;          // number of bytes actually written
    4661    reg_t        save_sr;         // required to enable IRQs during syscall
    4762
    48 #if (DEBUG_SYS_WRITE_DEBUG & 1)
    49 enter_sys_read = (uint32_t)tm_start;
     63#if (DEBUG_SYS_WRITE & 1)
     64enter_sys_write = (uint32_t)tm_start;
    5065#endif
    5166
     
    7489
    7590    // check user buffer in user space
    76     error = vmm_v2p_translate( false , vaddr , &paddr );
     91    error = vmm_get_vseg( process , (intptr_t)vaddr , &vseg );
    7792
    7893    if ( error )
     
    8095
    8196#if DEBUG_SYSCALLS_ERROR
    82 printk("\n[ERROR] in %s : user buffer unmapped = %x\n", __FUNCTION__ , (intptr_t)vaddr );
     97printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n",
     98__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
     99vmm_display( process , false );
    83100#endif
    84101                this->errno = EINVAL;
Note: See TracChangeset for help on using the changeset viewer.