Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix boot on newer qemu #62

Open
wants to merge 2 commits into
base: riscv
Choose a base branch
from
Open

Fix boot on newer qemu #62

wants to merge 2 commits into from

Commits on Dec 7, 2021

  1. Add trivial support for PMPs, fixes boot on newer qemu

    We were previously noncompliant with the RISC-V specification, and so
    was qemu: if there are no PMP registers configured, according to the
    spec, any access to memory, including instruction fetch, from S- or U-
    mode, should fail (see section 3.6.1 of the RISC-V privileged spec).
    
    However, qemu was not enforcing this properly prior to
    qemu/qemu@d102f19a208. Running a qemu newer
    than this would get stuck in an infinite loop hitting the exception
    vector repeatedly.
    
    This commit adds trivial support for the PMP registers, writing a value
    such that all accesses from S- and U- mode have their access managed
    solely by the page tables. This restores the previous behaviour.
    
    Further, it makes the machine mode timer vector check if it receives an
    unexpected interrupt if so, jump to a specific infinite loop. This
    should make any potential future occurrences of interrupt issues more
    obvious.
    lf- committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    ab1e9e8 View commit details
    Browse the repository at this point in the history
  2. Fix incorrect bit math

    Thanks Virtual-Machine! It was previously accidentally shifting signed
    numbers which did nothing.
    
    ```
    /* original */
    [cling]$ #include <stdio.h>
    [cling]$ unsigned long long v = ((~0L) >> 10)
    (unsigned long long) 18446744073709551615
    [cling]$ printf("%llx", v)
    ffffffffffffffff(int) 16
    
    /* corrected: */
    [cling]$ v = ((~0ULL) >> 10)
    (unsigned long long) 18014398509481983
    [cling]$ printf("%llx", v)
    3fffffffffffff(int) 14
    ```
    lf- committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    f62c7db View commit details
    Browse the repository at this point in the history