source: soft/giet_vm/memo/include/memo.h @ 742

Last change on this file since 742 was 238, checked in by alain, 12 years ago

Major evolution to support physical addresses larger than 32 bits.
The map.xml format has been modified: the vsegs associated to schedulers
are now explicitely defined and mapped in the page tables.

File size: 3.6 KB
RevLine 
[163]1/* -*- c++ -*-
2 *
[238]3 * GIET_VM_LGPL_HEADER_BEGIN
[163]4 *
[238]5 * This file is part of GIET_VM, GNU LGPLv2.1.
[163]6 *
[238]7 * GIET_VM is free software; you can redistribute it and/or modify it
[163]8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; version 2.1 of the License.
10 *
[238]11 * GIET_VM is distributed in the hope that it will be useful, but
[163]12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
[238]17 * License along with GIET_VM; if not, write to the Free Software
[163]18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
[238]21 * GIET_VM_LGPL_HEADER_END
[163]22 *
23 * Copyright (c) UPMC, Lip6, SoC
24 *         Mohamed Lamine Karaoui <Mohamed.Karaoui@lip6.fr>, 2012
25 *
26 */
27
[238]28#ifndef GIET_VM_MEMO_H
29#define GIET_VM_MEMO_H
30
[163]31#include  <stdlib.h>
32#include  <cstdlib>
33#include  <fcntl.h>
34#include  <unistd.h>
35#include  <cstdio>
36#include  <string.h>
37
38#include <string>
39#include <ios>
40#include <vector>
41#include <map>
42#include <fstream>
43
44#include <dpp/foreach>
45
46#include <elfpp/object>
47#include <elfpp/symbol>
48#include <elfpp/section>
49#include <elfpp/segment>
50#include <elfpp/elfpp_bits.hh>
51
52#include "stdint.h"
[210]53#include "mapping_info.h"
[163]54#include "pseg_handler.h"
55#include "path_handler.h"
56
57
58class MeMo
59{
[238]60// TODO: make the name defined in the map_info relative to this wd.
[163]61
[238]62    std::string                                   m_path;       // map_info path name
63    std::string                                   m_wd;         // map_info directory TODO
64    std::string                                   m_simpleName; // map_info filename TODO
65    void*                                         m_data;       // map_info structure
66    uintptr_t                                     m_addr;       // map_info address (virtual)
67    size_t                                        m_size;       // size of the structure
[163]68    mutable std::map<std::string, elfpp::object*> m_loaders;
[238]69    PSegHandler                                   m_psegh;
70    PathHandler                                   m_pathHandler;
71    bool                                          m_ginit;
72    elfpp::object*                                m_generator;
[163]73
[173]74    size_t load_bin(std::string filename, void* buffer);   
75    size_t bin_size(std::string filename);
76
[163]77    elfpp::section* get_sect_by_addr(elfpp::object *loader, unsigned int addr);
78
79public:
80
[238]81    MeMo( const std::string   &name, 
82          const size_t        pageSize = 4096);
83
[163]84    ~MeMo();
85
86    void buildSoft(const std::string &filename);
87
88    void print( std::ostream &o ) const;
89
90    void print_mapping() const;
91
92    friend std::ostream &operator<<( std::ostream &o, const MeMo &s )
93    {
94        s.print(o);
95        return o;
96    }
97
[238]98    // The following functions handle the map.bin structure
99    // They must keep synchronised with functions defined in boot_init.c.
[163]100
[187]101    mapping_cluster_t* get_cluster_base( mapping_header_t* header );
[163]102    mapping_pseg_t* get_pseg_base( mapping_header_t* header );
103    mapping_vspace_t* get_vspace_base( mapping_header_t* header );
104    mapping_vseg_t* get_vseg_base( mapping_header_t* header );
105    mapping_vobj_t* get_vobj_base( mapping_header_t* header );
106    void print_mapping_info(void* desc);
107    void vseg_map( mapping_vseg_t* vseg);
108    void buildMap(void* desc);
109
110};
111
112
[238]113#endif /* GIET_VM_MEMO_H */
[163]114
115// Local Variables:
116// tab-width: 4
117// c-basic-offset: 4
118// c-file-offsets:((innamespace . 0)(inline-open . 0))
119// indent-tabs-mode: nil
120// End:
121
122// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
123
Note: See TracBrowser for help on using the repository browser.