Changeset 624 for trunk/kernel/syscalls


Ignore:
Timestamp:
Mar 12, 2019, 1:37:38 PM (5 years ago)
Author:
alain
Message:

Fix several bugs to use the instruction MMU in kernel mode
in replacement of the instruction address extension register,
and remove the "kentry" segment.

This version is running on the tsar_generic_iob" platform.

One interesting bug: the cp0_ebase defining the kernel entry point
(for interrupts, exceptions and syscalls) must be initialized
early in kernel_init(), because the VFS initialisation done by
kernel_ini() uses RPCs, and RPCs uses Inter-Processor-Interrup.

Location:
trunk/kernel/syscalls
Files:
20 edited

Legend:

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

    r619 r624  
    7474printk("\n[ERROR] in %s : unmapped barrier %x / thread %x / process %x\n",
    7575__FUNCTION__ , vaddr , this->trdid , process->pid );
    76 vmm_display( process , false );
     76hal_vmm_display( process , false );
    7777#endif
    7878        this->errno = error;
     
    9595printk("\n[ERROR] in %s : unmapped barrier attributes %x / thread %x / process %x\n",
    9696__FUNCTION__ , attr , this->trdid , process->pid );
    97 vmm_display( process , false );
     97hal_vmm_display( process , false );
    9898#endif
    9999                    this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_condvar.c

    r566 r624  
    22 * sys_condvar.c - Access a POSIX condvar.
    33 *
    4  * Author    Alain Greiner  (2016,2017,2018)
     4 * Author    Alain Greiner  (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_special.h>
     26#include <hal_vmm.h>
    2627#include <errno.h>
    2728#include <thread.h>
     
    7576printk("\n[ERROR] in %s : unmapped condvar %x / thread %x / process %x\n",
    7677__FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid );
    77 vmm_display( process , false );
     78hal_vmm_display( process , false );
    7879#endif
    7980        this->errno = error;
  • trunk/kernel/syscalls/sys_display.c

    r623 r624  
    22 * sys_display.c - display the current state of a kernel structure on TXT0
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018, 2019)
    55 * 
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <errno.h>
    2728#include <vmm.h>
     
    167168            if( cxy == local_cxy )
    168169            {
    169                     vmm_display( process , true );
     170                    hal_vmm_display( process , true );
    170171            }
    171172            else
    172173            {
    173                 rpc_vmm_display_client( cxy , process , true );
     174                rpc_hal_vmm_display_client( cxy , process , true );
    174175            }
    175176
  • trunk/kernel/syscalls/sys_get_config.c

    r566 r624  
    6666printk("\n[ERROR] in %s : x_size buffer unmapped / thread %x / process %x\n",
    6767__FUNCTION__ , (intptr_t)x_size , this->trdid , process->pid );
    68 vmm_display( process , false );
     68hal_vmm_display( process , false );
    6969#endif
    7070        this->errno = EINVAL;
     
    8181printk("\n[ERROR] in %s : y_size buffer unmapped / thread %x / process %x\n",
    8282__FUNCTION__ , (intptr_t)y_size , this->trdid , process->pid );
    83 vmm_display( process , false );
     83hal_vmm_display( process , false );
    8484#endif
    8585        this->errno = EINVAL;
     
    9696printk("\n[ERROR] in %s : ncores buffer unmapped / thread %x / process %x\n",
    9797__FUNCTION__ , (intptr_t)ncores , this->trdid , process->pid );
    98 vmm_display( process , false );
     98hal_vmm_display( process , false );
    9999#endif
    100100        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_get_core.c

    r506 r624  
    5555printk("\n[ERROR] in %s : cxy buffer unmapped %x / thread %x / process %x\n",
    5656__FUNCTION__ , (intptr_t)cxy , this->trdid , process->pid );
    57 vmm_display( process , false );
     57hal_vmm_display( process , false );
    5858#endif
    5959        this->errno = EFAULT;
     
    7070printk("\n[ERROR] in %s : lid buffer unmapped %x / thread %x / process %x\n",
    7171__FUNCTION__ , (intptr_t)lid , this->trdid , process->pid );
    72 vmm_display( process , false );
     72hal_vmm_display( process , false );
    7373#endif
    7474        this->errno = EFAULT;
  • trunk/kernel/syscalls/sys_get_cycle.c

    r506 r624  
    5353printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n",
    5454__FUNCTION__ , (intptr_t)cycle , this->trdid , process->pid );
    55 vmm_display( process , false );
     55hal_vmm_display( process , false );
    5656#endif
    5757        this->errno = EFAULT;
  • trunk/kernel/syscalls/sys_is_fg.c

    r566 r624  
    6767printk("\n[ERROR] in %s : unmapped owner buffer %x / thread %x in process %x\n",
    6868__FUNCTION__ , (intptr_t)is_fg, this->trdid, process->pid );
    69 vmm_display( process , false );
     69hal_vmm_display( process , false );
    7070#endif
    7171         this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_kill.c

    r594 r624  
    7474tm_start = hal_get_cycles();
    7575if( DEBUG_SYS_KILL < tm_start )
    76 printk("\n[%s] thread[%x,%x] enter / process %x / %s / cycle %d\n",
    77 __FUNCTION__, this->process->pid, this->trdid, pid,
    78 sig_type_str(sig_id), (uint32_t)tm_start );
     76printk("\n[%s] thread[%x,%x] enter : %s to process %x / cycle %d\n",
     77__FUNCTION__, this->process->pid, this->trdid,
     78sig_type_str(sig_id), pid, (uint32_t)tm_start );
    7979#endif
    8080
     
    8686#if (DEBUG_SYS_KILL & 1)
    8787if( DEBUG_SYS_KILL < tm_start )
    88 printk("\n[%s] thread[%x,%x] get owner process %x in cluster %x\n",
     88printk("\n[%s] thread[%x,%x] get target process descriptor %x in owner cluster %x\n",
    8989__FUNCTION__ , this->process->pid, this->trdid, owner_ptr, owner_cxy );
    9090#endif
     
    108108#if (DEBUG_SYS_KILL & 1)
    109109if( DEBUG_SYS_KILL < tm_start )
    110 printk("\n[%x] thread[%x,%x] get parent process %x in cluster %x\n",
     110printk("\n[%s] thread[%x,%x] get parent process descriptor %x in cluster %x\n",
    111111__FUNCTION__ , this->process->pid, this->trdid, parent_ptr, parent_cxy );
    112112#endif
     
    128128            process_sigaction( pid , BLOCK_ALL_THREADS );
    129129
     130#if (DEBUG_SYS_KILL & 1)
     131if( DEBUG_SYS_KILL < tm_start )
     132printk("\n[%s] thread[%x,%x] blocked all threads of process %x\n",
     133__FUNCTION__ , this->process->pid, this->trdid, pid );
     134#endif
    130135            // atomically update owner process termination state
    131136            hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) ,
     
    136141
    137142            // calling thread deschedules when it is itself a target thread
    138             if( this->process->pid == pid ) sched_yield("block itself");
     143            if( this->process->pid == pid )
     144            {
     145
     146#if (DEBUG_SYS_KILL & 1)
     147if( DEBUG_SYS_KILL < tm_start )
     148printk("\n[%s] thread[%x,%x] is a target thread => deschedule\n",
     149__FUNCTION__ , this->process->pid, this->trdid );
     150#endif
     151                sched_yield("block itself");
     152            }
    139153
    140154            break;
  • trunk/kernel/syscalls/sys_mmap.c

    r623 r624  
    7070printk("\n[ERROR] in %s : thread[%x,%x] / mmap attributes unmapped %x\n",
    7171__FUNCTION__ , process->pid, this->trdid, (intptr_t)attr );
    72 vmm_display( process , false );
     72hal_vmm_display( process , false );
    7373#endif
    7474                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_munmap.c

    r623 r624  
    6767printk("\n[ERROR] in %s : thread[%x,%x] / user buffer unmapped %x\n",
    6868__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    69 vmm_display( process , false );
     69hal_vmm_display( process , false );
    7070#endif
    7171                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_mutex.c

    r566 r624  
    7474printk("\n[ERROR] in %s : mutex unmapped %x / thread %x / process %x\n",
    7575__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
    76 vmm_display( process , false );
     76hal_vmm_display( process , false );
    7777#endif
    7878        this->errno = error;
  • trunk/kernel/syscalls/sys_opendir.c

    r614 r624  
    6666printk("\n[ERROR] in %s / thread[%x,%x] : DIR buffer %x unmapped\n",
    6767__FUNCTION__ , process->pid , this->trdid, dirp );
    68 vmm_display( process , false );
     68hal_vmm_display( process , false );
    6969#endif
    7070                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_read.c

    r610 r624  
    107107printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n",
    108108__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    109 vmm_display( process , false );
     109hal_vmm_display( process , false );
    110110#endif
    111111                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_readdir.c

    r612 r624  
    6969printk("\n[ERROR] in %s / thread[%x,%x] : user buffer %x unmapped\n",
    7070__FUNCTION__ , process->pid , this->trdid, buffer );
    71 vmm_display( process , false );
     71hal_vmm_display( process , false );
    7272#endif
    7373                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_sem.c

    r566 r624  
    22 * sys_sem.c - Acces a POSIX unamed semaphore.
    33 *
    4  * Authors     Alain Greiner (2016,2017,2018)
     4 * Authors     Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <shared_semaphore.h>
    2728#include <errno.h>
     
    7475printk("\n[ERROR] in %s : unmapped semaphore pointer %x / thread %x in process %x / cycle %d\n",
    7576__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    76 vmm_display( process , false );
     77hal_vmm_display( process , false );
    7778#endif
    7879        this->errno = EINVAL;
     
    112113printk("\n[ERROR] in %s GETVALUE: unmapped buffer %x / thread %x in process %x / cycle %d\n",
    113114__FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    114 vmm_display( process , false );
     115hal_vmm_display( process , false );
    115116#endif
    116117                this->errno = EINVAL;
     
    154155printk("\n[ERROR] in %s WAIT: semaphore %x not found / thread %x in process %x / cycle %d\n",
    155156__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid, (uint32_t)hal_get_cycles() );
    156 vmm_display( process , true );
     157hal_vmm_display( process , true );
    157158#endif
    158159                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_stat.c

    r610 r624  
    22 * sys_stat.c - kernel function implementing the "stat" syscall.
    33 *
    4  * Author    Alain Greiner  (2016,2017,2018)
     4 * Author    Alain Greiner  (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <hal_special.h>
    2728#include <errno.h>
     
    6162printk("\n[ERROR] in %s / thread[%x,%x] : stat structure %x unmapped\n",
    6263__FUNCTION__ , process->pid , this->trdid, u_stat );
    63 vmm_display( process , false );
     64hal_vmm_display( process , false );
    6465#endif
    6566                this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_thread_create.c

    r619 r624  
    22 * sys_thread_create.c - creates a new user thread
    33 *
    4  * Author     Alain Greiner (2016,2017,2018)
     4 * Author     Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2525#include <hal_kernel_types.h>
    2626#include <hal_uspace.h>
     27#include <hal_vmm.h>
    2728#include <printk.h>
    2829#include <errno.h>
     
    8283printk("\n[ERROR] in %s : thread[%x,%x] / trdid buffer %x unmapped %x\n",
    8384__FUNCTION__, process->pid, parent->trdid, (intptr_t)trdid_ptr );
    84 vmm_display( process , false );
     85hal_vmm_display( process , false );
    8586#endif
    8687                parent->errno = EINVAL;
     
    99100printk("\n[ERROR] in %s : thread[%x,%x] / user_attr buffer unmapped %x\n",
    100101__FUNCTION__, process->pid, parent->trdid, (intptr_t)user_attr );
    101 vmm_display( process , false );
     102hal_vmm_display( process , false );
    102103#endif
    103104                    parent->errno = EINVAL;
     
    117118printk("\n[ERROR] in %s : thread[%x,%x] / start_func unmapped %x\n",
    118119__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_func );
    119 vmm_display( process , false );
     120hal_vmm_display( process , false );
    120121#endif
    121122        parent->errno = EINVAL;
     
    134135printk("\n[ERROR] in %s : thread[%x,%x] / start_args buffer unmapped %x\n",
    135136__FUNCTION__, process->pid, parent->trdid, (intptr_t)start_args );
    136 vmm_display( process , false );
     137hal_vmm_display( process , false );
    137138#endif
    138139                    parent->errno = EINVAL;
  • trunk/kernel/syscalls/sys_timeofday.c

    r506 r624  
    22 * sys_timeofday.c - Get current time
    33 *
    4  * Author    Alain Greiner (2016,2017,2018)
     4 * Author    Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2424#include <hal_kernel_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_vmm.h>
    2627#include <thread.h>
    2728#include <printk.h>
     
    7071printk("\n[ERROR] in %s : user buffer tz unmapped / thread %x / process %x\n",
    7172__FUNCTION__ , (intptr_t)tz , this->trdid , process->pid );
    72 vmm_display( process , false );
     73hal_vmm_display( process , false );
    7374#endif
    7475        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_wait.c

    r566 r624  
    2525#include <hal_uspace.h>
    2626#include <hal_irqmask.h>
     27#include <hal_vmm.h>
    2728#include <remote_queuelock.h>
    2829#include <core.h>
     
    6869printk("\n[ERROR] in %s : status buffer %x unmapped for thread %x in process %x\n",
    6970__FUNCTION__ , (intptr_t)status, this->trdid , process->pid );
    70 vmm_display( process , false );
     71hal_vmm_display( process , false );
    7172#endif
    7273        this->errno = EINVAL;
  • trunk/kernel/syscalls/sys_write.c

    r623 r624  
    2424#include <kernel_config.h>
    2525#include <hal_kernel_types.h>
     26#include <hal_vmm.h>
    2627#include <hal_uspace.h>
    2728#include <hal_irqmask.h>
     
    106107printk("\n[ERROR] in %s : thread[%x,%x] user buffer unmapped %x\n",
    107108__FUNCTION__ , process->pid, this->trdid, (intptr_t)vaddr );
    108 vmm_display( process , false );
     109hal_vmm_display( process , false );
    109110#endif
    110111                this->errno = EINVAL;
Note: See TracChangeset for help on using the changeset viewer.