Files
gem5/src/sim/aux_vector.hh
Daniel R. Carvalho 974a47dfb9 misc: Adopt the gem5 namespace
Apply the gem5 namespace to the codebase.

Some anonymous namespaces could theoretically be removed,
but since this change's main goal was to keep conflicts
at a minimum, it was decided not to modify much the
general shape of the files.

A few missing comments of the form "// namespace X" that
occurred before the newly added "} // namespace gem5"
have been added for consistency.

std out should not be included in the gem5 namespace, so
they weren't.

ProtoMessage has not been included in the gem5 namespace,
since I'm not familiar with how proto works.

Regarding the SystemC files, although they belong to gem5,
they actually perform integration between gem5 and SystemC;
therefore, it deserved its own separate namespace.

Files that are automatically generated have been included
in the gem5 namespace.

The .isa files currently are limited to a single namespace.
This limitation should be later removed to make it easier
to accomodate a better API.

Regarding the files in util, gem5:: was prepended where
suitable. Notice that this patch was tested as much as
possible given that most of these were already not
previously compiling.

Change-Id: Ia53d404ec79c46edaa98f654e23bc3b0e179fe2d
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46323
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-07-01 19:08:24 +00:00

141 lines
5.1 KiB
C++

/*
* Copyright (c) 2016 Advanced Micro Devices, Inc.
* All rights reserved.
*
* For use for simulation and test purposes only
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __AUX_VECTOR_HH__
#define __AUX_VECTOR_HH__
#include "base/compiler.hh"
namespace gem5
{
namespace auxv {
template<class IntType>
class AuxVector
{
public:
AuxVector() = default;
AuxVector(IntType _type, IntType _val) : type(_type), val(_val) {}
IntType type = 0;
IntType val = 0;
};
// Ensure the global versions of swap_byte are visible.
using gem5::swap_byte;
// Define swap_byte in this namespace, so argument dependent resolution can
// find it.
template <class IntType>
inline AuxVector<IntType>
swap_byte(const AuxVector<IntType> &av)
{
return AuxVector<IntType>(swap_byte(av.type), swap_byte(av.val));
}
enum Type
{
Null = 0, // End of vector.
Ignore = 1, // Ignored.
Execfd = 2, // File descriptor of program if interpreter used.
Phdr = 3, // Address of program header tables in memory.
Phent = 4, // Size in bytes of one program header entry.
Phnum = 5, // Number of entries in program header table.
Pagesz = 6, // System page size.
Base = 7, // Base address of interpreter program in memory.
Flags = 8, // Unused.
Entry = 9, // Entry point of program after interpreter setup.
Notelf = 10, // Non-zero if format is different than ELF.
Uid = 11, // Address of real user ID of thread.
Euid = 12, // Address of effective user ID of thread.
Gid = 13, // Address of real group ID of thread.
Egid = 14, // Address of effective group ID of thread.
Platform = 15, // Platform string for the architecture.
Hwcap = 16, // Bits which describe the hardware capabilities.
Clktck = 17, // Frequency at which times() syscall increments.
Secure = 23, // Whether to enable "secure mode" in executable.
BasePlatform = 24, // Platform string (differs on PowerPC only).
Random = 25, // Pointer to 16 bytes of random data.
Hwcap2 = 26, // Extension of AT_HWCAP.
Execfn = 31, // Filename of the program.
VectorSize = 44
};
} // namespace auxv
#define GEM5_DEPRECATE_AT(NAME, name) M5_AT_##NAME \
GEM5_DEPRECATED_ENUM_VAL(\
"Replace M5_AT_" #NAME " with gem5::auxv::" #name) = gem5::auxv::name
enum AuxiliaryVectorType
{
GEM5_DEPRECATE_AT(NULL, Null),
GEM5_DEPRECATE_AT(IGNORE, Ignore),
GEM5_DEPRECATE_AT(EXECFD, Execfd),
GEM5_DEPRECATE_AT(PHDR, Phdr),
GEM5_DEPRECATE_AT(PHENT, Phent),
GEM5_DEPRECATE_AT(PHNUM, Phnum),
GEM5_DEPRECATE_AT(PAGESZ, Pagesz),
GEM5_DEPRECATE_AT(BASE, Base),
GEM5_DEPRECATE_AT(FLAGS, Flags),
GEM5_DEPRECATE_AT(ENTRY, Entry),
GEM5_DEPRECATE_AT(NOTELF, Notelf),
GEM5_DEPRECATE_AT(UID, Uid),
GEM5_DEPRECATE_AT(EUID, Euid),
GEM5_DEPRECATE_AT(GID, Gid),
GEM5_DEPRECATE_AT(EGID, Egid),
GEM5_DEPRECATE_AT(PLATFORM, Platform),
GEM5_DEPRECATE_AT(HWCAP, Hwcap),
GEM5_DEPRECATE_AT(CLKTCK, Clktck),
GEM5_DEPRECATE_AT(SECURE, Secure),
M5_BASE_PLATFORM GEM5_DEPRECATED_ENUM_VAL(
"Replace M5_BASE_PLATFORM with gem5::auxv::BasePlatform") =
gem5::auxv::BasePlatform,
GEM5_DEPRECATE_AT(RANDOM, Random),
GEM5_DEPRECATE_AT(HWCAP2, Hwcap2),
GEM5_DEPRECATE_AT(EXECFN, Execfn),
GEM5_DEPRECATE_AT(VECTOR_SIZE, VectorSize)
};
#undef GEM5_DEPRECATE_AT
template <class IntType>
using AuxVector GEM5_DEPRECATED(
"The AuxVector template is now in the gem5::auxv namespace.") =
gem5::auxv::AuxVector<IntType>;
} // namespace gem5
#endif // __AUX_VECTOR_HH__