summaryrefslogtreecommitdiff
path: root/src/base
AgeCommit message (Collapse)Author
2018-05-17base: Add M5 flag for [[nodiscard]] attributeNikos Nikoleris
This change adds the M5_NODISCARD keyword to allow use of the [[nodiscard]] attribute with compilers that support C++17. Currently, C++17 is not a requirement and therefore the M5_NODISCARD has not effect and does not break compilation for older compilers. Change-Id: Ifc5c8f34764da3c7291066dcb2ff908c97738c3d Reviewed-on: https://gem5-review.googlesource.com/10441 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
2018-05-09base, dev: Fix port message for vnc and terminalAndreas Sandberg
When running gem5, the simulator outputs the following message to describe the ports used by the VNC server and ther terminal: Listening for system connection on port 5900 Listening for system connection on port 3456 The code used to extract the basename ('terminal' or 'vncserver') and print that instead of system. However, this doesn't seem to work any more. Change the code to output the full object name instead. Change-Id: Ib27f66a5f8ba64c7a875b4e2f26a2e2ff48db8f3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Anouk Van Laer <anouk.vanlaer@arm.com> Reviewed-on: https://gem5-review.googlesource.com/10026 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-03-30base: Make bitunion output functions static/inline.Gabe Black
The specializations need to be online only and not static, but the template itself is static and inline. Originally they were in an anonymous namespace, but that causes warnings when building on clang or with certain versions of gcc because the functions may not be used in every .cc. Change-Id: Iff127337f7bf0c18755de07a49d6e7a9ce6f2f0a Reviewed-on: https://gem5-review.googlesource.com/9581 Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-03-28base: Add a default output function for bitunion types.Gabe Black
This way printing bitunions with, for instance, DPRINTF actually prints something useful. More specialized overloads will still allow printing particular bitunion types in ways that might make more sense for that particular type. Change-Id: I92beb0ce07683ba8b318cf25aa73e0057e4a60ef Reviewed-on: https://gem5-review.googlesource.com/9461 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-03-15arm: Fix implicit-fallthrough warnings when building with gcc-7+Siddhesh Poyarekar
gcc 7 onwards have additional heuristics to detect implicit fallthroughs and it fails the build with warnings for ARM as a result. There was one gcc bug[1] that I fixed but the rest are cases that gcc cannot detect due to the point at which it does the fallthrough check. Most of this patch adds __builtin_unreachable() hints in places that throw this warning to indicate to gcc that the fallthrough will never happen. The remaining cases are actually possible fallthroughs due to incorrect code running on the simulator; in which case an Unknown instruction is returned. [1] https://gcc.gnu.org/ml/gcc-patches/2018-02/msg01105.html Change-Id: I1baa9fa0ed15181c10c755c0bd777f88b607c158 Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> Reviewed-on: https://gem5-review.googlesource.com/8541 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
2018-03-14base: Fix loop range in pngwriterChun-Chen Hsu
The inner loop range limit should be width instead of height. Change-Id: I091c590713c945d4bd04ffcc974d4eb8aa23d1b2 Signed-off-by: Chun-Chen Hsu <chunchenhsu@google.com> Reviewed-on: https://gem5-review.googlesource.com/9081 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2018-02-13sim: Make Stats truly non-copy-constructibleRekai Gonzalez-Alberquilla
The stats are silently non-copy constructible. Therefore, when someone copy-constructs any object with stats, asserts happen when registering the stats, as they were not constructed in the intended way. This patch solves that by explicitly deleting the copy constructor, trading an obscure run-time assert for a compile-time somehow more meaningful error meassage. This triggers some compilation errors as the FaultStats in the fault definitions of ARM and SPARC use brace-enclosed initialisations in which one of the elements derives from DataWrap, which is not copy-constructible anymore. To fix that, this patch also adds a constructor for the FaultVals in both ISAs. Change-Id: I340e203b9386609b32c66e3b8918a015afe415a4 Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-on: https://gem5-review.googlesource.com/8082 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2018-02-05base: Update #includes for bitunion.hh.Gabe Black
<iostream> isn't actually used anywhere in bitunion.hh. The templated hash struct type is defined in <functional> and should be included explicitly. Change-Id: I8691ccb2f9e28a01610ae8bb4d9591b07cb7320b Reviewed-on: https://gem5-review.googlesource.com/7781 Reviewed-by: Matthias Jung <jungma@eit.uni-kl.de> Maintainer: Gabe Black <gabeblack@google.com>
2018-02-02base: Fix unused function warningNikos Nikoleris
After refactoring the remote gdb interface, break_type is declared as const function and is only used as a parameter to DPRINTF function calls. This means that it is seen as unused when compiling gem5.fast. This changeset fixes the warning. Change-Id: Iea89b66c53c62341c043d8bd3838ebc27ee333bc Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/7741 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
2018-01-29base: Remove the ability to cprintf stringstreams directly.Gabe Black
The cprintf functions don't know ahead of time what format characters are going to be used with what underlying data types, and so any type must be minimally usable with the default specialization of format_integer, format_char, format_float and format_string. All of those functions ultimately print their parameter with out << data except the one which prints stringstreams. That function accesses the buffer of the string stream with .str(), and then prints that instead. That should technically work out ok as long as stringstreams are only printed using %s, but there's no way to guarantee that ahead of time. To avoid that problem, and because gem5 doesn't ever actually use the ability to print stringstreams directly, this change removes that feature and modifies the corresponding part of the unit test. If we ever do want to print the contents of a string stream, it won't be difficult to add a .str() to it. Change-Id: Id902eaff042b96b374efe0183e5e3be9626e8c88 Reviewed-on: https://gem5-review.googlesource.com/7642 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-29base: Delete commented out versions of the format_integer function.Gabe Black
If they're needed, they'd be fairly easy to recreate and are also available in the revision history. Change-Id: I5cf5e4b1271ce488016464048de69bc643dee4d9 Reviewed-on: https://gem5-review.googlesource.com/7641 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-27base: Add an "override" to name() in the HardBreakpoint class.Gabe Black
clang reports an error otherwise and fails to compile. Change-Id: I3603d6c710641f1289e35c67f89a49f5cb71e95e Reviewed-on: https://gem5-review.googlesource.com/7582 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-01-27base: Get bitunions to compile on clang 3.8.Gabe Black
clang was getting very upset and interpretting a member function pointer as a call to the actual underlying function, and then complaining that it was a non-static function call without an instance. It seems what it was really upset about was that the class who's scope the member function pointer belonged to (the current class) wasn't done being defined. This *should* be ok as far as I can tell, but clang was having none of it. This change reworks how the type of the setter function arguments are determined to work around that limitation. The bitunion test was run with clang++ and g++ and both pass, and I've built gem5.opt for ARM successfully. Change-Id: Ib9351784a897af4867fe08045577e0247334ea11 Reviewed-on: https://gem5-review.googlesource.com/7581 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-20base: Hide the BitUnion::__StorageType type.Gabe Black
Since this type is now accessible through a clean interface, hide it from anybody that tries to peak around the curtain. Change-Id: I1257b6675a45b8648be459ad8e8d0f27a6feee6b Reviewed-on: https://gem5-review.googlesource.com/7205 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-20arm, base: Generalize and move the BitUnion hash struct.Gabe Black
The ARM types.hh file defined an STL style hash structure to operate on the ExtMachInst, but it referred to the underlying storage type using internal typedefs in the BitUnion types. To avoid having to do that, this change adds a hash structure to bitunion.hh which will work on any BitUnion, and gets rid of the ARM ExtMachInst version. Change-Id: I7c1c84d61b59061fec98abaaeab6becd06537dee Reviewed-on: https://gem5-review.googlesource.com/7204 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-20base: Enable specializing templates on BitUnion types.Gabe Black
Previously these relied on reaching into private internal definitions in the BitUnion types. Change-Id: Ia6c94de92986b85ec9e5fcb197459d450111fb36 Reviewed-on: https://gem5-review.googlesource.com/7202 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-20base: Rework bitunions so they can be more flexible.Gabe Black
They are now oriented around a class which makes it easy to provide custom setter/getter functions which let you set or read bits in an arbitrary way. Future additions may add the ability to add custom bitfield methods, and index-able bitfields. Change-Id: Ibd6d4d9e49107490f6dad30a4379a8c93bda9333 Reviewed-on: https://gem5-review.googlesource.com/7201 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-20sim, arch, base: Refactor the base remote GDB class.Gabe Black
Fold the GDBListener class into the main BaseRemoteGDB class, move around a bunch of functions, convert a lot of internal functions to be private, move some functions into the .cc, make some functions non-virtual which didn't really need to be overridden. Change-Id: Id0832b730b0fdfb2eababa5067e72c66de1c147d Reviewed-on: https://gem5-review.googlesource.com/7422 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-01-10style: change C/C++ source permissions to noexecBKP
Several files in the repository were tracked with execute permissions even though the files are just normal C/C++ files (and the one .isa). Change-Id: I976b096acab4a1fc74c5699ef1f9b222c1e635c2 Reviewed-on: https://gem5-review.googlesource.com/7241 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-14misc: Updates for gcc7.2 for x86Jason Lowe-Power
GCC 7.2 is much stricter than previous GCC versions. The following changes are needed: * There is now a warning if there is an implicit fallthrough between two case statments. C++17 adds the [[fallthrough]]; declaration. However, to support non C++17 standards (i.e., C++11), we use M5_FALLTHROUGH. M5_FALLTHROUGH checks for [[fallthrough]] compliant C++17 compiler and if that doesn't exist, it defaults to nothing (no older compilers generate warnings). * The above resulted in a couple of bugs that were found. This is noted in the review request on gerrit. * throw() for dynamic exception specification is deprecated * There were a couple of new uninitialized variable warnings * Can no longer perform bitwise operations on a bool. * Must now include <functional> for std::function * Compiler bug for void* lambda. Changed to auto as work around. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82878 Change-Id: I5d4c782a4e133fa4cdb119e35d9aff68c6e2958e Signed-off-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/5802 Reviewed-by: Gabe Black <gabeblack@google.com>
2017-12-13arm,sparc,x86,base,cpu,sim: Replace the Twin(32|64)_t types with.Gabe Black
Replace them with std::array<>s. Change-Id: I76624c87a1cd9b21c386a96147a18de92b8a8a34 Reviewed-on: https://gem5-review.googlesource.com/6602 Maintainer: Gabe Black <gabeblack@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-12-12tests: Turn fbtest into a gtest and move it to src/base.Gabe Black
Change-Id: I9ca57e24f27e0eb747d1f27262972a8abcd10fc8 Reviewed-on: https://gem5-review.googlesource.com/6342 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12tests: Move the cprintftest unit test into src/base.Gabe Black
That way it will live alongside the code it tests. Change-Id: I00baad2206870a4619b7cee792a1d4c303dad04d Reviewed-on: https://gem5-review.googlesource.com/6324 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12tests: Move the trietest unit test into base.Gabe Black
This puts it alongside trie.hh, the header file it tests. Change-Id: Id8ca0c1d68bdc01807c5ba4b51c0142b1221385d Reviewed-on: https://gem5-review.googlesource.com/6281 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
2017-12-12tests: Add an implementation of the Logger interface for use gtests.Gabe Black
On exiting log types (panic and fatal), the message is set to an ADD_FAILURE_AT macro, and the test is exited by throwing an otherwise unexpected exception. On non-exiting log types, the message is sent to the SUCCEEDED macro which currently doesn't output anything. Change-Id: I1bb569e6cb8308dbc4c3e04eea7a962bd2b1ddd8 Reviewed-on: https://gem5-review.googlesource.com/6264 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12misc: Rework the logging functions.Gabe Black
Removed the "verbose" switch which wasn't used. Replaced the "get(LogLevel)" function with a get for each level. The parameter was always constant, so we can just call the right function at the right time. Made the "exit" behavior of panic/fatal a part of the logging implementation so that it can be overridden, and corrected a comment which said that both fatal and panic called ::abort(). Got rid of the printEpilogue function by reworking the print() methods. The subclasses of Logger can now override a "log" function which takes a composed message, letting the Logger class centralize how the message is put together and leaving the actual output mechanism to the subclass. Unfortunately there wasn't a way to tell gcc that the panic/fatal macros wouldn't return, so there needed to be an exit_helper wrapper function which calls the actual logger exit function. That can be marked as noreturn, unlike the virtual exit function. If the exit function does return, the wrapper will call ::abort(), placating gcc and ensuring that even if exit isn't implemented properly, exit_helper will still not return. That also provides a handy default implementation. Change-Id: I66d0cebd59f1127db980f3b565dbdf60687d8862 Reviewed-on: https://gem5-review.googlesource.com/6263 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-06base: Split out the pixel class in framebuffer.(cc|hh).Gabe Black
These are really two separate things. Also, while it's realitively straightforward to write a unit test for the pixel conversion code, the framebuffer object is serializable and brings in more dependencies. Change-Id: If954caeb0bfedb1002cfb1a7a115a00c90d56d19 Reviewed-on: https://gem5-review.googlesource.com/6341 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-06base: Handle zero fill in cprintf when printing floats.Gabe Black
The fill_zero flag was being followed for ints, but not for floats. This makes the cprintf unit test pass. Change-Id: I4d17a3c9327aea05e0a3c81be1886c0c9256f03c Reviewed-on: https://gem5-review.googlesource.com/6322 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-04base: Rework the trie dump function to accept a different ostream.Gabe Black
It might often be useful to write output to cout when dumping a trie, but sometimes it might be useful to dump ot to something else like a string stream instead. Change-Id: Iaa4ae772c902b7dbc753f320d1a7eb5fcd4a3db3 Reviewed-on: https://gem5-review.googlesource.com/6266 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04misc: Rename misc.(hh|cc) to logging.(hh|cc)Gabe Black
These files aren't a collection of miscellaneous stuff, they're the definition of the Logger interface, and a few utility macros for calling into that interface (panic, warn, etc.). Change-Id: I84267ac3f45896a83c0ef027f8f19c5e9a5667d1 Reviewed-on: https://gem5-review.googlesource.com/6226 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04misc: Move the ExitLogger class definition into misc.ccGabe Black
This class isn't referred to outside of misc.hh, and isn't necessarily useful outside of the particular logging setup implemented in misc.cc. The Logger class itself is different since it provides a generic interface that can be used with different logging schemes. Change-Id: Ibae926fea039d9e3d75a43d97348bc4a3c5d555e Reviewed-on: https://gem5-review.googlesource.com/6225 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04tests: Remove trietest's dependence on cprintf.Gabe Black
Dumping the structure of the tries being constructed was useful for debugging when the trie data structure was being developed, but the output can't be automatically verified easily, and what's considered correct depends on the specific implementation of the trie itself. To make some of the earlier tests more meaningful, additional lookups were added which verified that the correct values were returned when the nodes of the trie were in particular arrangements. Change-Id: Ib464ad1804d13fe40882da2190d7bf452da83818 Reviewed-on: https://gem5-review.googlesource.com/6223 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-11-28tests: Move the bituniontest to be alongside the bitunion header.Gabe Black
Change-Id: I7c1a49c41672a1108fcf67c5505b0441f90588ef Reviewed-on: https://gem5-review.googlesource.com/6142 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-15arm: Add support for armv8 CRC32 instructionsGiacomo Travaglini
This patch introduces the ARM A32/T32/A64 CRC Instructions, which are mandatory since ARMv8.1. The UNPREDICTABLE behaviours are implemented as follows: 1) CRC32(C)X (64 bit) instructions are decoded as Undefined in Aarch32 2) The instructions support predication in Aarch32 3) Using R15(PC) as source/dest operand is permitted in Aarch32 Change-Id: Iaf29b05874e1370c7615da79a07f111ded17b6cc Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5521 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-10-31vnc: Default image writer type set to AutoGiacomo Travaglini
This commit modifies the default behaviour of the vnc frame dumping process: rather than using 'Bitmap' as a default parameter value, it is using 'Auto'. Auto parameter is letting gem5 to choose the most efficient image format among the available ones. Change-Id: I3c8e2b5a34a5925d24892880ac362dfe38de36e3 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5182 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-10-31base: Introducing utility for writing raw data in png formatGiacomo Travaglini
Originally it was possible to use a Bitmap writer class for dumping a framebuffer snapshot in a .bmp file. This patch enables you to choose another format. In particular it implements the writing of PNG Images using libpng library. The latter has to be already installed in your machine, otherwise gem5 will default to the Bitmap format. This configurable writer has been introduced in the VNC frame dumping mechanism, which is storing changed frame buffers from the VNC server Change-Id: Id7e5763c82235f1ce90381c8486b85a7cce734ce Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5181 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-10-30base: Fix forcing loopback only binding for listeners.Gabe Black
Despite online documentation, the type used for sin_addr.s_addr is not actually an unsigned long, it is an in_addr_t. When an unsigned long is a 64 bit value, the endian conversion moves the relevant bits of the 32 bit in_addr_t to positions which are truncated away. This forces the value to 0 which means to bind to any interface, the opposite of the intended effect. Change-Id: I53c63dea6bd88144dfef1a9a49b478fab30a8ba2 Reviewed-on: https://gem5-review.googlesource.com/5301 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-10-20base: Function for mirroring bits in variable length wordGiacomo Travaglini
This patch introduces a high-speed template function for mirroring the bits (MSB=>LSB) in a variable length word. The function is achieving high performances since it is using a look-up table. Change-Id: Ib0d0480e68d902f25655f74d243de305103eff75 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5261 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-10-20base: Defining make_unique for C++11Giacomo Travaglini
std::make_unique is not available for C++11 compilers, and it has been introduced only in C++14. Since gem5 is not officially supporting the latter at the moment, this patch allows to use it in gem5 if including base/compiler.hh. If compiled under C++14, std::make_unique will be used instead. Change-Id: Ibf1897fad0a1eb1cb0c683cc25170feaa6841997 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5201 Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-08-02base: Give more information when setting up asynchronous IO fails.Gabe Black
When asynchronous IO fails, gem5 currently just says it failed and quits, and doesn't give any more information about which step failed, or what specifically about it failed. This change adds two helpers which will attempt the fcntl, check for error conditions, and in the event of a failure, include a message describing the error code and what the arguments to fcntl were. Change-Id: I316478172ab2aefd3788279dbc12744791385cd5 Reviewed-on: https://gem5-review.googlesource.com/4320 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-07-12sim, gdb: Refactor some Event subclasses into lambdasSean Wilson
Change-Id: If3e4329204f27eda96b50ec6ac279ebc6ef23d99 Signed-off-by: Sean Wilson <spwilson2@wisc.edu> Reviewed-on: https://gem5-review.googlesource.com/3921 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-07-12cpu, sim: Add param to force CPUs to wait for GDBJose Marinho
By setting the BaseCPU parameter wait_for_dbg_connection, the GDB server blocks during initialisation waiting for the remote debugger to connect before starting the simulated CPU. Change-Id: I4d62c68ce9adf69344bccbb44f66e30b33715a1c [ Update info message to include remote GDB port, rename param. ] Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3963 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
2017-06-13ruby: Add support for address ranges in the directoryNikos Nikoleris
Previously the directory covered a flat address range that always started from address 0. This change adds a vector of address ranges with interleaving and hashing that each directory keeps track of and the necessary flexibility to support systems with non continuous memory ranges. Change-Id: I6ea1c629bdf4c5137b7d9c89dbaf6c826adfd977 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2903 Reviewed-by: Bradford Beckmann <brad.beckmann@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-06-03base: misc: Include cstdlib in base/misc.hh.Gabe Black
Some of the macros, notably panic, uses exit(). Callers shouldn't have to know that or have coincidentally included cstdlib, the provider of exit, themselves. Change-Id: I634602ed1795dcc8897b4bddb1167c96763acc18 Reviewed-on: https://gem5-review.googlesource.com/3601 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-19base, sim, arch: Fix clang 5.0 warningsAndreas Sandberg
Compiling gem5 with recent version of clang (4 and 5) triggers warnings that are treated as errors: * Global templatized static functions result in a warning if they are not used. These should either be declared as static inline or without the static identifier to avoid the warning. * Some templatized classes contain static variables. The instantiated versions of these variables / templates need to be explicitly declared to avoid a compiler warning. Change-Id: Ie8261144836e94ebab7ea04ccccb90927672c257 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3420 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-18base: Refactor the GDB code.Gabe Black
The new version modularizes the implementation of the various commands, gets rid of dynamic allocation of the register cache, fixes some small style problems, and uses exceptions to simplify error handling internal to the GDB stub. Change-Id: Iff3548373ce4adfb99106a810f5713b769df89b2 Reviewed-on: https://gem5-review.googlesource.com/3280 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Boris Shingarov <shingarov@gmail.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-12base: Make the VNC server more resilient.Gabe Black
If the client does something bad, don't kill the whole simulation, just complain, drop the client and keep going. Change-Id: I824f2d121e2fe03cdf4323a25c192b68e0370acc Reviewed-on: https://gem5-review.googlesource.com/3200 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-12misc: Make the remote GDB stub more resilient to bad connections.Gabe Black
Currently, if the remote gdb stub fails to read a byte from an incoming packet because the connection has been dropped, the read call will return anyway and the calling code will have no way to know something bad happened. It might reattempt the read over and over again waiting for some particular byte, doomed to never make forward progress. This change modifies the remote GDB code so that if a read or write call fails, it will instead detach from the debugger and continue. Before this change, When simulating a port scan, ie connecting to the debugger port and then immediately dropping the connection using this command: nc -v -n -z -w 1 127.0.0.1 7000 gem5 would enter the previously described death spiral. After it, gem5 detaches from the bad connection and resumes execution. Subsequently attaching with gdb was successful. This code is written in a C centric style, and would benefit from some refactoring. Change-Id: Ie3c0bb35b9cfe3671d0f731e3907548bae0d292f Reviewed-on: https://gem5-review.googlesource.com/3180 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-09base: Teach the socket listeners how to bind to the loopback.Gabe Black
The loopback device will allow access to various services like remote GDB debugging, connecting to the terminal, etc., without letting external agents like port scanners connect and disrupting the simulation. Change-Id: I76dccbf152fa278ae9f342b25f7e345a1329fbe4 Reviewed-on: https://gem5-review.googlesource.com/3080 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-02base, sim, dev: Remove SWIGAndreas Sandberg
Remove SWIG guards and SWIG-specific C++ code. Change-Id: Icaad6720513b6f48153727ef3f70e0dba0df4bee Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2921 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com>