gem5  v22.1.0.0
aux_vector.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __AUX_VECTOR_HH__
33 #define __AUX_VECTOR_HH__
34 
35 #include "base/compiler.hh"
36 
37 namespace gem5
38 {
39 
40 namespace auxv {
41 
42 template<class IntType>
43 class AuxVector
44 {
45  public:
46  AuxVector() = default;
47  AuxVector(IntType _type, IntType _val) : type(_type), val(_val) {}
48 
49  IntType type = 0;
50  IntType val = 0;
51 };
52 
53 // Ensure the global versions of swap_byte are visible.
54 using gem5::swap_byte;
55 
56 // Define swap_byte in this namespace, so argument dependent resolution can
57 // find it.
58 template <class IntType>
59 inline AuxVector<IntType>
61 {
63 }
64 
65 enum Type
66 {
67  Null = 0, // End of vector.
68  Ignore = 1, // Ignored.
69  Execfd = 2, // File descriptor of program if interpreter used.
70  Phdr = 3, // Address of program header tables in memory.
71  Phent = 4, // Size in bytes of one program header entry.
72  Phnum = 5, // Number of entries in program header table.
73  Pagesz = 6, // System page size.
74  Base = 7, // Base address of interpreter program in memory.
75  Flags = 8, // Unused.
76  Entry = 9, // Entry point of program after interpreter setup.
77  Notelf = 10, // Non-zero if format is different than ELF.
78  Uid = 11, // Address of real user ID of thread.
79  Euid = 12, // Address of effective user ID of thread.
80  Gid = 13, // Address of real group ID of thread.
81  Egid = 14, // Address of effective group ID of thread.
82  Platform = 15, // Platform string for the architecture.
83  Hwcap = 16, // Bits which describe the hardware capabilities.
84  Clktck = 17, // Frequency at which times() syscall increments.
85  Secure = 23, // Whether to enable "secure mode" in executable.
86  BasePlatform = 24, // Platform string (differs on PowerPC only).
87  Random = 25, // Pointer to 16 bytes of random data.
88  Hwcap2 = 26, // Extension of AT_HWCAP.
89  Execfn = 31, // Filename of the program.
90  VectorSize = 44
91 };
92 
93 } // namespace auxv
94 
95 #define GEM5_DEPRECATE_AT(NAME, name) M5_AT_##NAME \
96  [[deprecated("Replace M5_AT_" #NAME " with gem5::auxv::" #name)]] = \
97  gem5::auxv::name
98 
100 {
102  GEM5_DEPRECATE_AT(IGNORE, Ignore),
103  GEM5_DEPRECATE_AT(EXECFD, Execfd),
104  GEM5_DEPRECATE_AT(PHDR, Phdr),
105  GEM5_DEPRECATE_AT(PHENT, Phent),
106  GEM5_DEPRECATE_AT(PHNUM, Phnum),
107  GEM5_DEPRECATE_AT(PAGESZ, Pagesz),
109  GEM5_DEPRECATE_AT(FLAGS, Flags),
110  GEM5_DEPRECATE_AT(ENTRY, Entry),
111  GEM5_DEPRECATE_AT(NOTELF, Notelf),
112  GEM5_DEPRECATE_AT(UID, Uid),
113  GEM5_DEPRECATE_AT(EUID, Euid),
114  GEM5_DEPRECATE_AT(GID, Gid),
115  GEM5_DEPRECATE_AT(EGID, Egid),
116  GEM5_DEPRECATE_AT(PLATFORM, Platform),
117  GEM5_DEPRECATE_AT(HWCAP, Hwcap),
118  GEM5_DEPRECATE_AT(CLKTCK, Clktck),
119  GEM5_DEPRECATE_AT(SECURE, Secure),
120  M5_BASE_PLATFORM [[deprecated(
121  "Replace M5_BASE_PLATFORM with gem5::auxv::BasePlatform")]] =
123  GEM5_DEPRECATE_AT(RANDOM, Random),
124  GEM5_DEPRECATE_AT(HWCAP2, Hwcap2),
125  GEM5_DEPRECATE_AT(EXECFN, Execfn),
126  GEM5_DEPRECATE_AT(VECTOR_SIZE, VectorSize)
127 };
128 
129 #undef GEM5_DEPRECATE_AT
130 
131 template <class IntType>
132 using AuxVector [[deprecated(
133  "The AuxVector template is now in the gem5::auxv namespace.")]] =
135 
136 } // namespace gem5
137 
138 #endif // __AUX_VECTOR_HH__
Wrapper that groups a few flag bits under the same undelying container.
Definition: flags.hh:45
AuxVector(IntType _type, IntType _val)
Definition: aux_vector.hh:47
AuxVector< IntType > swap_byte(const AuxVector< IntType > &av)
Definition: aux_vector.hh:60
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::enable_if_t< std::is_same_v< T, vring_used_elem >, T > swap_byte(T v)
Definition: base.hh:76
AuxiliaryVectorType
Definition: aux_vector.hh:100
@ M5_BASE_PLATFORM
Definition: aux_vector.hh:120
@ GEM5_DEPRECATE_AT
Definition: aux_vector.hh:101

Generated on Wed Dec 21 2022 10:22:39 for gem5 by doxygen 1.9.1