Ignore:
Timestamp:
Nov 19, 2020, 11:44:34 PM (3 years ago)
Author:
alain
Message:

1) Introduce up to 4 command lines arguments in the KSH "load" command.
These arguments are transfered to the user process through the
argc/argv mechanism, using the user space "args" vseg.

2) Introduce the named and anonymous "pipes", for inter-process communication
through the pipe() and mkfifo() syscalls.

3) Introduce the "chat" application to validate the two above mechanisms.

4) Improve printk() and assert() fonctions in printk.c.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/core.c

    r657 r669  
    2626#include <hal_kernel_types.h>
    2727#include <hal_special.h>
    28 #include <errno.h>
    2928#include <printk.h>
    3029#include <thread.h>
    3130#include <chdev.h>
     31#include <alarm.h>
    3232#include <dev_pic.h>
    3333#include <rpc.h>
    3434#include <cluster.h>
    3535#include <kmem.h>
    36 #include <dqdt.h>
    3736#include <core.h>
    3837
     
    5251        core->rand_last         = hal_time_stamp() & 0xFFF;
    5352
    54     // initialize scheduler
     53    // initialize the scheduler
    5554        sched_init( core );
     55
     56    // initialise the alarms lock
     57    busylock_init( &core->alarms_lock , LOCK_CORE_ALARMS );
     58
     59    // initialise the alarms list
     60    list_root_init( &core->alarms_root );
    5661}
     62
     63///////////////////////////////////////
     64void core_check_alarms( core_t * core )
     65{
     66    alarm_handler_t * handler;
     67
     68    // get pointer on root of alarms list
     69    list_entry_t * root = &core->alarms_root;
     70
     71    // does nothing if list is empty
     72    if( list_is_empty( root ) ) return;
     73
     74    // get pointer on first alarm when list non empty
     75    alarm_t * alarm = LIST_FIRST( root , alarm_t , list );
     76
     77    // get first alarm date
     78    cycle_t alarm_date = alarm->date;
     79
     80    // get current date
     81    cycle_t current_date = hal_get_cycles();
     82
     83    if( current_date >= alarm_date )
     84    {
     85        // get pointer on registered alarm handler
     86        handler = (alarm_handler_t *)alarm->func_ptr;
     87
     88        // call alarm handler
     89        handler( alarm->args_xp );
     90    }
     91}   // end core_check_alarms()
    5792
    5893//////////////////////
     
    73108    }
    74109
    75     assert( false , "core not found" );
     110    assert( __FUNCTION__, false , "core not found" );
     111
     112    return 0;
    76113}
    77114
     
    104141        // handle scheduler
    105142        if( (ticks % CONFIG_SCHED_TICKS_PER_QUANTUM) == 0 ) sched_yield( "TICK");
     143
     144    // handle alarms
     145    core_check_alarms( core );
    106146}
    107147
Note: See TracChangeset for help on using the changeset viewer.