Ignore:
Timestamp:
Oct 4, 2018, 11:48:51 PM (3 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_iob.c

    r457 r565  
    22 * dev_iob.c - IOB (bridge to external I/O) generic device API implementation.
    33 *
    4  * Authors   Alain Greiner  (2017)
     4 * Authors   Alain Greiner  (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    2525#include <hal_kernel_types.h>
    2626#include <hal_special.h>
    27 #include <remote_spinlock.h>
     27#include <remote_busylock.h>
    2828#include <chdev.h>
    2929#include <printk.h>
     
    5050    // get IOB chdev descriptor cluster and local pointer
    5151    cxy_t     dev_cxy = GET_CXY( dev_xp );
    52     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     52    chdev_t * dev_ptr = GET_PTR( dev_xp );
    5353
    5454    // get pointer on set_active function
     
    5656
    5757    // call relevant driver function
    58     remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     58    remote_busylock_acquire( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    5959    f( dev_xp , 1 );
    60     remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     60    remote_busylock_release( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    6161}
    6262
     
    6666    // get IOB chdev descriptor cluster and local pointer
    6767    cxy_t     dev_cxy = GET_CXY( dev_xp );
    68     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     68    chdev_t * dev_ptr = GET_PTR( dev_xp );
    6969
    7070    // get pointer on set_active function
     
    7272
    7373    // call driver function
    74     remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     74    remote_busylock_acquire( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    7575    f( dev_xp , 0 );
    76     remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     76    remote_busylock_release( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    7777}
    7878
     
    8383    // get IOB chdev descriptor cluster and local pointer
    8484    cxy_t     dev_cxy = GET_CXY( dev_xp );
    85     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     85    chdev_t * dev_ptr = GET_PTR( dev_xp );
    8686
    8787    // get pointer on set_ptpr function
     
    8989
    9090    // call driver function
    91     remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     91    remote_busylock_acquire( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    9292    f( dev_xp , wdata );
    93     remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     93    remote_busylock_release( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    9494
    9595}
     
    101101    // get IOB chdev descriptor cluster and local pointer
    102102    cxy_t     dev_cxy = GET_CXY( dev_xp );
    103     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     103    chdev_t * dev_ptr = GET_PTR( dev_xp );
    104104
    105105    // get pointer on inval_page function
     
    107107
    108108    // call driver function
    109     remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     109    remote_busylock_acquire( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    110110    f( dev_xp , vpn );
    111     remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     111    remote_busylock_release( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    112112}
    113113
     
    120120    // get IOB chdev descriptor cluster and local pointer
    121121    cxy_t     dev_cxy = GET_CXY( dev_xp );
    122     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
     122    chdev_t * dev_ptr = GET_PTR( dev_xp );
    123123
    124124    // get pointer on the functions
     
    128128
    129129    // call driver function
    130     remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     130    remote_busylock_acquire( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    131131    *error = f_get_error( dev_xp );
    132132    *srcid = f_get_srcid( dev_xp );
    133133    *bvar  = f_get_bvar( dev_xp );
    134     remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     134    remote_busylock_release( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
    135135}
    136136
Note: See TracChangeset for help on using the changeset viewer.