Ignore:
Timestamp:
Aug 12, 2014, 10:43:18 AM (10 years ago)
Author:
alain
Message:

Housekeeping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/sys_handler.c

    r322 r396  
    2020#include <fat32.h>
    2121#include <utils.h>
     22#include <vmem.h>
    2223#include <hard_config.h>
    2324#include <giet_config.h>
     
    6263    &_context_switch,      /* 0x19 */
    6364    &_vobj_get_vbase,      /* 0x1A */
    64     &_sys_ukn,             /* 0x1B */
     65    &_get_xy_from_ptr,     /* 0x1B */
    6566    &_nic_cma_start,       /* 0x1C */
    6667    &_nic_cma_stop,        /* 0x1D */
     
    257258}
    258259
     260/////////////////////////////////////////////////////////////////////////////
     261// This function returns in the (x,y) arguments the coordinates of the
     262// where is mapped the ptr virtual address. It use the _get_context_slot()
     263// function to get the calling task page table, and uses the _v2p_translate()
     264// function to obtain the physical address.
     265// returns 0 if success, > 0 if ptr not mapped in the calling task vspace.
     266/////////////////////////////////////////////////////////////////////////////
     267
     268unsigned int _get_xy_from_ptr( void*         ptr,
     269                               unsigned int* px,
     270                               unsigned int* py )
     271{
     272    unsigned int ret;
     273    unsigned int ppn;
     274    unsigned int flags;
     275    unsigned int vpn  = (((unsigned int)ptr)>>12);
     276   
     277    // get the page table pointer
     278    page_table_t* pt = (page_table_t*)_get_context_slot( CTX_PTAB_ID );
     279
     280    // compute the physical address
     281    if ( (ret = _v2p_translate( pt, vpn, &ppn, &flags )) )
     282    {
     283        return ret;
     284    }
     285
     286    *px = (ppn>>24) & 0xF;
     287    *py = (ppn>>20) & 0xF;
     288    return 0;
     289}
     290
    259291////////////////////////////////////////////////////////////////////////////
    260292// This sysrem function deschedule the requestint task.
Note: See TracChangeset for help on using the changeset viewer.