Open et-tommythorn opened 4 years ago
On 2nd thought, the write-hook needs to be called pre-write as well (to handle R/O fields), but we can still simplify how the common write case happens.
That said, changing the PCI/virtio devices looks involved and I think we can make this change incrementally, as needed.
Looking at the PLIC this may not be practical; the PLIC covers a large address space, but is very sparsely populated.
This is forked off @ss2783's pull request #15 where extending the CLINT to handle sub-word accesses ran into trouble.
The fundamental problem is that the device model is currently called upon the load/stores directly and it's up to the handler to deal sub-word handling.
I think there's a model that works better:
This significantly reduces the amount of code that needs to be written to support most devices and removes the sub-word access handling from devices (unless they really want to handle this in a special way).