summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/Console
diff options
context:
space:
mode:
authorFiliph Sandström <filiph.sandstrom@filfatstudios.com>2022-08-06 04:16:24 +0200
committerSam Atkins <atkinssj@gmail.com>2022-08-14 09:44:48 +0100
commit99ae4fa161a331dde7472ed0ad0b8335e4ae2975 (patch)
tree1fa702113005470f136ac25efb3ce6d590b1346e /Kernel/Graphics/Console
parent4aaf38e4f748b51fa14cb747a458fbe5dd6da6f2 (diff)
downloadserenity-99ae4fa161a331dde7472ed0ad0b8335e4ae2975.zip
Kernel: Move TrapFrame into its own header on aarch64
Diffstat (limited to 'Kernel/Graphics/Console')
-rw-r--r--Kernel/Graphics/Console/BootFramebufferConsole.cpp19
-rw-r--r--Kernel/Graphics/Console/BootFramebufferConsole.h10
2 files changed, 28 insertions, 1 deletions
diff --git a/Kernel/Graphics/Console/BootFramebufferConsole.cpp b/Kernel/Graphics/Console/BootFramebufferConsole.cpp
index ac1aeb0d87..111c05e285 100644
--- a/Kernel/Graphics/Console/BootFramebufferConsole.cpp
+++ b/Kernel/Graphics/Console/BootFramebufferConsole.cpp
@@ -6,18 +6,34 @@
#include <Kernel/Graphics/Console/BootFramebufferConsole.h>
#include <Kernel/Locking/Spinlock.h>
-#include <Kernel/Memory/MemoryManager.h>
+// FIXME: Port MemoryManager to aarch64
+#if !ARCH(AARCH64)
+# include <Kernel/Memory/MemoryManager.h>
+#endif
namespace Kernel::Graphics {
+// FIXME: Port MemoryManager to aarch64
+#if ARCH(AARCH64)
+BootFramebufferConsole::BootFramebufferConsole(u8* framebuffer_addr, size_t width, size_t height, size_t pitch)
+ : GenericFramebufferConsoleImpl(width, height, pitch)
+ , m_framebuffer(framebuffer_addr)
+#else
BootFramebufferConsole::BootFramebufferConsole(PhysicalAddress framebuffer_addr, size_t width, size_t height, size_t pitch)
: GenericFramebufferConsoleImpl(width, height, pitch)
+#endif
{
+// FIXME: Port MemoryManager to aarch64
+#if ARCH(AARCH64)
+ m_framebuffer_data = framebuffer_addr;
+#else
// NOTE: We're very early in the boot process, memory allocations shouldn't really fail
auto framebuffer_end = Memory::page_round_up(framebuffer_addr.offset(height * pitch * sizeof(u32)).get()).release_value();
m_framebuffer = MM.allocate_kernel_region(framebuffer_addr.page_base(), framebuffer_end - framebuffer_addr.page_base().get(), "Boot Framebuffer"sv, Memory::Region::Access::ReadWrite).release_value();
+
[[maybe_unused]] auto result = m_framebuffer->set_write_combine(true);
m_framebuffer_data = m_framebuffer->vaddr().offset(framebuffer_addr.offset_in_page()).as_ptr();
+#endif
memset(m_framebuffer_data, 0, height * pitch * sizeof(u32));
}
@@ -30,6 +46,7 @@ void BootFramebufferConsole::clear(size_t x, size_t y, size_t length)
void BootFramebufferConsole::clear_glyph(size_t x, size_t y)
{
+
VERIFY(m_lock.is_locked());
GenericFramebufferConsoleImpl::clear_glyph(x, y);
}
diff --git a/Kernel/Graphics/Console/BootFramebufferConsole.h b/Kernel/Graphics/Console/BootFramebufferConsole.h
index 434556b28a..86e5bbdb67 100644
--- a/Kernel/Graphics/Console/BootFramebufferConsole.h
+++ b/Kernel/Graphics/Console/BootFramebufferConsole.h
@@ -23,14 +23,24 @@ public:
virtual void flush(size_t, size_t, size_t, size_t) override { }
virtual void set_resolution(size_t, size_t, size_t) override { }
+// FIXME: Port MemoryManager to aarch64
+#if ARCH(AARCH64)
+ BootFramebufferConsole(u8* framebuffer_addr, size_t width, size_t height, size_t pitch);
+#else
BootFramebufferConsole(PhysicalAddress framebuffer_addr, size_t width, size_t height, size_t pitch);
+#endif
protected:
virtual void clear_glyph(size_t x, size_t y) override;
virtual u8* framebuffer_data() override;
+// FIXME: Port MemoryManager to aarch64
+#if ARCH(AARCH64)
+ u8* m_framebuffer;
+#else
OwnPtr<Memory::Region> m_framebuffer;
+#endif
u8* m_framebuffer_data {};
mutable Spinlock m_lock;
};