diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-25 20:17:53 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-25 20:17:53 +0100 |
| commit | 3b3b36dcc6542e203475fe1d50ed89799e3f3fc6 (patch) | |
| tree | 3d1e4cfba79343e2b5ef8db58c58271009a44937 /Private/Source | |
| parent | d968190d1ba48638c1481be0d367ee3cea82ae55 (diff) | |
Kernel: implement some tickets, improved stuff.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/Framebuffer.cxx | 32 | ||||
| -rw-r--r-- | Private/Source/KernelHeap.cxx | 10 |
2 files changed, 33 insertions, 9 deletions
diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx index 6ea2fa5b..9c964a3c 100644 --- a/Private/Source/Framebuffer.cxx +++ b/Private/Source/Framebuffer.cxx @@ -33,13 +33,14 @@ volatile UIntPtr *Framebuffer::operator[](const UIntPtr &pos) { /// @brief Boolean operator. Framebuffer::operator bool() { - return m_FrameBufferAddr.Leak()->m_Base != 0 && m_Colour != FramebufferColorKind::INVALID && - m_FrameBufferAddr.Leak()->m_Base != kBadPtr; + return m_FrameBufferAddr.Leak()->m_Base != 0 && + m_Colour != FramebufferColorKind::INVALID && + m_FrameBufferAddr.Leak()->m_Base != kBadPtr; } /// @brief Set color kind of framebuffer. -/// @param colour -/// @return +/// @param colour +/// @return const FramebufferColorKind &Framebuffer::Color( const FramebufferColorKind &colour) { if (m_Colour != FramebufferColorKind::INVALID && @@ -50,8 +51,29 @@ const FramebufferColorKind &Framebuffer::Color( return m_Colour; } -/// @brief Leak fraembuffer context. +/// @brief Leak framebuffer context. /// @return The reference of the framebuffer context. Ref<FramebufferContext *> &Framebuffer::Leak() { return this->m_FrameBufferAddr; } + +Framebuffer &Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, + UInt32 color) { + for (HCore::SizeT i = x; i < width + x; ++i) { + for (HCore::SizeT u = y; u < height + y; ++u) { + *(((volatile HCore::UInt32 *)(m_FrameBufferAddr.Leak()->m_Base + + 4 * m_FrameBufferAddr.Leak()->m_Bpp * i + + 4 * u))) = color; + } + } + + return *this; +} + +Framebuffer &Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) { + *(((volatile HCore::UInt32 *)(m_FrameBufferAddr.Leak()->m_Base + + 4 * m_FrameBufferAddr.Leak()->m_Bpp * x + + 4 * y))) = color; + + return *this; +}
\ No newline at end of file diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx index a38156f4..39648102 100644 --- a/Private/Source/KernelHeap.cxx +++ b/Private/Source/KernelHeap.cxx @@ -75,8 +75,9 @@ Int32 ke_delete_ke_heap(VoidPtr heapPtr) { if (virtualAddress->hCRC32 != 0) { if (virtualAddress->hCRC32 != ke_calculate_crc32((Char *)virtualAddress->hAddress, - virtualAddress->hSizeAddress)) + virtualAddress->hSizeAddress)) { ke_stop(RUNTIME_CHECK_POINTER); + } } virtualAddress->hSizeAddress = 0UL; @@ -112,8 +113,8 @@ Boolean ke_is_valid_heap(VoidPtr heapPtr) { } /// @brief Protect the heap pointer with a CRC32. -/// @param heapPtr -/// @return +/// @param heapPtr +/// @return Boolean ke_protect_ke_heap(VoidPtr heapPtr) { if (heapPtr) { Detail::HeapInformationBlockPtr virtualAddress = @@ -121,7 +122,8 @@ Boolean ke_protect_ke_heap(VoidPtr heapPtr) { (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); if (virtualAddress->hPresent && virtualAddress->hMagic == kHeapMagic) { - virtualAddress->hCRC32 = ke_calculate_crc32((Char*)heapPtr, virtualAddress->hSizeAddress); + virtualAddress->hCRC32 = + ke_calculate_crc32((Char *)heapPtr, virtualAddress->hSizeAddress); return true; } } |
