Conversation
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
8dd242b to
1732f04
Compare
| // TODO: move this over to insns.h? | ||
| #define RISCV64_CSR_SSTATUS_SIE (1 << 1) | ||
|
|
||
| // TODO: consider making these common across architectures somehow? |
There was a problem hiding this comment.
i kinda want these to be private to hartlocks, but they'd still need to be per-arch...
tbh, could you prototype them in hartlock.c and implement them in arch/riscv64/hartlock.c or smth?
There was a problem hiding this comment.
private to hartlocks as in the spinlocks would take a hartlock instead?
There was a problem hiding this comment.
or, well, in addition to being a spinlock, they would also take the hartlock
| // Otherwise, we might get interrupted and then attempt to re-acquire the same | ||
| // spinlock, leading to a deadlock. |
There was a problem hiding this comment.
i'm missing what the problematic sequence of events here is; shouldn't the atomics make this not a problem?
There was a problem hiding this comment.
hmm .... i guess on second thought it shouldn't be a huge problem, i forgot that if we get interrupted we would end up dropping the lock before returning back
There was a problem hiding this comment.
(e.g. if we went
- loop trying to acquire it while it's locked
- get interrupted
- try to acquire the same lock
then this is fine, it's locked by a different hart which should eventually drop it)
| #include <insns.h> | ||
| #include <types.h> | ||
|
|
||
| // TODO: move this over to insns.h? |
There was a problem hiding this comment.
yes; make it an enum blah : u64 too, so we get warnings if we try to use it in a too-small type
There was a problem hiding this comment.
ig i didn't write down my problem here which is that nominally it's more of a struct than an enum; i.e. there are fields in sstatus that are more than 1 bit in size, and i'm unsure how to nicely represent that
Signed-off-by: Autumn <auctumnus@pm.me>
9208837 to
4b5a80c
Compare
Co-authored-by: remexre <me@remexre.com> Signed-off-by: autumn <auctumnus@pm.me>
55d95e6 to
241654e
Compare
This PR adds spinlock functionality.
Somewhat supersedes part of #33.