Changeset 632 for trunk/kernel/mm/page.c


Ignore:
Timestamp:
May 28, 2019, 2:56:04 PM (5 years ago)
Author:
alain
Message:

This version replace the RPC by direct remote memory access
for physical pages allacation/release.
It is commited before being tested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/page.c

    r567 r632  
    9393}
    9494
    95 ////////////////////////////////
    96 void page_print( page_t * page )
     95
     96////////////////////////////////////////////////////
     97inline void page_remote_set_flag( xptr_t    page_xp,
     98                                  uint32_t  value )
    9799{
    98         printk("*** Page %d : base = %x / flags = %x / order = %d / count = %d\n",
    99                 page->index,
    100                 GET_PTR( ppm_page2base( XPTR( local_cxy , page ) ) ),
    101                 page->flags,
    102                 page->order,
    103                 page->refcount );
     100    cxy_t    page_cxy = GET_CXY( page_xp );
     101    page_t * page_ptr = GET_PTR( page_xp );
     102
     103        hal_remote_atomic_or( XPTR( page_cxy , &page_ptr->flags ) , value );
    104104}
    105105
     106//////////////////////////////////////////////////////
     107inline void page_remote_clear_flag( xptr_t    page_xp,
     108                                    uint32_t  value )
     109{
     110    cxy_t    page_cxy = GET_CXY( page_xp );
     111    page_t * page_ptr = GET_PTR( page_xp );
     112
     113        hal_remote_atomic_and( XPTR( page_cxy , &page_ptr->flags ) , value );
     114}
     115
     116/////////////////////////////////////////////////////
     117inline bool_t page_remote_is_flag( xptr_t    page_xp,
     118                                   uint32_t  value )
     119{
     120    cxy_t    page_cxy = GET_CXY( page_xp );
     121    page_t * page_ptr = GET_PTR( page_xp );
     122
     123    uint32_t flags = hal_remote_l32( XPTR( page_cxy , &page_ptr->flags ) );
     124   
     125    return (flags & value) ? 1 : 0;
     126}
     127
     128/////////////////////////////////////////////////////
     129inline void page_remote_refcount_up( xptr_t page_xp )
     130{
     131    cxy_t    page_cxy = GET_CXY( page_xp );
     132    page_t * page_ptr = GET_PTR( page_xp );
     133
     134    hal_remote_atomic_add( XPTR( page_cxy , &page_ptr->refcount ) , 1 );
     135}
     136
     137///////////////////////////////////////////////////////
     138inline void page_remote_refcount_down( xptr_t page_xp )
     139{
     140    cxy_t    page_cxy = GET_CXY( page_xp );
     141    page_t * page_ptr = GET_PTR( page_xp );
     142
     143    hal_remote_atomic_add( XPTR( page_cxy , &page_ptr->refcount ) , -1 );
     144}
     145
     146///////////////////////////////////////////
     147void page_remote_display( xptr_t  page_xp )
     148{
     149    page_t  page;   // local copy of page decriptor
     150
     151    hal_remote_memcpy( XPTR( local_cxy , &page ) , page_xp , sizeof( page_t ) );
     152                     
     153        printk("*** Page %d in cluster %x : ppn %x / flags %x / order %d / refcount %d\n",
     154                page.index,
     155            GET_CXY( page_xp ),
     156                ppm_page2ppn( page_xp ),
     157                page.flags,
     158                page.order,
     159                page.refcount );
     160}
     161
     162
     163
Note: See TracChangeset for help on using the changeset viewer.