source: soft/giet_vm/giet_common/vmem.h @ 383

Last change on this file since 383 was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : vm_handler.h
3// Date     : 01/07/2012
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#ifndef _VM_HANDLER_H_
9#define _VM_HANDLER_H_
10
11#include <giet_config.h>
12#include <mapping_info.h>
13
14/////////////////////////////////////////////////////////////////////////////////////
15// Page Table sizes definition
16/////////////////////////////////////////////////////////////////////////////////////
17
18#define PT1_SIZE    8192
19#define PT2_SIZE    4096
20
21/////////////////////////////////////////////////////////////////////////////////////
22// PTE flags masks definition
23/////////////////////////////////////////////////////////////////////////////////////
24
25#define PTE_V  0x80000000
26#define PTE_T  0x40000000
27#define PTE_L  0x20000000
28#define PTE_R  0x10000000
29#define PTE_C  0x08000000
30#define PTE_W  0x04000000
31#define PTE_X  0x02000000
32#define PTE_U  0x01000000
33#define PTE_G  0x00800000
34#define PTE_D  0x00400000
35
36/////////////////////////////////////////////////////////////////////////////////////
37// MMU error codes definition
38/////////////////////////////////////////////////////////////////////////////////////
39
40#define MMU_ERR_PT1_UNMAPPED         0x001 // Page fault on Table1 (invalid PTE)
41#define MMU_ERR_PT2_UNMAPPED         0x002 // Page fault on Table 2 (invalid PTE)
42#define MMU_ERR_PRIVILEGE_VIOLATION  0x004 // Protected access in user mode
43#define MMU_ERR_WRITE_VIOLATION      0x008 // Write access to a non write page
44#define MMU_ERR_EXEC_VIOLATION       0x010 // Exec access to a non exec page
45#define MMU_ERR_UNDEFINED_XTN        0x020 // Undefined external access address
46#define MMU_ERR_PT1_ILLEGAL_ACCESS   0x040 // Bus Error in Table1 access
47#define MMU_ERR_PT2_ILLEGAL_ACCESS   0x080 // Bus Error in Table2 access
48#define MMU_ERR_CACHE_ILLEGAL_ACCESS 0x100 // Bus Error during the cache access
49
50/////////////////////////////////////////////////////////////////////////////////////
51// Page table structure definition
52/////////////////////////////////////////////////////////////////////////////////////
53typedef struct PageTable
54{
55    unsigned int pt1[PT1_SIZE / 4];    // PT1 (index is ix1)
56    unsigned int pt2[1][PT2_SIZE / 4]; // PT2s (index is 2*ix2)
57} page_table_t;
58
59
60////////////////////////////////////////////////////////////////////////////////////
61// Global variable
62////////////////////////////////////////////////////////////////////////////////////
63
64extern page_table_t _iommu_ptab;
65
66////////////////////////////////////////////////////////////////////////////////////
67// functions prototypes
68////////////////////////////////////////////////////////////////////////////////////
69
70void _iommu_add_pte2( unsigned int ix1, 
71                      unsigned int ix2, 
72                      unsigned int ppn, 
73                      unsigned int flags );
74
75void _iommu_inval_pte2( unsigned int ix1, 
76                        unsigned int ix2 );
77
78unsigned int _v2p_translate( page_table_t* pt, 
79                             unsigned int  vpn, 
80                             unsigned int* ppn, 
81                             unsigned int* flags );
82
83#endif
84
85// Local Variables:
86// tab-width: 4
87// c-basic-offset: 4
88// c-file-offsets:((innamespace . 0)(inline-open . 0))
89// indent-tabs-mode: nil
90// End:
91// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
92
Note: See TracBrowser for help on using the repository browser.