gem5.git
4 years agobase: Convert the annotation methods to take actual arguments.
Gabe Black [Sat, 28 Dec 2019 09:02:55 +0000 (01:02 -0800)]
base: Convert the annotation methods to take actual arguments.

Feed the arguments in from the decoder.

Change-Id: Ie2dcd09320a5de02bb91b8743fc643c446e506e7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24114
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
4 years agoarm,kern: Use GuestABI to call printk from the kernel.
Gabe Black [Sat, 28 Dec 2019 07:38:50 +0000 (23:38 -0800)]
arm,kern: Use GuestABI to call printk from the kernel.

Change-Id: I07b0f1c01f5ec8d6761903fa4aa15b9e8ae35069
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24113
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
4 years agoarm: Use a non-template indexed version of laneView in aapcs32.
Gabe Black [Wed, 18 Mar 2020 21:29:17 +0000 (14:29 -0700)]
arm: Use a non-template indexed version of laneView in aapcs32.

The lane number is constant over its lifetime, but is computed with a
variable i which is not a compile time constant. It therefore can't be
used as a template parameter, and should be marked as const and not
constexpr.

Change-Id: Ie0b950311495831d5224a8fb397cf42d5cf5f25b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26834
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoutil: Add a script to help build cross compilers.
Gabe Black [Sun, 15 Mar 2020 10:17:32 +0000 (03:17 -0700)]
util: Add a script to help build cross compilers.

Cross compilers are very useful when working with gem5. The how-to this
script is based on assumed the compiler was targeting linux, so there
isn't any support for compilers targeting other or no OS. That might be
possible to add in the future.

Change-Id: I2cb30ecbdd4c6292146ea64940348c24385046f9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26763
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Add --bin-path option to insttest regressions
Giacomo Travaglini [Mon, 9 Mar 2020 10:17:45 +0000 (10:17 +0000)]
tests: Add --bin-path option to insttest regressions

Change-Id: I229f37782b1c3650dc71ee481823b41f6f67e590
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26483
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
4 years agoarch-arm: Fix ArmSystem::_resetAddr evalutation
Giacomo Travaglini [Fri, 13 Mar 2020 11:30:10 +0000 (11:30 +0000)]
arch-arm: Fix ArmSystem::_resetAddr evalutation

With:

https://gem5-review.googlesource.com/c/public/gem5/+/26466

The ArmSystem reset address (_resetAddr) is always forced by the
workload:

 _resetAddr = workload->entry

So there is no possibility to manually specify a reset address.

This was not the case before:
The resetAddr was forced only if auto_reset_addr was true or if there
was an associated bootloader to the kernel image. In that case even if
auto_reset_addr was false, the reset address was determined by the
bootloader entry.
This was also not ideal (but it was working)

This patch is cleaning all of this:

If you want to have automatic detection (recommended), you would need to
set auto_reset_addr (now turned to true by default).  This will allow to
keep most fs script untouched.  If you don't want to use automatic
detection, set auto_reset_addr to False and provide your own reset
address.

Change-Id: I5d7a55fd9060b9973c7d5b5542bd199950e1073e
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26723
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
4 years agodev-arm: SMMUv3, single interconnect attachment
Adrian Herrera [Wed, 12 Feb 2020 10:50:32 +0000 (10:50 +0000)]
dev-arm: SMMUv3, single interconnect attachment

The attachment (port binding) of the SMMUv3 master and control
ports is independent of the connection of device masters to it.

This behaviour is now moved from SMMUv3::connect to
RealView::attachSmmu, as it is a responsibility of the Platform
designer.

This fixes crashes when connecting multiple device masters.

Change-Id: If1e8f55d51876fe761f881e3044ffec637c21b09
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26923
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
4 years agosim-se: Implement Virtual Memory Area API
Matthew Poremba [Tue, 11 Feb 2020 23:46:16 +0000 (15:46 -0800)]
sim-se: Implement Virtual Memory Area API

Virtual memory areas are used to track regions of memory which may
change over the course of execution, such as heap, stack, and mmap. It
is a high-level mimicry of Linux' memory management. VMAs are intended
to be used to support lazy allocation of physical pages to valid VMAs
as the virtual addresses are touched. Lazy allocation increases speed
of simulation for SE mode processes which, for example, mmap large
files.

The VMAs can also be queried to generate a map of the process' memory
which is used in some libraries such as pthreads.

This changeset only adds APIs for virtual memory areas. These are used
in a subsequent changeset.

Change-Id: Ibbdce5be79a95e3231d2e1c9ee8f397b4503f0fb
Signed-off-by: Brandon Potter <Brandon.Potter@amd.com>
Signed-off-by: Michael LeBeane <Michael.Lebeane@amd.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25365
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem: Add a Request::Flags parameter to the translating port proxies.
Gabe Black [Thu, 12 Mar 2020 08:41:56 +0000 (01:41 -0700)]
mem: Add a Request::Flags parameter to the translating port proxies.

These flags will be given to the Request object which is used to do the
translation.

Change-Id: I21755f5f9369311e2f2d5be73ebd4f5865f73265
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26623
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarch,base,cpu,dev,kern,mem,sim: Drop FS from FSTranslatingPortProxy.
Gabe Black [Tue, 10 Mar 2020 00:11:22 +0000 (17:11 -0700)]
arch,base,cpu,dev,kern,mem,sim: Drop FS from FSTranslatingPortProxy.

This translating proxy can be used in FS, or in SE with a failure
handing case in place.

Change-Id: I2e6421f52529fa833e42f8d3e64d4341c282634f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26551
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarch,cpu,mem,sim: Reimplement the SE translating proxy using the FS one.
Gabe Black [Mon, 9 Mar 2020 23:50:32 +0000 (16:50 -0700)]
arch,cpu,mem,sim: Reimplement the SE translating proxy using the FS one.

The only functional difference between them was that the SE one might
have optionally fixed up missing translations for demand paging.

This lets us get rid of some code recreating the proxy ports in
setProcessPtr since the SE translating port no longer keeps a copy of
the process object pointer.

Change-Id: Id97df1874f1de138ffd4f2dbb5846dda79d9e4ac
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26550
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosparc: Make translateFunctional ignore alignment and use the page tables.
Gabe Black [Wed, 18 Mar 2020 03:24:18 +0000 (20:24 -0700)]
sparc: Make translateFunctional ignore alignment and use the page tables.

translateFunctional might be used with unaligned addresses which should
be allowed in that context. Also, in SE mode, if the translation isn't
in the TLB itself, then it should be looked up in the SE mode fake page
tables and not in a page table resident in memory.

Change-Id: Ibb39685cfdcd4eb6cb8a0486a1de014a4e452518
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26831
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch: Eliminate vtophys and its switching header file.
Gabe Black [Wed, 4 Mar 2020 11:08:52 +0000 (03:08 -0800)]
arch: Eliminate vtophys and its switching header file.

This function is no longer used anywhere in gem5.

Small helper functions which had been put alongside vtophys on ARM and
RISCV were also moved into src/arch/arm/remote_gdb.cc and
src/arch/power/pagetable.hh, the only places they were used.

Change-Id: Iba72f6c4b797a35a785a5bb781d602c943541fa7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26234
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem: Make the FSTranslatingPortProxy stop using vtophys.
Gabe Black [Wed, 4 Mar 2020 10:56:57 +0000 (02:56 -0800)]
mem: Make the FSTranslatingPortProxy stop using vtophys.

That was the only place vtophys was still being used. Instead, use the
data TLB to translate functional, and if that fails try the the
instruction TLB.

Change-Id: Ie5e1e1b5d470f010e25482d785f111dc4292db60
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26233
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Demote PCEvent subclass pointers to PCEvent pointers.
Gabe Black [Fri, 27 Dec 2019 22:09:17 +0000 (14:09 -0800)]
arm: Demote PCEvent subclass pointers to PCEvent pointers.

Nothing is actually accessed through these pointers. This simplifies
their declration, and gives more flexibility when setting up those
events.

Change-Id: If857de5c8df37b6ead7eae53e3c0c6c3103938c0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24112
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
4 years agoriscv: Implement translateFunctional.
Gabe Black [Wed, 11 Mar 2020 01:14:56 +0000 (18:14 -0700)]
riscv: Implement translateFunctional.

Change-Id: Ibe8adea8f66c7de22ee2ab0da54e866cd05fc257
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26547
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch,kern: Rename some function events to have better names.
Gabe Black [Fri, 13 Mar 2020 10:44:43 +0000 (03:44 -0700)]
arch,kern: Rename some function events to have better names.

Rename many of the Event classes to have more succinct or
consistent names, and fix various style issues.

Change-Id: Ib322da31d81e7a245a00d21786c2aa417c9f2cde
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26703
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Use relative path for python3 compliance
jiegec [Sun, 15 Mar 2020 06:38:07 +0000 (14:38 +0800)]
tests: Use relative path for python3 compliance

Change-Id: Ie18c52982e2083d0fc2723147f2493b39bcb3786
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26743
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agobase: Do not treat addresses < 10 specially
Boris Shingarov [Sun, 8 Mar 2020 19:46:05 +0000 (15:46 -0400)]
base: Do not treat addresses < 10 specially

The RSP stub (base/remote_gdb.cc) treats virtual addresses below 0x000A as
meaning "the address used in the previous m-packet".  This leads to nasty
surprises, and is not justified by neither the RSP protocol documentation
nor other existing RSP implementations.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-407

Change-Id: I5fccc10a58d9af856eeee6d45418905c0f47ffab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26605
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
4 years agotests: Increased Kokoro's timeout to 5 hours
Bobby R. Bruce [Tue, 17 Mar 2020 17:08:28 +0000 (10:08 -0700)]
tests: Increased Kokoro's timeout to 5 hours

Change-Id: Ice9fc5f17dfa06f61bc5583ecca15c54742bc254
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26843
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Removed old scon-based 40.m5threads-test-atomic tests
Bobby R. Bruce [Wed, 26 Feb 2020 01:38:15 +0000 (17:38 -0800)]
tests: Removed old scon-based 40.m5threads-test-atomic tests

These have been migrated to be run via testlib.

Change-Id: I186e4048096f718c0de378033924cd23328168d7
Jira: https://gem5.atlassian.net/browse/GEM5-109
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25843
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Migrated 40.m5threads-test-atomic scons tests to testlib
Bobby R. Bruce [Wed, 26 Feb 2020 00:10:25 +0000 (16:10 -0800)]
tests: Migrated 40.m5threads-test-atomic scons tests to testlib

At present, the 40.m5threads-test-atomic tests fail as the SPARC binary
(generated from `tests/test-progs/pthread/src/test_atomic.cpp`) is not
present. This has been noted in:
https://gem5.atlassian.net/browse/GEM5-368

Change-Id: I7865826388be46cec06a201712081146a58518f2
Jira: https://gem5.atlassian.net/browse/GEM5-109
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25824
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests,arch-alpha: Removing ALPHA ISA from testlib config
Bobby R. Bruce [Mon, 16 Mar 2020 21:47:00 +0000 (14:47 -0700)]
tests,arch-alpha: Removing ALPHA ISA from testlib config

Change-Id: Icded5f4aec7bc212a818a97c4de5d7b8f8757121
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26823
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agokern,arch: Refactor SkipFuncEvent to not use skipFunction.
Gabe Black [Fri, 27 Dec 2019 00:49:11 +0000 (16:49 -0800)]
kern,arch: Refactor SkipFuncEvent to not use skipFunction.

Replace it with a new virtual function.

Change-Id: I9d516d21ab3b1d1d70ea1297f984f868d3e7c3fb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24111
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Implement translateFunctional.
Gabe Black [Sat, 7 Mar 2020 00:38:22 +0000 (16:38 -0800)]
x86: Implement translateFunctional.

This function is based off of vtophys in the full system case, and off
of the page table fill mechanism used in SE mode. It ignores what's
already in the TLB, and also ignores protection mechanisms.

This may need to be reworked in the future if, for instance, pages
still resident in the TLB but not in the page tables need to be
considered, but it should work at least for the time being.

Change-Id: If21701ca36a30805f4199312933a8afc91f20501
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26405
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Migrated 80.dram scons-based tests to testlib framework
Bobby R. Bruce [Thu, 27 Feb 2020 01:49:35 +0000 (17:49 -0800)]
tests: Migrated 80.dram scons-based tests to testlib framework

"configs/dram/low_power_sweep.py" has been modified to keep the
generated "lowp_sweep.cfg" file in "configs/dram". This generated file
is now ignored by git.

Change-Id: I700d04944fee58f8a506c71fd474b84024ec4374
Jira: https://gem5.atlassian.net/browse/GEM5-109
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25923
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in CrossbarSwitch
Daniel R. Carvalho [Sun, 26 Jan 2020 11:38:54 +0000 (12:38 +0100)]
mem-garnet: Use static allocation in CrossbarSwitch

There is no need to dynamically allocate these variables.

Change-Id: I6efeaffe75f2b4ba706c26d2a12c42c07dc7c7ee
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24983
Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use smart pointers in Router's members
Daniel R. Carvalho [Tue, 7 Jan 2020 22:59:43 +0000 (23:59 +0100)]
mem-garnet: Use smart pointers in Router's members

Use smart pointers for the pointers managed by Router, and do
static allocation when possible.

Change-Id: I5fad8b2d17ac7950d478d37000ac80a4d2f68b15
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24248
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in Switch
Daniel R. Carvalho [Wed, 8 Jan 2020 22:30:13 +0000 (23:30 +0100)]
mem-garnet: Use static allocation in Switch

Make pointers non pointers when possible.

Change-Id: I272387c2ac1fd77deef06feb637127e232910e30
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24250
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in NetworkLink
Daniel R. Carvalho [Thu, 9 Jan 2020 21:28:27 +0000 (22:28 +0100)]
mem-garnet: Use static allocation in NetworkLink

Use static allocation to manage NetworkLink's pointers.

Change-Id: I3ab22b1f912f0119448f9013fd0dfff9bf5a6999
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24252
Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in NetworkInterface
Daniel R. Carvalho [Wed, 8 Jan 2020 21:46:23 +0000 (22:46 +0100)]
mem-garnet: Use static allocation in NetworkInterface

Use static allocation for the pointers managed by NetworkInterface.

Change-Id: Ib97d95165337659f92cb8a078020692baae5b5ca
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24247
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in InputUnit
Daniel R. Carvalho [Tue, 7 Jan 2020 22:53:28 +0000 (23:53 +0100)]
mem-garnet: Use static allocation in InputUnit

Use static allocation for the pointers managed by InputUnit.

Change-Id: I3eab42c6c08b1a519b9b55de26e820bad2ef03c4
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24245
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in OutputUnit
Daniel R. Carvalho [Tue, 7 Jan 2020 22:44:08 +0000 (23:44 +0100)]
mem-garnet: Use static allocation in OutputUnit

Use static allocation for the pointers created by OutputUnit.

Change-Id: Ica4fd5d4994078764769702311520c9daf8dba72
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24243
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Use static allocation in VirtualChannel
Daniel R. Carvalho [Thu, 9 Jan 2020 21:33:32 +0000 (22:33 +0100)]
mem-garnet: Use static allocation in VirtualChannel

The input buffer does not need to be dynamically allocated.

Change-Id: Ice64f40d2a7e16af325ddb6803e34b3eed2e99db
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24253
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Remove delete of param pointers of SimpleNetwork
Daniel R. Carvalho [Wed, 8 Jan 2020 22:14:50 +0000 (23:14 +0100)]
mem-garnet: Remove delete of param pointers of SimpleNetwork

All over gem5 the params pointers are not deleted within the classes
that they were created for. Although this is a potential memory leak
as of now, it is probably safer to follow general convention so that
it can be fixed at once in the future.

Change-Id: If96f04058d51513fa8763610880e5524785ee9cf
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24249
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-garnet: Remove delete of param pointers of GarnetNetwork
Daniel R. Carvalho [Wed, 8 Jan 2020 21:35:28 +0000 (22:35 +0100)]
mem-garnet: Remove delete of param pointers of GarnetNetwork

All over gem5 the params pointers are not deleted within the classes
that they were created for. Although this is a potential memory leak
as of now, it is probably safer to follow general convention so that
it can be fixed at once in the future.

Change-Id: I74b662a8e635cdfb4dc1eae732dd114659fab2e9
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24246
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agobase: Add static assert to trie
Daniel R. Carvalho [Tue, 10 Mar 2020 08:58:07 +0000 (09:58 +0100)]
base: Add static assert to trie

Trie is based on the condition that they key is an integral. As so,
add a static_assert to guarantee that. Also, added some general info
about tries to the class.

Change-Id: Idc18f6a685db8047cd44b791f427666d3dd2d187
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26784
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Hook up pread64 in 32/64 bit linux, and pwrite64 in 32 bit.
Gabe Black [Thu, 12 Mar 2020 01:05:32 +0000 (18:05 -0700)]
x86: Hook up pread64 in 32/64 bit linux, and pwrite64 in 32 bit.

My new computer has a dynamic linker which seems to use the pread64
system call, and since that gets pulled in when running tests, that
needs to be implemented for tests to pass on that machine, making it
possible to detect problems the failure might ohterwise mask.

This is only really necessary for 64 bit linux, but while I'm here I
hooked it up for 32 bit linux as well. I also added pwrite64 for 32 bit
linux since that was only enabled for 64 bit.

Change-Id: I8d2061d30e98a1581c5e30b522b6ba12aea20ecd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26604
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Provide an implementation for the pread64 system call.
Gabe Black [Thu, 12 Mar 2020 01:05:25 +0000 (18:05 -0700)]
sim: Provide an implementation for the pread64 system call.

This implementation is very similar to the pwrite64 system call, just
with data going the other direction as you'd expect.

Change-Id: I4f8ec9d83bf2339f9c84e31f25309c58e6157304
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26603
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoconfigs: fix forwarding of --bootloader to fs.py
Ciro Santilli [Fri, 13 Mar 2020 12:45:15 +0000 (12:45 +0000)]
configs: fix forwarding of --bootloader to fs.py

Since I02919207d6f175854017ae7b603d811da63d618e the fs.py --bootloader
option can be used to select a bootloader explicitly.

Ia3d863db276a023b6a2c7ee7a656d8142ff75589 forgot to pass that parameter
likely due to a rebase issue and it gets searched in M5_PATH.

Change-Id: Ic4cf3ccf041e1c34eac7753424fe842bd34a77f9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26724
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Fix regStats for PowerModel and PowerModelState
Giacomo Travaglini [Thu, 12 Mar 2020 16:21:01 +0000 (16:21 +0000)]
power: Fix regStats for PowerModel and PowerModelState

Every Stats::Group need to call the parent regStats to
make sure that the base Stats::Group::regStats() gets
called

JIRA: https://gem5.atlassian.net/projects/GEM5/issues/GEM5-319

Change-Id: I931941d8ec5f375f7e51e719d43ae31af095f661
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26643
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-x86: Add Python 3 workarounds for long
Giacomo Travaglini [Tue, 3 Mar 2020 13:31:47 +0000 (13:31 +0000)]
arch-x86: Add Python 3 workarounds for long

Python 3 doesn't have a separate long type. Make long an alias for int
where needed to maintain compatibility.

This is aligning with https://gem5-review.googlesource.com/c/15988

Change-Id: I20e52d7f796d143534fa7dabeb6ff0ae8b62fd2b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26257
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
4 years agoarch-x86: Fix imports for Python 3 compatibility
Giacomo Travaglini [Tue, 3 Mar 2020 13:26:12 +0000 (13:26 +0000)]
arch-x86: Fix imports for Python 3 compatibility

Change-Id: I7e486a6f3d38af54ac1eff431ca40a5af29e3ca7
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26256
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agotests: Use relative path for python3 compliance
Giacomo Travaglini [Tue, 3 Mar 2020 13:20:27 +0000 (13:20 +0000)]
tests: Use relative path for python3 compliance

Change-Id: I9a45a7800f1b69037781374df86e29bd5eb0f014
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26255
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agoarch: list.sort() sorting by key only in python3
Giacomo Travaglini [Mon, 2 Mar 2020 18:11:30 +0000 (18:11 +0000)]
arch: list.sort() sorting by key only in python3

list.sort() no longer accept a comparison function. Use the key argument
instead for key based sorting.

Change-Id: I2af2732628721faee3870af0d53c1267839896da
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26254
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agodev-arm: Fix VExpressFastmodel.py indentation
Giacomo Travaglini [Mon, 2 Mar 2020 18:10:36 +0000 (18:10 +0000)]
dev-arm: Fix VExpressFastmodel.py indentation

Convert TAB with four spaces

Change-Id: I7472a01423953c68aed60b37f56fe86eca249fac
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26253
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agoarch: Convert exec keyword to exec() function
Giacomo Travaglini [Mon, 2 Mar 2020 15:53:50 +0000 (15:53 +0000)]
arch: Convert exec keyword to exec() function

The function syntax was also accepted in 2.x

Change-Id: I3d9bef3ddcd5e98ff589796d21dbfeb9796bff1d
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26252
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agoarch: Bring closure out of p_global_let
Giacomo Travaglini [Thu, 5 Mar 2020 15:34:34 +0000 (15:34 +0000)]
arch: Bring closure out of p_global_let

The python interpreter might complain when exec() (the function, not the
python2 keyword) is used in a function and the function contains a nested
block.

See: https://www.python.org/dev/peps/pep-0227/

The patch is moving the nested function out of p_global_let.

Change-Id: Idb3a08a8cd42455af1e5ec2c3ec8f8a1438047d3
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26303
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Make exception handling python3 compliant
Giacomo Travaglini [Mon, 2 Mar 2020 15:18:56 +0000 (15:18 +0000)]
misc: Make exception handling python3 compliant

Change-Id: I37d0e97e9762e21c7a0ad315cf7684a19119b5b4
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26251
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Text vs Byte string in python3
Giacomo Travaglini [Mon, 2 Mar 2020 15:16:09 +0000 (15:16 +0000)]
misc: Text vs Byte string in python3

Python 3 uses the concepts of two different types:
text and binary strings.
Those cannot be implicilty combined (as it was happening in python2) and
in order to be used together one of them must be converted to the other
type:

* Text can be encoded into Bytes via the encode() method
* Bytes can be decoded to Text using the decode() method

By default encode/decode will assume UTF-8 format

JIRA: https://gem5.atlassian.net/browse/GEM5-345

Change-Id: I1bdf7db17b49cc109239fd5f44791769370853f8
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26250
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
4 years agoscons: file removed from python3
Giacomo Travaglini [Mon, 2 Mar 2020 15:08:41 +0000 (15:08 +0000)]
scons: file removed from python3

Change-Id: I95794fec5cc9c6e72c9ae53f586052be71436c87
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26249
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Views and Iterators instead of Lists in python3
Giacomo Travaglini [Mon, 2 Mar 2020 14:30:25 +0000 (14:30 +0000)]
misc: Views and Iterators instead of Lists in python3

* dict methods dict.keys(), dict.items() and dict.values()
return "views" instead of lists

* The dict.iterkeys(), dict.iteritems() and dict.itervalues()
methods are no longer supported.

* map() and filter() return iterators.

* range() now behaves like xrange() used to behave, except it works with
values of arbitrary size. The latter no longer exists.

* zip() now returns an iterator.

Change-Id: Id480018239db88d7f5d60588c93719056de4a0c0
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26248
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agodev-arm: Fix setupBootloader for VExpressFastmodel
Yu-hsin Wang [Fri, 13 Mar 2020 04:40:43 +0000 (12:40 +0800)]
dev-arm: Fix setupBootloader for VExpressFastmodel

Previous fix setupBootloader for VExpress_GEM5_V2 didn't include
VExpressFastmodel. Fix it.

Change-Id: Ia720978848660be63bb788ffaf84b60a5b1b5db5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26684
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Fix Arch detection in FS if there is not bootloader
Giacomo Travaglini [Thu, 12 Mar 2020 15:45:33 +0000 (15:45 +0000)]
arch-arm: Fix Arch detection in FS if there is not bootloader

In case a workload is run with no bootloader we still want to be able
to provide the simulation with the correct arch version.
Without this patch every baremetal simulation will default to AArch64, which
is the default value of ArmFsWorkload.

Change-Id: I0f766167d8983cafc1fd30d054862339eb21f73f
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26606
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-ruby: Fix fast-forward when using the backing store.
Yuan Yao [Sun, 23 Feb 2020 22:16:03 +0000 (17:16 -0500)]
mem-ruby: Fix fast-forward when using the backing store.

While the up-to-date data may reside in any agent of Ruby's memory
hierarchy, there's an optional backing store in Ruby that provides
a 'correct' view of the physical memory. When it is enabled by the
user, every Ruby memory access will update this global memory view
as well upon finishing.

The issue is that Ruby's atomic access, used in fast-forward, does
not currently access the backing store, leading to data
incorrectness. More specifically, at the very beginning stage of the
simulation, a loader loads the program into the backing store using
functional accesses. Then the program starts execution with
fast-forward enabled, using atomic accesses for faster simulation. But
because atomic access only accesses the real memory hierarchy, the CPU
fetches incorrect instructions.

The fix is simple. Just make Ruby's atomic access update the backing
store as well as the real physical memory.

Change-Id: I2541d923e18ea488d383097ca7abd4124e47e59b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26343
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Onur Kayıran <onur.kayiran@amd.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Eliminate the MustBeOne ARM specific request flag.
Gabe Black [Wed, 11 Mar 2020 01:33:20 +0000 (18:33 -0700)]
arm: Eliminate the MustBeOne ARM specific request flag.

This flag makes constructing a generic Request object for ARM
impossible, since generic consumers won't know to set that flag to one.

As a principle, Request flags should change the behavior of a request
away from whatever the default/typical behavior is in the current
context, so flags set to zero means no special behavior.

Change-Id: Id606dc0bf42210218e1745585327671a98a8dba4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26546
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agodev-arm: add FVP Base Power Controller model
Adrian Herrera [Fri, 25 Oct 2019 09:49:23 +0000 (10:49 +0100)]
dev-arm: add FVP Base Power Controller model

This is a reduced model of the FVP Base platforms Power Controller.
As of now it allows the following functions from software:
- Checking for core presence
- Reporting the power state of a core / cluster
- Explicitly powering off a core on WFI
- Explicitly powering off cores in a CPU cluster on WFI
- Explicitly powering on a core through writes to PPONR register

Change-Id: Ia1d4d3ae8e4bfb2d23b2c6077396a4d8500e2e30
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26463
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Rewrite getMPIDR
Adrian Herrera [Tue, 10 Dec 2019 17:21:18 +0000 (17:21 +0000)]
arch-arm: Rewrite getMPIDR

This patch is rewriting getMPIDR to have a more canonical form:

* Using threadId() instead of contextId()

It is also splitting the helper so that a client can get an affinity
number given a specific thread context.

Change-Id: I727e4b96ada345fd548cd3ff9423bf27347812c4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26304
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>

4 years agokern: Minor style cleanup in the base SkipFuncEvent class.
Gabe Black [Wed, 25 Dec 2019 20:43:28 +0000 (12:43 -0800)]
kern: Minor style cleanup in the base SkipFuncEvent class.

Change-Id: I0f4efb825b0611d3bab5a429fd36d28a178f86b9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24110
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Implement the AAPCS32 ABI.
Gabe Black [Mon, 23 Dec 2019 04:06:51 +0000 (23:06 -0500)]
arm: Implement the AAPCS32 ABI.

Change-Id: I63b2ec586146163642392f5164fb01335d811471
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24108
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rename GuestABI's Position to State.
Gabe Black [Mon, 23 Dec 2019 06:54:14 +0000 (22:54 -0800)]
sim: Rename GuestABI's Position to State.

This type can hold any generic state related to locating return types
and arguments in addition to simple position information. To make that
clearer, this change renames the Position type to State.

Change-Id: I50ff2ec61c3eba0e9505c66ce32e27b515bd4b27
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24107
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rename allocate in GuestABI to prepare.
Gabe Black [Mon, 23 Dec 2019 06:00:46 +0000 (22:00 -0800)]
sim: Rename allocate in GuestABI to prepare.

This method can be used for allocating resources for registers and/or
arguments, but it can also be used for generic preparation for them
as well. For instance, it can be used to detect some sort of property
of the function signature as a whole (if it's variadic for instance)
which can be stored in position and used to change ABI behavior.

Change-Id: I8a090be65dc4987e35cd115562114cd1b748155f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24106
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Optionally pass "position" to GuestABI::Result::store.
Gabe Black [Sun, 22 Dec 2019 08:59:46 +0000 (03:59 -0500)]
sim: Optionally pass "position" to GuestABI::Result::store.

This will let it get at information about the signature as a whole.

Also, put result storing and argument getting behind functions to hide
some of the templating involved in those mechanisms.

Change-Id: Ib9f26ff69495f8891435f68d3d2f9dfa761a0274
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24105
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Split up the guest_abi.hh header.
Gabe Black [Sat, 21 Dec 2019 05:42:43 +0000 (21:42 -0800)]
sim: Split up the guest_abi.hh header.

This header was getting pretty long, and could be broken up into a few
headers which logically grouped related definitions and concepts.

To maintain compatibility and keep things simple for users of the
mechanism, there is still a top level header with the original name
which defines the interface for using ABIs. It includes all the other
new headers, and so can also be used when defining ABIs.

Change-Id: I62a051b9bd982e0fcecfceeb3d658d1ff4d30c5e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24104
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Generalize the GuestABI Result::allocate() mechanism.
Gabe Black [Sat, 21 Dec 2019 05:04:19 +0000 (21:04 -0800)]
sim: Generalize the GuestABI Result::allocate() mechanism.

This change generalizes the GuestABI Result template family's
allocate() mechanism so that it can also be used with arguments. This
is useful in cases like the 32 bit ARM ISA which says that variadic
functions treat their floating point arguments differently than
non-variadic functions do. This mechanism will give the ABI a chance
to detect that the function is variadic (by checking for VarArgs) and
then to behave differently in that case.

This also makes the GuestABI mechanism a little more regular by
supporting allocate() on both arguments and return values instead of
just return values.

Change-Id: I67050a0ad7ccf15ee75b800dca4eae4fdc0e564e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24103
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Implement the AAPCS64 ABI.
Gabe Black [Tue, 17 Dec 2019 06:27:12 +0000 (22:27 -0800)]
arm: Implement the AAPCS64 ABI.

This implementation has been tested a tiny bit by intercepting a call
which passed an argument of this type to a function.

struct Test
{
    int32_t a;
    float *b;
};

The gem5 intercept printed out the value of a, the value of b, and the
value of the float it pointed to.

I was able to get things to work by commenting out the panic in
fixFuncEventAddr and making it return its argument unmodified, and by
calling addFuncEvent instead of addKernelFuncEvent which injects the
kernel symbol table. I substitured the Process's debugSymbolTable which
had the right symbols.

Note that this implementation is not completely correct. First of all,
I used a dummy type in place of the Short Vector type which is just
a byte array with the appropriate alignment forced on it. It sounds
like this type would be something the compiler would need an intrinsic
and architecture specific type for to behave correctly, and so in
gem5 we'd have to define our own type for ARM which could feed in here.

Also, strictly speaking, it sounds like HVA and HFA category of types,
the Homogeneous Short-Vector Aggregates and Homogeneous Floating-point
Aggregates, are supposed to apply to any type which is an aggregate of
all the same type (short vector for one, floating point for the other)
with 4 or fewer members.

In this implementation, I capture any *array* of 4 or fewer elements of
the appropriate type as an HVA or HFA, but I believe these structures
would also count and are not included in my implementation.

struct {
    float a;
    float b;
    float c;
};

struct {
    ShortVector a;
    ShortVector b;
};

This only matters if those sorts of structures are passed by value as
top level arguments to a function, ie they are not included in some
larger structure.

Also, rule B.6 talks about what to do with an "aignment adjusted type",
and I have no idea what that's supposed to be. Those may not be handled
correctly either.

Change-Id: I5a599a03d38075d7c0a06988c05e7fb5423c68c0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23751
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agokern: Stop using a pseudo instruction to quiesce the ThreadContext.
Gabe Black [Thu, 12 Dec 2019 04:17:39 +0000 (20:17 -0800)]
kern: Stop using a pseudo instruction to quiesce the ThreadContext.

The pseudo instruction implementation is very short, and so doing the
work it was doing directly doesn't really add much to the
implementation of the udelay events. By not calling the pseudo
instruction we also uncouple these unrelated mechanisms and don't,
for instance, cause pseudo instruction debug output every time udelay
executes.

Change-Id: I5c9b32509562487e53b2acfa1a3f6226d33d1cfd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23748
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Delete the unused onKvmExitHypercall method.
Gabe Black [Wed, 11 Dec 2019 02:56:46 +0000 (18:56 -0800)]
arm: Delete the unused onKvmExitHypercall method.

The KVM_EXIT_HYPERCALL KVM exit is now unused, and so even if this
exit handler was plumbed to receive these exits, they would probably
never come.

Change-Id: Ic3ecc789102e761a6dbe80caaf57d61dd95f70a6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23746
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarch,sim: Get rid of the now unused setSyscallReturn method.
Gabe Black [Tue, 10 Dec 2019 00:59:01 +0000 (16:59 -0800)]
arch,sim: Get rid of the now unused setSyscallReturn method.

Change-Id: I61741ab2eca4c77a2c8884e2b5c328479e2b3c90
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23505
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Use the new returnInto method in cloneFunc.
Gabe Black [Tue, 10 Dec 2019 00:58:25 +0000 (16:58 -0800)]
sim: Use the new returnInto method in cloneFunc.

This gets rid of the final use of setSyscallReturn.

Change-Id: I1108df0c5c72b5dec60128dced48ac0fd0356d24
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23504
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Add a returnInto function to the SyscallDesc class.
Gabe Black [Tue, 10 Dec 2019 00:55:36 +0000 (16:55 -0800)]
sim: Add a returnInto function to the SyscallDesc class.

This method lets system call implementations return values into
ThreadContexts other than the one they were called from. That's useful
for, for instance, clone() which creates new ThreadContexts.

By making it a virtual function in the SyscallDesc, we can delegate the
actual implementation to the SyscallDescABI subclass which knows the
ABI and how to use it to set the return value.

Change-Id: I61c6e60e4c2a8863c885cd818e4ff053fc3312ee
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23503
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Get rid of the now unused getSyscallArg method.
Gabe Black [Sun, 8 Dec 2019 09:52:06 +0000 (01:52 -0800)]
sim: Get rid of the now unused getSyscallArg method.

Change-Id: I2f78420d8687da7530feb66784fe3e6d2357baf8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23462
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rework the SyscallDesc to use the dumpSimcall mechanism.
Gabe Black [Sun, 8 Dec 2019 09:36:05 +0000 (01:36 -0800)]
sim: Rework the SyscallDesc to use the dumpSimcall mechanism.

This greatly simplifies the doSyscall method, removes a use of
getSyscallArg, and will only print arguments the target syscall is
going to use.

Change-Id: Id8c9c995a2506468fd99fd865f2eb31c40db8b55
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23461
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Get rid of the no longer needed DefaultSyscallABI.
Gabe Black [Sun, 8 Dec 2019 04:54:07 +0000 (20:54 -0800)]
sim: Get rid of the no longer needed DefaultSyscallABI.

All ISAs now have their own ABI definitions.

Change-Id: I20484b024227658bed7093c232ebf7d64f29bdb6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23458
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Convert the various flavors of pipe to GuestABI.
Gabe Black [Sat, 7 Dec 2019 11:31:58 +0000 (03:31 -0800)]
sim: Convert the various flavors of pipe to GuestABI.

Change-Id: I44aaff417ea6a3ce311208b084fe4013bb93a48e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23457
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim,gpu: Make ioctl unconditionally take an address parameter.
Gabe Black [Sat, 7 Dec 2019 11:43:46 +0000 (03:43 -0800)]
sim,gpu: Make ioctl unconditionally take an address parameter.

The definition of ioctl is not actually variadic, it just doesn't
specify what the type of the pointer is that it takes as its third
argument. The man page says that that's because it predates void *
being valid C.

By passing this address around (even if it's unused), we avoid having
to extract system call arguments further down the call stack.

Change-Id: I62541237baafaec30bbe3df06b3284dd286a4051
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23456
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Clean up some constants used in some syscalls.
Gabe Black [Sat, 7 Dec 2019 11:35:39 +0000 (03:35 -0800)]
sim: Clean up some constants used in some syscalls.

Having readable constants for these large numbers is good, but they
used incorrect style, were at global scope, and were only used in one
place.

This change centralizes them where they're used, fixes their style, and
rewrites the actual constants in a way that makes it clear what they're
values are.

Change-Id: Ib89c46fce133d4180296d384a61d51d1fe1f8d20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23455
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Convert ftruncate64 to GuestABI.
Gabe Black [Sat, 7 Dec 2019 11:23:18 +0000 (03:23 -0800)]
sim: Convert ftruncate64 to GuestABI.

This function was specifying a particular width to getSyscallArg. The
new ISA specific ABIs now handle that automatically.

Change-Id: I141655d3bcb78f56c2a9278d140dfbc0d69e1ff4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23454
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoriscv: Use a riscv specific GuestABI for riscv system calls.
Gabe Black [Sun, 8 Dec 2019 04:52:09 +0000 (20:52 -0800)]
riscv: Use a riscv specific GuestABI for riscv system calls.

Change-Id: Ia6ac34dfb38b71eff7b573b3c9ce477fef0ef5f7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23453
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Use a power specific GuestABI for power system calls.
Gabe Black [Sun, 8 Dec 2019 04:13:50 +0000 (20:13 -0800)]
power: Use a power specific GuestABI for power system calls.

Change-Id: I39cf64c025c284b63980f3c2e48fbd8b6c355d2b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23452
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomips: Use a mips specific GuestABI for mips system calls.
Gabe Black [Sun, 8 Dec 2019 04:03:28 +0000 (20:03 -0800)]
mips: Use a mips specific GuestABI for mips system calls.

Change-Id: Ice9fb867b47e56bc00b171399a82b2892b16c9e4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23451
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Remove the get*PseudoFunc handlers.
Gabe Black [Sun, 8 Dec 2019 02:14:11 +0000 (18:14 -0800)]
sim: Remove the get*PseudoFunc handlers.

These were used in Alpha which has been removed.

Change-Id: I801ef71972b0c3d2aa04d682a3a94acfb27ac7ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23449
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Use an ARM specific GuestABI for ARM system calls.
Gabe Black [Sat, 7 Dec 2019 15:28:14 +0000 (07:28 -0800)]
arm: Use an ARM specific GuestABI for ARM system calls.

Change-Id: I2d0d0a563355f43ed791ba2f2a1894e303cca994
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23448
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Use a SPARC specific GuestABI for system calls.
Gabe Black [Sat, 7 Dec 2019 11:07:43 +0000 (03:07 -0800)]
sparc: Use a SPARC specific GuestABI for system calls.

Change-Id: I41996cada5ccde7b265e5315829ac6690da8902f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23447
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Introduce a BitUnion for the CCR register.
Gabe Black [Sat, 7 Dec 2019 10:37:50 +0000 (02:37 -0800)]
sparc: Introduce a BitUnion for the CCR register.

This avoids opaque masks when accessing fields of this register.

Change-Id: If20d82c7c6401e6b1b35bb6d2c69542a56e2fb45
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23446
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Introduce constants for pseudo integer registers.
Gabe Black [Sat, 7 Dec 2019 10:12:53 +0000 (02:12 -0800)]
sparc: Introduce constants for pseudo integer registers.

These are "integer" registers which are renamed, but which aren't
normally considered integer registers by the ISA. They had been indexed
by adding an opaque constant to the number of official integer
registers which obscured what they were, and was also fragile and
invited mistakes.

Change-Id: Idab8cf4d889682b98c7c81a00d9a92d8e3bb3a05
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23445
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Get rid of some commented out constants.
Gabe Black [Sat, 7 Dec 2019 09:30:23 +0000 (01:30 -0800)]
sparc: Get rid of some commented out constants.

Change-Id: Ie2a223f5f969402a03b924ef767eddbcc14bf312
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23444
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Define a local ABI for system calls.
Gabe Black [Sat, 7 Dec 2019 01:46:38 +0000 (17:46 -0800)]
x86: Define a local ABI for system calls.

These ABIs (one 32 bit and one 64 bit) take advantage of the
GenericSyscallABI and X86Linux::SyscallABI partial ABIs set up earlier.

This removes x86's dependence on the getSyscallArg and setSyscallReturn
Process methods.

Change-Id: Ia07834cea1afa827d77e590af5397e2a1e0e2099
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23443
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: In X86 linux, system calls simply return their result in a register.
Gabe Black [Sat, 7 Dec 2019 01:41:13 +0000 (17:41 -0800)]
x86: In X86 linux, system calls simply return their result in a register.

We can partially define an x86 linux system call ABI which handles the
return value. Argument gathering would be handled elsewhere.

Change-Id: Id2841dea39aa2ea3fc42e1a0fb70ff4e477b3671
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23442
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Add GenericSyscallABI structs which can be used by the ISAs.
Gabe Black [Sat, 7 Dec 2019 01:42:58 +0000 (17:42 -0800)]
sim: Add GenericSyscallABI structs which can be used by the ISAs.

It's very common for system call arguments to be passed in a sequence
of registers, one argument per register. To avoid having that
implementation repeated over and over across the various ISAs and OSes,
these partial ABI implementations provide that mechanism they can just
pull in. They would need to define the sequence of registers to use,
and these would take care of the rest.

Unlike the temporary DefaultSyscallABI which defers to the Process
classes, these read registers from the ThreadContext directly.

Change-Id: Ic72eb8d784ecf4711b5eec76d958a87c70850fce
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23441
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Make SyscallReturn handle extra/"pseudo" return registers.
Gabe Black [Sun, 8 Dec 2019 01:45:44 +0000 (17:45 -0800)]
sim: Make SyscallReturn handle extra/"pseudo" return registers.

Avoid special casing them in the system calls themselves.

Change-Id: I735f8e6fdff164c66e3f1386aed3fc9b107ea45f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23440
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomips: Convert MIPS specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:05:34 +0000 (00:05 -0800)]
mips: Convert MIPS specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I7e7c49e885a8c3395f2e6ca361c228bce3691dbe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23205
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Convert POWER specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:05:09 +0000 (00:05 -0800)]
power: Convert POWER specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Icdf41a0e2bf910813250249eff7a9f1b54c60b22
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23204
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Convert SPARC specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:04:36 +0000 (00:04 -0800)]
sparc: Convert SPARC specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I144fc3fb0e408380294ea91fefa881494f44098b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23203
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoriscv: Convert RISCV specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:04:54 +0000 (00:04 -0800)]
riscv: Convert RISCV specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I1a7041ba890f5f69d5506583c658ae6a777b5daf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23202
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Convert x86 specific syscalls to GuestABI.
Gabe Black [Thu, 28 Nov 2019 08:04:16 +0000 (00:04 -0800)]
x86: Convert x86 specific syscalls to GuestABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I2ad9c0ac72eb875f30ece27d58549244de84e191
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23201
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Convert ARM specific syscalls to GuestABI.
Gabe Black [Thu, 28 Nov 2019 07:53:28 +0000 (23:53 -0800)]
arm: Convert ARM specific syscalls to GuestABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I1055b72f34ea9e0bcce465492bd45b6fb0c36eef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23200
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Remove ISA specific KVM handling of the return from clone.
Gabe Black [Thu, 28 Nov 2019 07:07:34 +0000 (23:07 -0800)]
sim: Remove ISA specific KVM handling of the return from clone.

When the new thread context ctc is created, it should have a copy of
all the state in the original tc, including the original PC. This code
used to specially handle the KVM case by explicitly making this new
context return from the system call immediately by jumping right to
RCX which (assuming a particular instruction was used) is where user
mode should resume.

The first problem with this approach as far as I can tell is that the
CPU will still be in CPL0, ie supervisor mode, and will not have been
forced back into CPL3, ie user mode. This may not have any immediately
visible effect, but may down the line.

Second, this seems unnecessary. The non-special case code will advance
the PC beyond the instruction which triggered the system call. Then
once the new thread starts executing again, it will execute sysret and
return to rcx naturally, just like the original thread will.

The only observed difference is that when executing a gem5 instruction,
the IP is set to the currently executing instruction, and so to avoid
the new context from re-executing the system call, the PC needs to be
advanced. When calling in from KVM, the instruction has already been
"completed", and so the IP should *not* be advanced.

Also note that when reading the PCState object in KVM, it doesn't
figure out where the next instruction is and so NPC is just one
ExtMachInst sized blob later on. Advancing the PC will just move to
an address 8 bytes later, which is very unlikely to be what you want.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I0d97f66e64ce39b13d6700dcf3d7da88d6fe0048
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23199
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch,sim: Convert clone to GuestABI and define a cloneBackwardsFunc.
Gabe Black [Thu, 28 Nov 2019 07:03:14 +0000 (23:03 -0800)]
arch,sim: Convert clone to GuestABI and define a cloneBackwardsFunc.

cloneBackwardsFunc takes its arguments in the order specified for
ARM and RISCV. Because of the new GuestABI mechanism, it can be a
simple wrapper around the normal clone implementation without the need
for #ifdefs.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Iff1ffd6774b9162185a124585e9507a5bdbc46f4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23198
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Use variadic GuestABI arguments in a few additional syscalls.
Gabe Black [Thu, 28 Nov 2019 06:53:47 +0000 (22:53 -0800)]
sim: Use variadic GuestABI arguments in a few additional syscalls.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Ib2f193e7409859469c853e11f121eba82b3c0ddc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23196
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>