Changeset 238 for soft/giet_vm/memo/include/pseg.h
- Timestamp:
- May 29, 2013, 1:24:09 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/memo/include/pseg.h
r210 r238 1 1 /* -*- c++ -*- 2 2 * 3 * SOCLIB_LGPL_HEADER_BEGIN3 * GIET-VM_LGPL_HEADER_BEGIN 4 4 * 5 * This file is part of SoCLib, GNU LGPLv2.1.5 * This file is part of the GIET-VMS, GNU LGPLv2.1. 6 6 * 7 * SoCLibis free software; you can redistribute it and/or modify it7 * The GIET-VM is free software; you can redistribute it and/or modify it 8 8 * under the terms of the GNU Lesser General Public License as published 9 9 * by the Free Software Foundation; version 2.1 of the License. 10 10 * 11 * SoCLibis distributed in the hope that it will be useful, but11 * THe GIET-VM is distributed in the hope that it will be useful, but 12 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 19 19 * 02110-1301 USA 20 20 * 21 * SOCLIB_LGPL_HEADER_END21 * GIET-VM_LGPL_HEADER_END 22 22 * 23 23 * Copyright (c) UPMC, Lip6, SoC … … 25 25 * 26 26 */ 27 #ifndef SOCLIB_PSEG_H_28 #define SOCLIB_PSEG_H_27 #ifndef GIET_MEMO_PSEG_H 28 #define GIET_MEMO_PSEG_H 29 29 30 30 #include <string> … … 39 39 class MeMo; 40 40 41 ////////// 41 42 class VSeg 42 43 { … … 45 46 friend class MeMo; 46 47 47 std::string m_name; 48 std::string m_file; 49 uintptr_t m_vma; //The address of the section to load in the binary file. 50 uintptr_t m_lma; //Physical address to which we load the seg (getted from the associated PSeg), setted by PSeg::add/addIdent. 51 size_t m_length; 52 size_t m_type; 53 bool m_loadable; // wether this is a loadable vseg ( code, data...) 48 typedef unsigned long long paddr_t; 49 50 std::string m_name; // vseg name 51 std::string m_file; // file name 52 uintptr_t m_vma; // Virtual address of the section to load in the binary file. 53 paddr_t m_lma; // Physical address 54 size_t m_length; 55 size_t m_type; 56 bool m_loadable; // loadable vseg ( code, data...) 54 57 55 58 public: 56 bool m_ident;//Indicate if the idententy mapping is activited. used by PSegHandler::makeIdent() 59 60 bool m_ident; // identity mapping required if true 57 61 58 62 const std::string& name() const; 59 63 const std::string& file() const; 60 64 uintptr_t vma() const; 61 uintptr_t lma() const;65 paddr_t lma() const; 62 66 size_t length() const; 63 67 size_t type() const; … … 75 79 VSeg(); 76 80 VSeg( const VSeg &ref ); 77 VSeg(std::string& binaryName, std::string& name, uintptr_t vma, size_t length, bool loadable, bool ident); 81 VSeg(std::string& binaryName, 82 std::string& name, 83 uintptr_t vma, 84 size_t length, 85 bool loadable, 86 bool ident); 78 87 79 88 ~VSeg(); 80 89 }; 81 90 82 91 ////////// 83 92 class PSeg 84 93 { 85 std::string m_name;86 uintptr_tm_lma;87 size_tm_length;88 size_t m_type;94 std::string m_name; 95 paddr_t m_lma; 96 paddr_t m_length; 97 size_t m_type; 89 98 90 uintptr_t m_pageLimit; //The end (m_lma + m_length) address of the segment pageSize aligned91 uintptr_t m_nextLma; //next free base99 paddr_t m_pageLimit; // m_lma + m_length aligned on page size 100 paddr_t m_nextLma; // next free base 92 101 93 void confNextLma(); //check that m_nextLma has a correct value:whithin the seg limits102 void confNextLma(); // check m_nextLma is whithin the seg limits 94 103 95 104 public: 105 96 106 std::vector<VSeg> m_vsegs; 97 uintptr_t m_limit;// m_lma + m_length98 107 108 paddr_t m_limit; // m_lma + m_length 99 109 100 110 const std::string& name() const; 101 uintptr_t lma() const;102 size_t length() const;111 paddr_t lma() const; 112 paddr_t length() const; 103 113 size_t type() const; 104 uintptr_t limit() const;105 uintptr_t nextLma() const;114 paddr_t limit() const; 115 paddr_t nextLma() const; 106 116 107 117 void check() const; 108 118 109 119 void setName(std::string& name); 110 void setLma( uintptr_t lma);111 void setLength( size_t length);120 void setLma( paddr_t lma); 121 void setLength(paddr_t length); 112 122 113 static size_t align( unsigned toAlign, unsigned alignPow2); 114 static size_t pageAlign( size_t toAlign ); 123 static paddr_t align( paddr_t toAlign, unsigned alignPow2); 124 static paddr_t pageAlign( paddr_t toAlign ); 125 115 126 static void setPageSize(size_t pg); 127 116 128 static size_t& pageSize(); 117 129 118 void add( VSeg& vseg ); //add a VSeg130 void add( VSeg& vseg ); //add a VSeg 119 131 void addIdent( VSeg& vseg ); 120 132 121 void setNextLma( uintptr_t nextLma);122 void incNextLma( size_t inc _next);133 void setNextLma( paddr_t nextLma); 134 void incNextLma( size_t inc); 123 135 124 136 void print( std::ostream &o ) const; … … 134 146 PSeg( const PSeg &ref ); 135 147 PSeg( const std::string &name); 136 PSeg( const uintptr_t lma);148 PSeg( const paddr_t lma); 137 149 PSeg( const std::string &name, 138 uintptr_t lma,139 size_t length,140 150 paddr_t lma, 151 paddr_t length, 152 size_t type); 141 153 ~PSeg(); 142 154 }; 143 155 144 156 145 #endif /* SOCLIB_PSEG_H_*/157 #endif /* GIET_MEMO_PSEG_H */
Note: See TracChangeset
for help on using the changeset viewer.