source: soft/giet_vm/memo/include/libelfpp/elfpp/elfpp_segment.hh @ 788

Last change on this file since 788 was 163, checked in by karaoui, 12 years ago

changing mover to memo
changing soft.bin to soft.elf
...

File size: 2.3 KB
Line 
1/*
2    This file is part of Libelfpp.
3
4    Libelfpp is free software: you can redistribute it and/or modify
5    it under the terms of the GNU Lesser General Public License as
6    published by the Free Software Foundation, either version 3 of the
7    License, or (at your option) any later version.
8
9    Libelfpp is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with Libelfpp.  If not, see
16    <http://www.gnu.org/licenses/>.
17
18   Copyright (c) Alexandre Becoulet <alexandre.becoulet@free.fr>
19*/
20
21#ifndef ELFPP_SEGMENT_HH_
22#define ELFPP_SEGMENT_HH_
23
24#include <string>
25#include <map>
26#include <stdint.h>
27
28#include "elfpp.hh"
29#include "elfpp_bits.hh"
30
31namespace elfpp
32{
33  class object;
34  class segment;
35
36  std::ostream & operator<<(std::ostream &o, const segment &v);
37
38  /**
39      @short ELF segment class
40      @header elfpp/segment
41   */
42  class segment : public segment_table_t::item_type
43  {
44    template <typename, int> friend class elfn_access;
45    friend std::ostream & operator<<(std::ostream &o, const segment &v);
46    friend class object;
47
48  public:
49    /** create a new segment associated with given object */
50    inline segment(object &obj);
51    inline ~segment();
52
53    inline p_type_e get_type() const;
54    inline void set_type(p_type_e e);
55
56    inline p_flags_e get_flags() const;
57    inline void set_flags(p_flags_e e);
58
59    inline uint64_t get_vaddr() const;
60    inline void set_vaddr(uint64_t a);
61
62    inline uint64_t get_paddr() const;
63    inline void set_paddr(uint64_t a);
64
65    inline size_t get_mem_size() const;
66    inline void set_mem_size(size_t a);
67
68    inline size_t get_file_size() const;
69    inline off_t get_file_offset() const;
70
71    inline size_t get_align() const;
72    inline void set_align(size_t a);
73
74    inline void set_file_offset(off_t a);
75    inline void set_file_size(size_t a);
76
77   private:
78
79    /** start of flags present in elf segment entry */
80    p_type_e type_;
81    p_flags_e flags_;
82    uint64_t vaddr_;
83    uint64_t paddr_;
84    size_t mem_size_;
85    size_t file_size_;
86    off_t offset_;
87    size_t align_;
88  };
89}
90
91#endif
92
Note: See TracBrowser for help on using the repository browser.