Changeset 16 for trunk/kernel/syscalls


Ignore:
Timestamp:
May 10, 2017, 5:04:01 PM (7 years ago)
Author:
alain
Message:

mprove the HAL for interrupt, exception, syscall handling.

Location:
trunk/kernel/syscalls
Files:
1 deleted
2 edited

Legend:

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

    r1 r16  
    3232int sys_thread_exit ( void * exit_val )
    3333{
    34         thread_t * this = current_thread;
    35     cpu_t    * cpu  = current_cpu;
    36         uint32_t   state;
    37         bool_t     isEmpty;
    38         bool_t     isReleased;
     34        thread_t  * this = CURRENT_THREAD;
     35    core_t    * core = this->core;
     36        bool_t      isEmpty;
     37        bool_t      isReleased;
     38    uint32_t    irq_state;
    3939
    40         /* TODO: the cpu->lid must match the core index in the logical cluster */
    41         if(this->process->pid != 1)
    42                 dqdt_update_threads_number( local_cxy , cpu->lid , -1 );
     40        // update DQDT TODO must be done by thread destroy
     41        if(this->process->pid != 1) dqdt_local_update_threads( -1 );
    4342
    4443        spinlock_lock( &this->lock );
     
    4645        if(!(thread_isJoinable(this)))
    4746        {
    48                 spinlock_unlock_nosched(&this->lock);
    4947                goto exit_dead;
    5048        }
    5149
    52         // Check if there's a thread waiting the end of callee thread
     50        // Check if there's a thread waiting the end of calling thread
    5351        isEmpty = wait_queue_isEmpty(&this->info.wait_queue);
    5452
     
    7270
    7371        // Release FPU if required
    74         cpu_disable_all_irq(&state);
    75         if(current_cpu->fpu_owner == this)
     72        hal_disable_irq( &irq_state );
     73        if(core->fpu_owner == this)
    7674        {
    77                 current_cpu->fpu_owner = NULL;
     75                core->fpu_owner = NULL;
    7876                isReleased = true;
    7977        }
    80         cpu_restore_irq(state);
     78        hal_restore_irq( irq_state );
    8179
    8280        if(isReleased)
  • trunk/kernel/syscalls/syscalls.h

    r1 r16  
    11/*
    2  * syscall.h - kernel services definition
     2 * syscalls.h - kernel services definition
    33 *
    44 * Author  Ghassan Almaless (2007,2008,2009,2010,2011,2012)
     
    2323 */
    2424
    25 #ifndef _SYSCALL_H_
    26 #define _SYSCALL_H_
     25#ifndef _SYSCALLS_H_
     26#define _SYSCALLS_H_
    2727
    2828/******************************************************************************************
    29  * This enum defines the system calls index.
    30  * It must be kept consistant with the syscall vector defined in sys_vector.c file.
     29 * This enum defines the mnemonics for the syscall indexes.
     30 * It must be kept consistent with the array defined in do_syscalls.c
    3131 *****************************************************************************************/
    3232enum
     
    9090/********************************************************************************************/
    9191
    92 /*********************************************************************************************
    93  * This function TODO
     92
     93/*********************************************************************************************
     94 * [0] This function TODO
     95 ********************************************************************************************/
     96int sys_thread_exit( void * );
     97
     98/*********************************************************************************************
     99 * [1] This function TODO
     100 ********************************************************************************************/
     101int sys_mmap();
     102
     103/*********************************************************************************************
     104 * [2] This function TODO
     105 ********************************************************************************************/
     106int sys_thread_create();
     107
     108/*********************************************************************************************
     109 * [3] This function TODO
     110 ********************************************************************************************/
     111int sys_thread_join();
     112
     113/*********************************************************************************************
     114 * [4] This function TODO
     115 ********************************************************************************************/
     116int sys_thread_detach();
     117
     118/*********************************************************************************************
     119 * [5] This function TODO
     120 ********************************************************************************************/
     121int sys_thread_yield();
     122
     123/*********************************************************************************************
     124 * [6] This function TODO
     125 ********************************************************************************************/
     126int sys_sem();
     127
     128/*********************************************************************************************
     129 * [7] This function TODO
     130 ********************************************************************************************/
     131int sys_cond_var();
     132
     133/*********************************************************************************************
     134 * [8] This function TODO
     135 ********************************************************************************************/
     136int sys_barrier();
     137
     138/*********************************************************************************************
     139 * [9] This function TODO
     140 ********************************************************************************************/
     141int sys_rwlock();
     142
     143/*********************************************************************************************
     144 * [10] This function TODO
     145 ********************************************************************************************/
     146int sys_thread_sleep();
     147
     148/*********************************************************************************************
     149 * [11] This function TODO
     150 ********************************************************************************************/
     151int sys_thread_wakeup();
     152
     153/*********************************************************************************************
     154 * [12] This function TODO
     155 ********************************************************************************************/
     156int sys_open();
     157
     158/*********************************************************************************************
     159 * [13] This function TODO
     160 ********************************************************************************************/
     161int sys_creat();
     162
     163/*********************************************************************************************
     164 * [14] This function TODO
     165 ********************************************************************************************/
     166int sys_read();
     167
     168/*********************************************************************************************
     169 * [15] This function TODO
     170 ********************************************************************************************/
     171int sys_write();
     172
     173/*********************************************************************************************
     174 * [16] This function TODO
     175 ********************************************************************************************/
     176int sys_lseek();
     177
     178/*********************************************************************************************
     179 * [17] This function TODO
     180 ********************************************************************************************/
     181int sys_close();
     182
     183/*********************************************************************************************
     184 * [18] This function TODO
     185 ********************************************************************************************/
     186int sys_unlink();
     187
     188/*********************************************************************************************
     189 * [19] This function TODO
     190 ********************************************************************************************/
     191int sys_pipe();
     192
     193/*********************************************************************************************
     194 * [20] This function TODO
     195 ********************************************************************************************/
     196int sys_chdir();
     197
     198/*********************************************************************************************
     199 * [21] This function TODO
     200 ********************************************************************************************/
     201int sys_mkdir();
     202
     203/*********************************************************************************************
     204 * [22] This function TODO
     205 ********************************************************************************************/
     206int sys_mkfifo();
     207
     208/*********************************************************************************************
     209 * [23] This function TODO
     210 ********************************************************************************************/
     211int sys_opendir();
     212
     213/*********************************************************************************************
     214 * [24] This function TODO
     215 ********************************************************************************************/
     216int sys_readdir();
     217
     218/*********************************************************************************************
     219 * [25] This function TODO
     220 ********************************************************************************************/
     221int sys_closedir();
     222
     223/*********************************************************************************************
     224 * [26] This function TODO
     225 ********************************************************************************************/
     226int sys_getcwd();
     227
     228/*********************************************************************************************
     229 * [27] This function TODO
     230 ********************************************************************************************/
     231int sys_clock();
     232
     233/*********************************************************************************************
     234 * [28] This function TODO
     235 ********************************************************************************************/
     236int sys_alarm();
     237
     238/*********************************************************************************************
     239 * [29] This function TODO
     240 ********************************************************************************************/
     241int sys_dma_memcpy();
     242
     243/*********************************************************************************************
     244 * [30] This function TODO
     245 ********************************************************************************************/
     246int sys_utls();
     247
     248/*********************************************************************************************
     249 * [31] This function TODO
     250 ********************************************************************************************/
     251int sys_notAvailable();
     252
     253/*********************************************************************************************
     254 * [32] This function TODO
     255 ********************************************************************************************/
     256int sys_signal();
     257
     258/*********************************************************************************************
     259 * [33] This function TODO
     260 ********************************************************************************************/
     261int sys_sigreturn_setup();
     262
     263/*********************************************************************************************
     264 * [34] This function implements the "kill" system call.
     265 * It register the signal identified by the <sig> argument in all thread descriptors
     266 * of process identified by the <pid> argument.
     267 *********************************************************************************************
     268 * @ pid      : target process identifier.
     269 * @ sig      : signal index.
     270 ********************************************************************************************/
     271int sys_kill( pid_t    pid,
     272              uint32_t sig );
     273
     274/*********************************************************************************************
     275 * [35] This function TODO
    94276 ********************************************************************************************/
    95277int sys_getpid();
    96278
    97279/*********************************************************************************************
    98  * This function implement the "fork" system call.
     280 * [36] This function implement the "fork" system call.
    99281 * The calling process descriptor (parent process), and the associated thread descriptor are
    100282 * replicated in the same cluster as the calling thread, but the new process (child process)
     
    111293
    112294/*********************************************************************************************
    113  * This function implement the exec system call.
     295 * [37] This function implement the "exec" system call.
    114296 * It is executed in the client cluster, but the new process descriptor and main thread
    115297 * must be created in a server cluster, that is generally another cluster, using a RPC.
     
    124306 * required to build the new process descriptor and the associated thread, including
    125307 * the mode (local/remote).
     308 *********************************************************************************************
    126309 * @ filename : string pointer on .elf filename (virtual pointer in user space)
    127310 * @ argv     : array of strings on process arguments (virtual pointers in user space)
     
    133316              char ** envp );
    134317
    135 
    136 /*********************************************************************************************
    137  * This function TODO
     318/*********************************************************************************************
     319 * [38] This function TODO
     320 ********************************************************************************************/
     321int sys_thread_getattr();
     322
     323/*********************************************************************************************
     324 * [39] This function implements the ps system call.
    138325 ********************************************************************************************/
    139326int sys_ps( uint32_t cmd,
     
    141328            uint32_t tid );
    142329
    143 
    144 
    145 #endif
     330/*********************************************************************************************
     331 * [40] This function TODO
     332 ********************************************************************************************/
     333int sys_madvise();
     334
     335/*********************************************************************************************
     336 * [41] This function TODO
     337 ********************************************************************************************/
     338int sys_mcntl();
     339
     340/*********************************************************************************************
     341 * [42] This function TODO
     342 ********************************************************************************************/
     343int sys_stat();
     344
     345/*********************************************************************************************
     346 * [43] This function TODO
     347 ********************************************************************************************/
     348int sys_thread_migrate();
     349
     350/*********************************************************************************************
     351 * [44] This function TODO
     352 ********************************************************************************************/
     353int sys_sbrk();
     354
     355/*********************************************************************************************
     356 * [45] This function TODO
     357 ********************************************************************************************/
     358int sys_rmdir();
     359
     360/*********************************************************************************************
     361 * [46] This function TODO
     362 ********************************************************************************************/
     363int sys_ftime();
     364
     365/*********************************************************************************************
     366 * [47] This function TODO
     367 ********************************************************************************************/
     368int sys_chmod();
     369
     370/*********************************************************************************************
     371 * [48] This function TODO
     372 ********************************************************************************************/
     373int sys_fsync();
     374
     375/*********************************************************************************************
     376 * [49] This function TODO
     377 ********************************************************************************************/
     378int sys_gettimeofday();
     379
     380/*********************************************************************************************
     381 * [50] This function TODO
     382 ********************************************************************************************/
     383int sys_times();
     384
     385
     386#endif  // _SYSCALLS_H_
Note: See TracChangeset for help on using the changeset viewer.