Commit Graph

18705 Commits

Author SHA1 Message Date
Gabe Black
cbb495334c cpu: Make getIsaPtr const.
This accessor shouldn't modify the ThreadContext.

Change-Id: I6f2629f950b0379573e51e337626ef6b1429a14d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50250
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-03 19:39:26 +00:00
Giacomo Travaglini
9e8d397411 configs: Remove unused caches in ruby_fs.py
The script is using the ruby memory subsystem, therefore the instantiated
classic cache models are left unbound

Change-Id: Ic083ef20a3fff63238a64f1478f25fe501e6d8e8
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57272
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-03 15:41:46 +00:00
Jason Lowe-Power
01785b5d0e mem-ruby: Reset stats in Ruby correctly
Change-Id: Ie60c6f4be7b2a2705dc6da77b8b3d03717f13188
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57269
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-03-03 02:06:54 +00:00
Gabe Black
c0d380b4d7 arch: Simplify the VecElemOperand class.
Oddly, makeDecl would conditionally declare the operand, but only
because makeRead would also declare it. Instead, make makeRead work like
normal, and get rid of the custom makeDecl.

Change-Id: I26c6f01f971778ad5075f8d3f49d9816f371f5b3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49722
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 23:41:31 +00:00
Gabe Black
81d2f9f10a arch: Consolidate all the make_constructor methods in the ISA parser.
These methods were all identical, except that IntRegOperand and
CCRegOperand classes had logic to handle operand predication. Since the
other operand types won't have predicates set, we can use the superset
version, and the other types will reduce to what they used to in
practice.

Change-Id: I51eeedcacb7cfc6e2c136742701ee9bf80ec4e15
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49721
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 21:26:48 +00:00
Alex Richardson
6de0156cf7 mem-cache: Avoid calling .front() on a possibly empty std::list
In the call to MSHR::promoteWritable() the deferredTargets list can be
empty, so we should check that case before calling .front(). The new logic
matches MSHR::promoteReadable().

Change-Id: Ic1d05e42f32b2c02226ca88d2155225f592f667f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57249
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 09:59:59 +00:00
Giacomo Travaglini
a3e481c024 cpu: Fix SimpleExecContext coding style
JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: I3b9107943732503055008f843a21925574dad930
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56597
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:22:41 +00:00
Samuel Stark
77263615db mem: Add TLB invalidation flags to the Request object
Some ISAs implement TLB invalidation across multiple cores (TLB
shootdown) by broadcasting invalidation messages to every PE in a
target shareability domain.

These messages originate by specific instructions and can be
cathegorized in two macro groups

1) TLB Invalidation instructions: generating the invalidation
request

Example:
* Arm: TLBI instruction [1]
* AMD64: INVLPGB instruction [2]

2) TLB Invalidation sync instructions: serialization point, ensuring
completion of outstanding invalidation requests

Example:
* Arm: DSB instruction [1]
* AMD64: TLBSYNC instruction [2]

This patch is introducing TLBI and SYNC operations in the memory
subsystem by adding the following Request flags:

* TLBI (1)
* TLBI_SYNC (2)

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

[1]: https://developer.arm.com/documentation/ddi0487/gb/
[2]: https://www.amd.com/system/files/TechDocs/24594.pdf

Change-Id: Ib5b025d0f6bc0edaf4f11a66593947a72ba32b8f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56596
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:22:41 +00:00
Giacomo Travaglini
a00f6d67d4 arch-arm: Implement TLBI instructions with a separate class
This is an initial step towards making TLBI shareable issue memory
operations (generating DVM messages)

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

Change-Id: I90d4ec6f57f98860d082b393080290cd245af64f
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56595
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:22:41 +00:00
Giacomo Travaglini
f36c5d778b arch-arm: Implement DSB Shareable with a separate class
This is an initial step towards making DSB shareable issue a memory
operation (generating DVM messages)

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

Change-Id: Ia7225acc13008ba1ebdf0b091941f6b494e9d4d6
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56594
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:22:41 +00:00
Giacomo Travaglini
154884dea3 sim: Avoid -Werror=unused-variable in bufval unittests
Some compilers (e.g. gcc-7.5) throw a warning/error when a structured
binding variable is not used.

Change-Id: Ib5090508d135e4a72c39f18b316c76674c3bd8f3
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57229
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:19:58 +00:00
Gabe Black
f1b421baf5 arch: Get rid of the is${Type}Reg methods of the Operand class.
These are not used, and would prevent creating a truly generic register
operand class.

Change-Id: Ibffadc7a682b878aee8e632a0f85c06e91a60614
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49720
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:45 +00:00
Gabe Black
d8e04d25a6 arch: Introduce an intermediate RegOperand class in operand_types.py.
There are a number of operand types which are registers. Define a
RegOperand type which they can all inherit from to get register generic
functionality. This will also become a way to add generic register types
with malleable properties at the ISA level.

Change-Id: I01a1d5d133d8f64106d005a744631f64e6808e57
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49719
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:25 +00:00
Gabe Black
efdba6d353 cpu-o3: Initialize register maps and free lists with loops.
Now that these can be referenced by index instead of by a fixed name, we
can manage them more generically using loops.

Change-Id: I7bb7a6b712ee66f22fa809feef4abfcd1851f237
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49717
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:01 +00:00
Gabe Black
56fba14e7d cpu-o3: Manage per-register-type free lists with an array.
Change-Id: Ie32b9fda87780c3ac15e0a5e309d50df05a99f0c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49716
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:01 +00:00
Kyle Roarty
5e721db9a2 arch-vega: Handle signed offsets in Global/Scratch instructions
The offset field in Flat-style instructions is treated differently
based on if the instruction is Flat or Global/Scratch.

In Flat insts, the offset is treated as a 12-bit unsigned number.

In Global/Scratch insts, the offset is treated as a 13-bit signed number.

This patch updates the calcAddr function for Flat-style instructions
to properly sign-extend the offset on Global/Scratch instructions

Change-Id: I57f10258c23d900da9bf6ded6717c6e8abd177b7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57209
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
2022-03-01 21:14:38 +00:00
Giacomo Travaglini
0d65662218 arch-arm: Reuse MCR15 trapping code in DC instructions
Change-Id: I08fec815400ad572da543660f0136e3d88d4dc65
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56593
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 11:57:58 +00:00
Giacomo Travaglini
31c31e1cd8 arch-arm: Replace mcrMrc15TrapToHyp with mcrMrc15Trap
The mcrMrc15TrapToHyp helper is already called within mcrMrc15Trap
This achieves the following:

1) Simplifies ISA code
2) Aligns McrDc to Mcr instruction

Change-Id: I9b6bc621ad89230ad9dcf0563d8985d5757b4ae1
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56592
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 11:57:58 +00:00
Gabe Black
412ae3f8df cpu,sim: Don't tie ThreadContext contextId to the CPU ID.
The contextId is generally treated as (and should be) an opaque index
into the System objects threadContext array. When forcing it to
particular values, that introduces gaps in the threadContext array which
trips up other code which is expecting the array to have only valid
entries.

Change-Id: I4997e989b436a3008f65f348722dfb843b2f110a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57089
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
2022-03-01 02:55:20 +00:00
Gabe Black
e7f1acc0dc scons: Add a "mold" value to the --linker option.
This new and improved linker approximately halves link time for
build/X86/gem5.opt for me compared to lld, the previously fastest
linker. The -fuse-ld=mold option is supported by current versions of
clang, and will be supported in gcc 12.

To use the mold linker with gcc prior to version 12, you need to set
the LINKFLAGS_EXTRA scons variable to pass in a -B option as described
on this page:

https://github.com/rui314/mold

Change-Id: Ic5ad0e532fac078d384a0aebb3e04a4b04ce4880
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57173
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Earl Ou <shunhsingou@google.com>
2022-03-01 02:02:27 +00:00
Gabe Black
76c0466557 cpu-o3: Use an array to hold rename maps in UnifiedRenameMap.
Change-Id: I3ae1d6ecb103d2b877aba36050cd7b148742b503
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49715
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
39d25eebd0 cpu-o3: Make canRename extract register counts locally.
This avoids having an argument for each register type, which prevents
building in an assumption about what register types exist.

Change-Id: I81473db51d930c757f4e0b24e6f3017a4965a721
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49714
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
a5ab19d3ef arch,cpu: Replace num${Type}DestReg accessors with numDestReg(type).
Change-Id: I32be58cce831c8c7d5b9e3d3f49f428a06c722a2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49713
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
967bada8db arch,cpu: Replace StaticInst::_num${TYPE}DestRegs members with an array.
The array is indexed using the register class.

Change-Id: I6cfd9735afa03e386e01e9e255fd6e55b7ba7272
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49712
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
2d012222c2 arch: Get rid of the unused numAccessNeeded variable.
This was defined in a few operand classes makeConstructor methods, but
never used for anything.

Change-Id: If2f62ff0a29a26ae7067728651440f864999fc67
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49718
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-28 22:05:25 +00:00
Gabe Black
ec4d6c0daf cpu,arch-arm: Use a sentry class valid for invalid RegIds.
The default constructor for RegId would initialize it with the
IntRegClass and register index 0. This is arbitrary and
indistinguishable from a real ID to the first integer register.

Instead, add a new class type constant InvalidRegClass, and use that to
initialize an otherwise uninitialized RegId.

Also, fill out some enums that needed to handle that value to silence
compiler warnings.

Change-Id: I3b58559f41adc1da5f661121225dbd389230e3af
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49710
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-28 22:04:27 +00:00
Daecheol You
092d33f3f5 configs: Modify createAddrRanges to support NUMA configuration
When system is configured for NUMA, it has multiple memory ranges,
and each memory range is mapped to a corresponding NUMA node.
For this, the change enables createAddrRanges to map address ranges to
only a given HNFs.

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

Change-Id: If4a8f3ba9aac9f74125970f63410883d2ad32f01
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56610
Reviewed-by: Tiago Muck <tiago.muck@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-28 00:19:30 +00:00
Hoa Nguyen
0fefc76fe6 mem-cache: Fix unit inconsistencies in base cache stats
Most latency stats are described to have Cycle unit in the comments.
However, most of them are calculated from Tick.

Also, the unit of `demandAvgMissLatency` is incorrect.

Change-Id: Ib1b9b7c6fa4404cecb3982b3799753df19774623
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56989
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-27 23:01:03 +00:00
Gabe Black
f32130e26f arch-x86: Implement interrupts in real mode.
Software interrupts had been implemented earlier. This implements
hardware interrupt vectoring for real mode.

Change-Id: I92397514cdf64c3218175dd6cffd5931cc85d95b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55692
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 20:03:02 +00:00
Matthew Poremba
6a9dfcef52 mem-ruby: Revert 7018c2b34
This reverts commit 7018c2b34e. This
commit needs more work which will take a while. Meanwhile the nightly
tests are broken because of this.

Change-Id: I11d01d50ab3a2d8fd649f1a825911e14815b1ca6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57109
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 15:19:51 +00:00
Gabe Black
97bc68e6f4 arch-x86: Fix how flags registers are handled in IRET_REAL.
There was a problem in how the data size worked, which could let data
leak through from the old value of a microcode register and affect the
new value of RFLAGS.

Change-Id: I2325bc3583b3c796c586c2ea4f6ba3cc56725077
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55691
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 13:19:30 +00:00
Gabe Black
7dfca8531d cpu: Remove an unused variable from one of the branch predictors.
The variable upsets clang and breaks the build.

Change-Id: Ia2315e1753b6e9e701bf18eadf8cf448643577b4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57172
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 13:06:07 +00:00
Gabe Black
293cfab778 arch-x86: Mark a variable as [[maybe_unused]].
This variable is used to hold a new value for the FSW register, and is
only actually installed if the flag version of the PremFp microop is
used. Mark it as [[maybe_unused]] so clang doesn't complain.

Change-Id: Ied0e267a1b89884b369cc5f7f043c96ae86d973b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57171
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 13:06:07 +00:00
Gabe Black
001e17890c misc: Use the new bufval helpers in RegClass and Packet.
Those makes generally useful mechanisms are now available to any code
that wants to use it, and are covered by a unit test.

Change-Id: If918eba3b81443019c5789ab132de45c65f93072
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57150
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 09:56:26 +00:00
Gabe Black
9df4159456 sim: Add some helpers for working with values in buffers.
This change adds helpers to get and set values from byte buffers of
variable size, and to print them. It also provides a helper to print a
buffer of bytes.

Change-Id: I23210505f99488a901bed244ffc70ef4736470d0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57149
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 09:56:26 +00:00
Gabe Black
7f9f145174 arch-x86: Implement the real mode far return that takes an immediate.
The immediate value tells the return instruction how much to adjust the
stack by after returning to the previous RIP.

Change-Id: If9bd935c4b1c73dfcf709cce02bcfa3738637c6c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55625
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:59 +00:00
Gabe Black
2a424850d5 arch-x86: Don't load past the end of the far pointer in real mode jmp.
When loading the segment selector from the far pointer, only load two
bytes to avoid unnecessarily going beyond a boundary where accesses may
not be allowed.

Change-Id: I4fc31e3f87815a19232390966c25d156be6a7e92
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55624
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:45 +00:00
Gabe Black
d73ce0f593 arch-x86: Implement real mode far call.
Change-Id: I720a0b0e4aa227171c59804d899baba64b8d320b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55623
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:23 +00:00
Gabe Black
7468d4169c arch-x86: Straighten out the segment and selector for real far jumps.
These had been partially transposed in the microcode for this
instruction.

Change-Id: Ida31e74d5096c6b8cf77dc49b9a0f480c1358009
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55591
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:03 +00:00
Gabe Black
802f14bb52 arch-x86: Implement popping into a stack selector in real mode.
Segmentation is relatively easy to deal with in real mode, vs. protected
mode.

Change-Id: I4b93a7e321d5debb7240b002bb42fdecaafbfdfe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55590
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:30:24 +00:00
Gabe Black
c2c10dc647 arch-x86: Implement the real mode versions of LDS, LES, etc.
Change-Id: I8956d9871c8819acd4669423b3b59fa615ac2a7c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55588
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:30:06 +00:00
Gabe Black
aa4b6047e5 cpu-simple: Ignore writes to the "zero" register.
Rather than constantly overwriting the "zero" register to return its
value to zero, just ignore writes to it.

We assume here that the "zero" register is a standard RegVal type
register (ie not bigger than 64 bits) and is accessed as such.

Change-Id: I06029b78103019c668647569c6037ca64a4d9c76
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49709
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 05:02:35 +00:00
Gabe Black
f12c330f40 arch-x86: Use different tables for 64 bit prefixes in the decoder.
There are instructions in 64 bit mode which have been turned into the
REX and VEX prefixes, and which should no longer behave as instructions.
When not in 64 bit mode however, those instructions still need to behave
properly.

We were handling that for the REX prefixes by explicitly checking if the
prefix we found was one of those, and then whether we were in 64 bit
mode or not. We were not handling the VEX prefixes at all, so those were
always acting as prefixes, even when not in 64 bit mode.

This change replaces the REX check and possible VEX check by having two
prefix tables, one for 64 bit mode, and one for otherwise. The REX and
VEX prefixes are simply left out of the non 64b it mode table, making an
explicit check for them unnecessary.

Change-Id: Ia2fc17074015e074d1f156177bd499d67da5411d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55587
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 02:00:06 +00:00
Gabe Black
7a408e35fd dev,arch-x86: Add an x86/compatibility IDE controller.
This is essentially the same as the normal one, except it sets its
ProgIF bits to show that it works in compatibility mode only, with fixed
IO ports and fixed IRQs that it operates with which are outside of the
scope of the normal PCI mechanisms.

Change-Id: I69d04f5c9444e7e227588b96b7dd4123b2850e23
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55586
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:50 +00:00
Gabe Black
2bbcee7723 dev: Fix an assert in the I8259 interrupt controller.
If an *index* is equal to or greater than the size of the thing it's
indexing, then that's an error. Another count, on the other hand, must
be strictly greater for that to be a problem.

Change-Id: I9c891b37482fe72b6436850fc8c3c2fcef6f0476
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55585
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:30 +00:00
Gabe Black
72a455f9c9 dev: Don't implement the ATAPI_IDENTIFY_DEVICE command.
This command is one of two that should be implemented by ATAPI devices.
An ATAPI device are essentially optical devices which use SCSI commands
which are transported over ATA using two special commands, a PACKET
command which actually sends the SCSI commands, and an IDENTIFY command
which is basically the same as the ATA IDENTIFY command but which is
only implemented on ATAPI devices. In order to determine if the device
connected to an IDE controller is an optical drive or a regular ATA hard
drive, software can send the ATAPI_IDENTIFY_DEVICE command and see if
gets an appropriate response.

In gem5, this command was originally not implemented by the IDE disk
model. If a driver attempted to send it, the gem5 model would panic and
kill the simulation. To fix that problem, that command was added to the
list of supported commands and just made a synonym for the ATA IDENTIFY
command since they have essentially the same response.

Unfortunately, this makes all ATA devices look like ATAPI devices, which
is not what we have implemented.

Instead, when we get this command, what we *should* do, as far as I can
tell by reading this:

http://users.utcluj.ro/~baruch/media/siee/labor/ATA-Interface.pdf

is to set the ERR bit in the status register, and then set the ABRT bit
in the error register to indicate that the command was not implemented.

I've attempted to implement that into the model with this change by
setting those bits as described, and then setting the "action" member to
be ACT_CMD_ERROR. I think that action is there primarily to support
cancelled transfers, but it seems like it has the desired effect(?).

Since the error bits are not really explicitly set or managed by the
model in most cases, this change also adds a little bit of code at the
top of startCommand which clears them to zero. These bits are supposed
to "contain the status of the last command executed", and if we're
starting a new command, the error bits no longer apply.

I'm confident that conceptually this is how the ATAPI_IDENTIFY_DEVICE
command should behave in our model, at least unless we decide to
implement real ATAPI models which actually accept SCSI commands, etc.
I'm less confident that I've modified the model to actually implement
that behavior, but as far as I can tell it doesn't seem to have broken
anything, and now SeaBIOS no longer things our disk model is a CDROM
drive.

Change-Id: I2c0840e279e9caa89c21a4e7cbdbcaf6bccd92ac
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55523
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:13 +00:00
Gabe Black
5df52e0dca arch-x86: Overhaul how address size is handled, particularly for stack.
The stack size is something that applies to addresses when performing
accesses as part of some instructions. This was handled inconsistently
or incompletely or simply incorrectly in a few ways.

First, when pushing or popping from the stack, the *address size* should
be set to the stack size. The data size is generally the operand size.
When the stack pointer is incremented/decremented, it should be changed
by the data size. When a stack pointer is manipulated, the data size
for those calculations should be the stack size. Importantly that does
not change the value of the increment/decrement, which is the operand
size still. This usage has been fixed throughout.

The TLB generally needs to know what the address size was in order to
figure out what segment offset was used so that it can do limit checks.
There is some inherent inaccuracy in doing things in reverse like this,
but that's how it works currently. To find that size, the TLB tried to
start from first principles to figure out what the default address size
was, and then whether there was an override was passed in through the
request flags.

This is *very* inaccurate for a few reasons. First, the override doesn't
always apply. Second, the address size used by a particular instruction
doesn't have to be based on any particular size, whether that is the
default or alternate address size, the stack size, etc.

Instead, the instructions now pass the actual size being used in as a 2
bit value (0 -> 1 byte, 1 -> 2 bytes, 2 -> 4 bytes, 3 -> 8 bytes),
avoiding most of the inaccuracy and approximation.

Because the CPU won't embed any size information into fetches, we'll
just assume those have no wrap around within the address size.

Finally, there were microops that had been added which overrode the
address size to be the stack size internally, and try to help the TLB
figure out what to do to figure out the address size. Because both of
those things are now handled in a different way, those microops are no
longer needed or used and have been deleted.

Change-Id: I2b1bdf1acf1540bf643fac6d49fe1a5a576ba5c1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55443
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:58:23 +00:00
Gabe Black
375236082d scons: Use env and not main in SConscripts.
"env" is the environment for the current variant, where "main" is the
environment that was derived from.

Change-Id: I71e30684aa82a297241820502f204400c89c80cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56890
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
2022-02-25 09:32:14 +00:00
Gabe Black
e5281da388 sim: Fix style in insttracer.hh.
Change-Id: Iddf032ae03ef20d6220c298424779dad726f5179
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49706
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-25 08:08:32 +00:00
Gabe Black
3e846d20ed cpu: Remove VecRegContainer from ThreadContext::compare.
Change-Id: I5a0f9d30fe56806d46fb54d62e1e58d02a319879
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49708
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 23:22:24 +00:00