feat: add support for aarch64 timer/interrupts, port MontaukOS userspace
This commit is contained in:
1 parent
8b6379fb7e
commit
8c09ccef66
101 files changed
+1720
-629
No files matched your search
@@ -13,6 +13,18 @@
|
||||
|
||||
namespace gui {
|
||||
|
||||
// Drain write-combining stores to the scanout buffer before it is flipped
|
||||
// or composited by someone else.
|
||||
inline void wc_store_fence() {
|
||||
#if defined(__x86_64__)
|
||||
asm volatile("sfence" ::: "memory");
|
||||
#elif defined(__aarch64__)
|
||||
asm volatile("dsb st" ::: "memory");
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
}
|
||||
|
||||
class Framebuffer {
|
||||
uint32_t* hw_fb;
|
||||
uint32_t* hw_fb2; // second scanout buffer (page flip), nullptr if unsupported
|
||||
@@ -322,12 +334,12 @@ public:
|
||||
montauk::memcpy(mirror, src, row_bytes);
|
||||
}
|
||||
}
|
||||
if (hw_mirror) asm volatile("sfence" ::: "memory");
|
||||
if (hw_mirror) wc_store_fence();
|
||||
|
||||
if (hw_fb2) {
|
||||
// Wait for the latch (vsync): the buffer we just left becomes
|
||||
// safe to draw into only once the new one is actually scanning.
|
||||
asm volatile("sfence" ::: "memory");
|
||||
wc_store_fence();
|
||||
int64_t presented = montauk::fb_flip(hw_next, 1);
|
||||
if (presented == hw_next) {
|
||||
hw_next ^= 1;
|
||||
@@ -359,7 +371,7 @@ public:
|
||||
montauk::memcpy(mirror, src, row_bytes);
|
||||
}
|
||||
}
|
||||
asm volatile("sfence" ::: "memory");
|
||||
wc_store_fence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user