Login
You're viewing the f.duriansoftware.com public feed.
  • Feb 6, 2026, 8:34 PM

    Oh, yes... if I put an illegal instruction (CSRR t0, mstatus) into the `stvec` routine, it doesn't trigger. So either the STI interrupt is firing very fast and interrupting the interrupt routine (how?), or something else is happening, but I have no idea what.

    3/2 (I mean it this time)

    💬 1🔄 0⭐ 1

Replies

  • Feb 7, 2026, 12:12 AM

    @darkling
    You need to stop the source of the clock
    interrupts, not just clear the sip bit. Typically
    you'd need to increase the value of the clint's
    mtimecmp register past the mtime register's
    value. You could also turn off stie in the sie csr.

    💬 0🔄 0⭐ 0
  • Feb 7, 2026, 12:17 AM

    @geoff_collyer Thanks. That gives me a lot to work with. Although... I do want clock interrupts. I just don't want them every CPU cycle.

    I'll go and look up docs for the clint (if I can find them) and see what I'm missing.

    Docs are hard to come by, it seems. The qemu docs list a whole load of hardware, without mentioning if it's a standard or a well-known part. There's no links to anything useful if you actually want to write code hitting that hardware. I'm finding it hard. :blobcatverysad:

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Feb 7, 2026, 12:27 AM

    @geoff_collyer I've read the ISA spec, several times. I'm still struggling.

    The lack of docs from qemu I mentioned is that they don't link to anything. It says it supports CLINT, but doesn't say what that is, or why I'd care about it, or where to get more information. If I hadn't noted the acronym on the way past in the riscv.org website (which I didn't), I'd have no way of knowing it was important at this point, or even where to find out about it.

    💬 1🔄 1⭐ 0
  • Feb 7, 2026, 12:30 AM

    @geoff_collyer Similarly, trying to work out how to get the thing even to boot to my kernel was painful. The qemu docs say things that simply don't work. I fell back on u-boot, and the way I got that to work doesn't give me a working device tree. Apparently I now have to read a 2000-page spec for UEFI, and completely change the booting, just so that I can get a DT.

    It's very frustrating, and it's hard to see how anyone's actually meant to understand this massive stack of stuff enough to use it.

    💬 1🔄 1⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0