From da0e83c01161d0c216f3831d5be21df728691c64 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 11 May 2025 16:48:02 +0200 Subject: feat(kernel/hefs): Fixed the shortcomings and issues of HeFS. Signed-off-by: Amlal El Mahrouss --- dev/kernel/HALKit/AMD64/HalDebugOutput.cc | 46 ++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'dev/kernel/HALKit/AMD64/HalDebugOutput.cc') diff --git a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc index bd8fe734..5d14f214 100644 --- a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc +++ b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc @@ -57,6 +57,8 @@ namespace Detail { TerminalDevice::~TerminalDevice() = default; +STATIC SizeT kX = kFontSizeX, kY = kFontSizeY; + EXTERN_C void ke_utf_io_write(IDeviceObject* obj, const Utf8Char* bytes) { NE_UNUSED(bytes); NE_UNUSED(obj); @@ -76,11 +78,36 @@ EXTERN_C void ke_utf_io_write(IDeviceObject* obj, const Utf8Cha index = 0; len = urt_string_len(bytes); + Char tmp_str[2]; + while (index < len) { if (bytes[index] == '\r') HAL::rt_out8(Detail::kPort, '\r'); HAL::rt_out8(Detail::kPort, bytes[index] == '\r' ? '\n' : bytes[index]); + tmp_str[0] = (bytes[index] > 127) ? '?' : bytes[index]; + tmp_str[1] = 0; + + fb_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff)); + + if (bytes[index] == '\r') { + kY += kFontSizeY; + kX = kFontSizeX; + } + + kX += kFontSizeX; + + if (kX > kHandoverHeader->f_GOP.f_Width) { + kX = kFontSizeX; + } + + if (kY > kHandoverHeader->f_GOP.f_Height) { + kY = kFontSizeY; + + FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(), + 0, 0); + } + ++index; } @@ -107,32 +134,31 @@ EXTERN_C void ke_io_write(IDeviceObject* obj, const Char* bytes) { index = 0; len = rt_string_len(bytes); - STATIC SizeT x = kFontSizeX, y = kFontSizeY; + Char tmp_str[2]; while (index < len) { if (bytes[index] == '\r') HAL::rt_out8(Detail::kPort, '\r'); HAL::rt_out8(Detail::kPort, bytes[index] == '\r' ? '\n' : bytes[index]); - char tmp_str[2]; tmp_str[0] = bytes[index]; tmp_str[1] = 0; - fb_render_string(tmp_str, y, x, RGB(0xff, 0xff, 0xff)); + fb_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff)); if (bytes[index] == '\r') { - y += kFontSizeY; - x = kFontSizeX; + kY += kFontSizeY; + kX = kFontSizeX; } - x += kFontSizeX; + kX += kFontSizeX; - if (x > kHandoverHeader->f_GOP.f_Width) { - x = kFontSizeX; + if (kX > kHandoverHeader->f_GOP.f_Width) { + kX = kFontSizeX; } - if (y > kHandoverHeader->f_GOP.f_Height) { - y = kFontSizeY; + if (kY > kHandoverHeader->f_GOP.f_Height) { + kY = kFontSizeY; FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(), 0, 0); -- cgit v1.2.3