Ignore:
Timestamp:
Sep 29, 2014, 10:47:26 AM (10 years ago)
Author:
alain
Message:

Introducing a physical memory allocator (pmem.c & pmem.h files).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_common/vmem.h

    r258 r408  
    11///////////////////////////////////////////////////////////////////////////////////
    2 // File     : vm_handler.h
     2// File     : vmem.h
    33// Date     : 01/07/2012
    44// Author   : alain greiner
    55// Copyright (c) UPMC-LIP6
    66///////////////////////////////////////////////////////////////////////////////////
     7// The vmem.c and vmem.h files are part ot the GIET-VM nano kernel.
     8// They define  the data structures implementing the page tables,
     9// and the function used for VPN to PPN translation.
     10///////////////////////////////////////////////////////////////////////////////////
     11// The virtual address format is 32 bits: structures in 3 fields:
     12//             |  11  |  9   |   12   |
     13//             | IX1  | IX2  | OFFSET |
     14// - The IX1 field is the index in the first level page table
     15// - The IX2 field is the index in the second level page table
     16// - The |IX1|IX2\ concatenation defines the VPN (Virtual Page Number)
     17///////////////////////////////////////////////////////////////////////////////////
    718
    8 #ifndef _VM_HANDLER_H_
    9 #define _VM_HANDLER_H_
    10 
    11 #include <giet_config.h>
    12 #include <mapping_info.h>
     19#ifndef _VMEM_H_
     20#define _VMEM_H_
    1321
    1422/////////////////////////////////////////////////////////////////////////////////////
     
    1826#define PT1_SIZE    8192
    1927#define PT2_SIZE    4096
     28
     29#define VPN_MASK    0xFFFFF000
     30#define BPN_MASK    0xFFE00000
    2031
    2132/////////////////////////////////////////////////////////////////////////////////////
     
    5162// Page table structure definition
    5263/////////////////////////////////////////////////////////////////////////////////////
     64
    5365typedef struct PageTable
    5466{
     
    5769} page_table_t;
    5870
    59 
    60 ////////////////////////////////////////////////////////////////////////////////////
    61 // Global variable
    62 ////////////////////////////////////////////////////////////////////////////////////
    63 
    64 extern page_table_t _iommu_ptab;
    65 
    6671////////////////////////////////////////////////////////////////////////////////////
    6772// functions prototypes
    6873////////////////////////////////////////////////////////////////////////////////////
    6974
    70 void _iommu_add_pte2( unsigned int ix1,
    71                       unsigned int ix2,
    72                       unsigned int ppn,
    73                       unsigned int flags );
    74 
    75 void _iommu_inval_pte2( unsigned int ix1,
    76                         unsigned int ix2 );
    77 
     75///////////////////////////////////////////////////////////////////////////////////
     76// This function makes a "vpn" to "ppn" translation, from the page table
     77// defined by the virtual address "pt". The MMU is supposed to be activated.
     78// It supports both small (4 Kbytes) & big (2 Mbytes) pages.
     79// It uses the address extension mechanism for physical addressing.
     80// Return 0 if success. Return 1 if PTE1 or PTE2 unmapped.
     81///////////////////////////////////////////////////////////////////////////////////
    7882unsigned int _v2p_translate( page_table_t* pt,
    7983                             unsigned int  vpn,
Note: See TracChangeset for help on using the changeset viewer.