aboutsummaryrefslogtreecommitdiff
path: root/riscv
AgeCommit message (Collapse)AuthorFilesLines
2024-05-23zicflip: fix [ms]ret behaviorChih-Min Chao2-2/+2
Based on Spec chapter 3.5 "An MRET or SRET instruction is used to return from a trap in M-mode or S-mode, respectively. When executing an xRET instruction, if xPP holds the value y, then ELP is set to the value of xPELP if yLPE is 1; otherwise, it is set to NO_LP_EXPECTED; xPELP is set to NO_LP_EXPECTED." The change follow the last statement after semicolon "xPELP is set to NO_LP_EXPECTED" Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2024-05-22triggers: introduce tinfo.versionYenHaoChen1-1/+2
2024-05-22triggers: implement mcontrol6.hitYenHaoChen1-1/+1
2024-05-22triggers: refactor: add typedef enum { ... } hit_t for mcontrol6YenHaoChen2-7/+15
Avoid using private headers, e.g., debug_defines.h, in triggers.h
2024-05-22triggers: refactor: move mcontrol_common_t::hit to mcontrol_t::hit and ↵YenHaoChen2-2/+12
mcontrol6_t::hit Add mcontrol_common_t::set_hit()
2024-05-22triggers: refactor: update debug_defines.hYenHaoChen2-1218/+1340
Update CSR_MCONTROL6_HIT to CSR_MCONTROL6_HIT0 Include CSR_TINFO_VERSION* macros
2024-05-21triggers: remove mcontrol6.timing (implement suggested trigger timings)YenHaoChen1-2/+5
2024-05-06Add Zawrs extensionVed Shanbhogue4-0/+13
2024-05-03Zfa: fix: fmaxm.q requires Q instead of D extensionYenHaoChen1-1/+1
2024-05-01Update encoding.hAndrew Waterman1-1116/+37
2024-05-01Remove Zbpbo, Zpn, and Zpsfoperand implementationAndrew Waterman334-3013/+24
2024-04-30Support per-device arguments and device factory reuseLIU Yu6-26/+28
As proposed in #1652, we made the following changes to MMIO device (factory) plugin API, to mitigate current limitations and facilitate factory reuse. - removed `sargs` from `device_factory_t`, and introduced a new type alias `device_factory_sargs_t` to capture `<device_factory_t *, sargs>` pairs, this is used to instantiate sim_t instances; - changed the signature of `device_factory_t::generate_fdt` and `device_factory_t::parse_from_fdt` to take on an extra `sargs` argument, for instantiating devices with per-device arguments; - made `device_factory_t` const and potentially resuable across multiple `sim_t` instances.
2024-04-29Merge pull request #1648 from YenHaoChen/pr-hstateenAndrew Waterman2-6/+10
Smstateen: Ignore writes to read-only hstateen*[n] bits when mstateen*[n]=0
2024-04-29Merge pull request #1579 from tebartsch/plic-threshold-maskingAndrew Waterman1-0/+9
PLIC: Implement threshold masking
2024-04-29add hlvx pmp protect to fix issue 1557xinyuwang-sifive4-9/+9
2024-04-23Smstateen: Ignore writes to read-only hstateen*[n] bits when mstateen*[n]=0YenHaoChen2-6/+10
The specification states that writes to read-only bits in a RW CSR are ignored. The hstateen*[n] bits are read-only when mstateen*[n]=0. This PR proposes ignoring writes to read-only hstateen*[n] bits when mstateen*[n]=0 instead of writing the bits to 0.
2024-04-18Add Zicfiss extension from CFI extension, v0.4.0SuHsien Ho22-8/+194
1. Add EXT_ZICFISS for enable Zicfiss with zicfiss extension name. 2. Add new software exception with tval 3 for shadow stack. 3. Implement sspush_x1/sspush_x5/sspopchk_x1/sspopchk_x5/ssrdp/ssamoswap_w/ssamoswap_d. 4. Implement c_sspush_x1/c_sspopchk_x5 in c_lui.h which has same encoding. 5. Add new special access type ss_access in xlate_flags_t for checking special read/write permission in SS(Shadow Stack) page. 6. Add new ss_load/ss_store/ssamoswap to enable ss_access flag. 7. Check special pte(xwr=010) of SS page.
2024-04-17Merge pull request #1595 from Siudya/until-paddrAndrew Waterman1-2/+4
Interaction: Support until-mem operation on physical memory space
2024-04-09Ignore writes to henvcfg fields (PBMTE, STCE, and ADUE) when read-only 0YenHaoChen2-0/+8
The henvcfg fields, i.e., PBMTE, STCE, and ADUE, are read-only 0 when the corresponding bits in menvcfg are 0. Besides the reading behavior, the spec also specified the writing behavior, i.e., ignoring writes. This commit ignores writes to the henvcfg fields when read-only 0. Reference: https://github.com/riscv/riscv-isa-manual/issues/1312
2024-03-25Narrow scontext.data length to 32YenHaoChen1-1/+1
The commit provdes the change between debug spec 1.0.0-rc1 and 1.0.0-rc2 Reference: https://github.com/riscv/riscv-debug-spec/pull/981
2024-03-22Allow software check exception to be delegated from M mode regardless of ↵Ming-Yi Lai1-1/+1
Zicfilp being enabled
2024-03-21Merge pull request #1582 from mylai-mtk/zicfilp-upstreamAndrew Waterman18-12/+132
Support Zicfilp
2024-03-11Update vcompress.vm to not write vstart with 0 upon completionrbuchner2-2/+5
Vmcompress.vm requires vstart==0, so writing vstart with 0 is redundant. To do this, spin off VI_LOOP_END_BASE from VI_LOOP_END. VI_LOOP_END will contain VI_LOOP_END_BASE as well as a write of 0 to vstart. See #1623 for full discussion.
2024-03-07Merge pull request #1617 from arrv-sc/masterAndrew Waterman2-25/+48
workaround to support custom extensions that use standard prefixes
2024-03-07workaround to support custom extensions that use standard prefixesAlexander Romanov2-25/+48
RISC-V ISA states (21.1): "A standard-compatible global encoding can also use standard prefixes for non-standard extensions if the associated standard extensions are not included in the global encoding." Currently all the instructions (either from standard or custom extensions) are all being inserted into a single std::vector which is then being sorted. An instruction matching process performs linear search on that vector. The problem is that when a custom extension uses the same opcode as standard one (i.e. match and mask are equal to the standard counterparts) it is undefined which instruction will be picked. That is because in std::sort "The order of equal elements is not guaranteed to be preserved". That being said it is impossible to define custom extension (via customext) that would use the prefix of a disabled standard extension. In this change I separate custom and standard extensions in two separate std::vector's. By default we report an error if they have common elements (There're an additional processor_t constructor's argument that skips this check). If this error is disabled during instruction matching we first trying to find it among custom instructions. If it has been found the search is stopped and custom instruction is executed, otherwise we look for it among standard instructions. Overall this change does not completely fix the problem but at least makes it possible to use the feature of RISC-V ISA.
2024-03-06Zicfilp: Support delegating software check exception handlingMing-Yi Lai2-1/+3
2024-03-06Zicfilp: Preserve expected landing pad state on trapsMing-Yi Lai6-4/+26
2024-03-06Zicfilp: Implement lpad insn behaviorMing-Yi Lai2-0/+10
2024-03-06Zicfilp: Check that the next insn is a lpad if ELP is LP_EXPECTEDMing-Yi Lai3-0/+19
2024-03-06Zicfilp: Add software_check(x) macro to throw a software check exceptionMing-Yi Lai2-0/+2
2024-03-06Zicfilp: Set ELP state when executing indirect jumpsMing-Yi Lai6-0/+35
2024-03-06Zicfilp: Add CSR fieldsMing-Yi Lai3-6/+28
2024-03-06Zicfilp: Add Zicfilp codes to riscv/encoding.hMing-Yi Lai2-1/+8
Regenerates riscv/encoding.h and declares the new lpad insn as an overlapping insn
2024-03-06Zicfilp: Add Zicfilp extension flagMing-Yi Lai1-0/+1
2024-03-03Explicitly capture "this" in lambdasAndrew Waterman1-2/+2
Suppresses a warning on newer compilers for -std=c++20.
2024-03-03Don't include subproject headers with -IAndrew Waterman1-1/+1
Use -iquote instead. This prevents our include paths from messing up the system headers depended upon by libstdc++. (The specific problem was syscall.h in fesvr/, which was interfering with libstdc++'s dependence on the system's syscall.h for SYS_futex.) Subproject headers can now be included in the following ways: #include "foo.h" // for a header local to this subproject #include <bar/baz.h>" // for a header in another subproject But no longer: #include <baz.h> // for a header in any subproject As a special case, libfdt needs itself to be added to the -I path, because their coding style is to use angle brackets for local headers.
2024-03-01Merge pull request #1583 from rbuchner-aril/rbuchner/designated-initializersJerry Zhao2-28/+16
Upgrade Spike to compile with c++2a and use designated initializers
2024-02-19Merge pull request #1602 from YenHaoChen/pr-c_luiAndrew Waterman1-1/+1
Fix c.mop.N decoding
2024-02-19Merge pull request #1610 from YenHaoChen/pr-wfiAndrew Waterman1-5/+3
Raise illegal instruction instead of virtual instruction on WFI when TW=1 and VTW=0 in VU-mode
2024-02-19Raise illegal instruction instead of virtual instruction on WFI when TW=1 in ↵YenHaoChen1-5/+3
VU-mode The previous implementation raises virtual instruction on WFI when TW=1 in VU-mode. According to the recent discussion, we expect an illegal instruction exception in this case. Reference: https://github.com/riscv/riscv-isa-manual/issues/1234
2024-02-16Fix c.mop.N decodingYenHaoChen1-1/+1
The c.mop.N only accepts rd={x1, x3, x5, x7, x9, x11, x13, x15}. The previous implemention incorrectly accepts additional rd={x17, x19, x21, x23, x25, x27, x29, x31}.
2024-02-14Reduce NS16550 address space size to one pageAndrew Waterman1-0/+7
..rather than unbounded, as it used to be. This led to the rather surprising issue #1600, where a part of the address space assumed to be vacant would allow a subset of accesses.
2024-02-11Support run until paddr changed to a certain valueliangsen1-2/+4
2024-02-07Merge pull request #1591 from YenHaoChen/pr-sstc-stceAndrew Waterman1-2/+4
Teach Sstc to respect xenvcfg.STCE
2024-02-06Fix hvip.VSEIP and hvip.VSTIP, so they don't observe platform-specific ↵YenHaoChen4-11/+31
interrupts or CSR hgeip bits The H extension defines that bits VSEIP, VSTIP, and VSSIP of hvip are writable. (The other bits of hvip are read-only 0.) Only hip.VSSIP (mip.VSSIP) is an alias of hvip.VSSIP. The hip.VSEIP is the logical-OR of hvip.VSEIP, selected bit of hgeip by hstatus.VGEIN, and platform-specific external interrupt signals to VS-level, e.g., from AIA. The hip.VSTIP is the logical-OR of hvip.VSTIP and platform-specific timer interrupt signals to VS-level, e.g., from Sstc. Thus, the read values of hvip.VSEIP and hvip.VSTIP differ from the ones of hip.VSEIP and hip.VSTIP (mip.VSEIP and mip.VSTIP). In other words, the hvip isn't an alias (proxy) of mip. The current aliasing (proxy) implementation does not provide the desired behavior for hvip.VSEIP and hvip.VSTIP. An ISA-level behavior difference is that any platform-specific external and timer interrupt signals directed to VS-level should not be observable through the hvip. For instance, the hvip should not observe the virtual timer interrupt signal from the vstimecmp CSR (Sstc extension), which isn't true in the current implementation. Additionally, the hvip should not observe the virtual external interrupt signal from the IMSIC device (AIA extension). Another ISA-level behavior difference is that the hgeip and hstatus.VGEIN also should not affect hvip.VSEIP, which isn't true in the current implementation. This commit fixes the issue by giving the hvip a specialized class, hvip_csr_t. The hvip_csr_t aliases the hvip.VSSIP to the mip.VSSIP but decouples the hvip.VSEIP and hvip.VSTIP from mip.VSEIP and mip.VSTIP. Additionally, the commit updates the read value of mip to be the logical-OR of hvip.VSEIP, hvip.VSTIP, and other sources.
2024-02-06Teach Sstc to respect xenvcfg.STCEYenHaoChen1-2/+4
When menvcfg.STCE=0, mip.STIP reverts to its defined behavior as if unsupporting Sstc extension. When henvcfg.STCE=0, mip.VSTIP reverts to its defined behavior as if unsupporting Sstc extension. [https://github.com/riscv/riscv-time-compare/issues/5] The previous Sstc implementation does not respect the xenvcfg.STCE. In other words, the Sstc may assert mip.STIP (mip.VSTIP) when menvcfg.STCE=0 (henvcfg.STCE=0), which is a misbehaving.
2024-01-24Use designated initiallizers to construct xlate_flags_t objectsrbuchner2-28/+16
Much more readable and more maintainable.
2024-01-22PLIC: Implement threshold maskingTilmann Bartsch1-0/+9
Signed-off-by: Tilmann Bartsch <info@tebartsch.ai>
2024-01-18vcpop.m, vfirst.m: delete unnecessary VSTART write.Hong Cheng2-2/+0
2024-01-17Merge pull request #1551 from YenHaoChen/pr-shfliJerry Zhao2-0/+2
zip and unzip of Zbkb require RV32