mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:42:44 +00:00 
			
		
		
		
	Kernel/Graphics: Rename TextModeConsole => VGATextModeConsole
This change represents well the fact that the text mode console is based on VGA text mode.
This commit is contained in:
		
							parent
							
								
									97a769d2a9
								
							
						
					
					
						commit
						00dbd667d5
					
				
					 4 changed files with 19 additions and 19 deletions
				
			
		|  | @ -78,7 +78,7 @@ set(KERNEL_SOURCES | ||||||
|     Graphics/Console/BootFramebufferConsole.cpp |     Graphics/Console/BootFramebufferConsole.cpp | ||||||
|     Graphics/Console/GenericFramebufferConsole.cpp |     Graphics/Console/GenericFramebufferConsole.cpp | ||||||
|     Graphics/Console/ContiguousFramebufferConsole.cpp |     Graphics/Console/ContiguousFramebufferConsole.cpp | ||||||
|     Graphics/Console/TextModeConsole.cpp |     Graphics/Console/VGATextModeConsole.cpp | ||||||
|     Graphics/DisplayConnector.cpp |     Graphics/DisplayConnector.cpp | ||||||
|     Graphics/Generic/DisplayConnector.cpp |     Graphics/Generic/DisplayConnector.cpp | ||||||
|     Graphics/GraphicsManagement.cpp |     Graphics/GraphicsManagement.cpp | ||||||
|  |  | ||||||
|  | @ -5,18 +5,18 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <Kernel/Arch/x86/IO.h> | #include <Kernel/Arch/x86/IO.h> | ||||||
| #include <Kernel/Graphics/Console/TextModeConsole.h> | #include <Kernel/Graphics/Console/VGATextModeConsole.h> | ||||||
| #include <Kernel/Graphics/GraphicsManagement.h> | #include <Kernel/Graphics/GraphicsManagement.h> | ||||||
| #include <Kernel/Sections.h> | #include <Kernel/Sections.h> | ||||||
| 
 | 
 | ||||||
| namespace Kernel::Graphics { | namespace Kernel::Graphics { | ||||||
| 
 | 
 | ||||||
| UNMAP_AFTER_INIT NonnullRefPtr<TextModeConsole> TextModeConsole::initialize() | UNMAP_AFTER_INIT NonnullRefPtr<VGATextModeConsole> VGATextModeConsole::initialize() | ||||||
| { | { | ||||||
|     return adopt_ref(*new TextModeConsole()); |     return adopt_ref(*new VGATextModeConsole()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| UNMAP_AFTER_INIT TextModeConsole::TextModeConsole() | UNMAP_AFTER_INIT VGATextModeConsole::VGATextModeConsole() | ||||||
|     : Console(80, 25) |     : Console(80, 25) | ||||||
|     , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value()) |     , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value()) | ||||||
|     , m_current_vga_window(m_vga_region->vaddr().offset(0x18000).as_ptr()) |     , m_current_vga_window(m_vga_region->vaddr().offset(0x18000).as_ptr()) | ||||||
|  | @ -24,7 +24,7 @@ UNMAP_AFTER_INIT TextModeConsole::TextModeConsole() | ||||||
|     for (size_t index = 0; index < height(); index++) { |     for (size_t index = 0; index < height(); index++) { | ||||||
|         clear_vga_row(index); |         clear_vga_row(index); | ||||||
|     } |     } | ||||||
|     dbgln("Text mode console initialized!"); |     dbgln("VGA Text mode console initialized!"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| enum VGAColor : u8 { | enum VGAColor : u8 { | ||||||
|  | @ -86,24 +86,24 @@ enum VGAColor : u8 { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TextModeConsole::set_cursor(size_t x, size_t y) | void VGATextModeConsole::set_cursor(size_t x, size_t y) | ||||||
| { | { | ||||||
|     SpinlockLocker lock(m_vga_lock); |     SpinlockLocker lock(m_vga_lock); | ||||||
|     GraphicsManagement::the().set_vga_text_mode_cursor(width(), x, y); |     GraphicsManagement::the().set_vga_text_mode_cursor(width(), x, y); | ||||||
|     m_x = x; |     m_x = x; | ||||||
|     m_y = y; |     m_y = y; | ||||||
| } | } | ||||||
| void TextModeConsole::hide_cursor() | void VGATextModeConsole::hide_cursor() | ||||||
| { | { | ||||||
|     SpinlockLocker lock(m_vga_lock); |     SpinlockLocker lock(m_vga_lock); | ||||||
|     GraphicsManagement::the().disable_vga_text_mode_console_cursor(); |     GraphicsManagement::the().disable_vga_text_mode_console_cursor(); | ||||||
| } | } | ||||||
| void TextModeConsole::show_cursor() | void VGATextModeConsole::show_cursor() | ||||||
| { | { | ||||||
|     set_cursor(m_x, m_y); |     set_cursor(m_x, m_y); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TextModeConsole::clear(size_t x, size_t y, size_t length) | void VGATextModeConsole::clear(size_t x, size_t y, size_t length) | ||||||
| { | { | ||||||
|     SpinlockLocker lock(m_vga_lock); |     SpinlockLocker lock(m_vga_lock); | ||||||
|     auto* buf = (u16*)m_current_vga_window.offset((x * 2) + (y * width() * 2)).as_ptr(); |     auto* buf = (u16*)m_current_vga_window.offset((x * 2) + (y * width() * 2)).as_ptr(); | ||||||
|  | @ -111,12 +111,12 @@ void TextModeConsole::clear(size_t x, size_t y, size_t length) | ||||||
|         buf[index] = 0x0720; |         buf[index] = 0x0720; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| void TextModeConsole::write(size_t x, size_t y, char ch, bool critical) | void VGATextModeConsole::write(size_t x, size_t y, char ch, bool critical) | ||||||
| { | { | ||||||
|     write(x, y, ch, m_default_background_color, m_default_foreground_color, critical); |     write(x, y, ch, m_default_background_color, m_default_foreground_color, critical); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TextModeConsole::write(size_t x, size_t y, char ch, Color background, Color foreground, bool critical) | void VGATextModeConsole::write(size_t x, size_t y, char ch, Color background, Color foreground, bool critical) | ||||||
| { | { | ||||||
|     SpinlockLocker lock(m_vga_lock); |     SpinlockLocker lock(m_vga_lock); | ||||||
|     // If we are in critical printing mode, we need to handle new lines here
 |     // If we are in critical printing mode, we need to handle new lines here
 | ||||||
|  | @ -144,12 +144,12 @@ void TextModeConsole::write(size_t x, size_t y, char ch, Color background, Color | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TextModeConsole::clear_vga_row(u16 row) | void VGATextModeConsole::clear_vga_row(u16 row) | ||||||
| { | { | ||||||
|     clear(0, row, width()); |     clear(0, row, width()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TextModeConsole::write(char ch, bool critical) | void VGATextModeConsole::write(char ch, bool critical) | ||||||
| { | { | ||||||
|     write(m_x, m_y, ch, critical); |     write(m_x, m_y, ch, critical); | ||||||
| } | } | ||||||
|  | @ -12,9 +12,9 @@ | ||||||
| #include <Kernel/Locking/Spinlock.h> | #include <Kernel/Locking/Spinlock.h> | ||||||
| 
 | 
 | ||||||
| namespace Kernel::Graphics { | namespace Kernel::Graphics { | ||||||
| class TextModeConsole final : public Console { | class VGATextModeConsole final : public Console { | ||||||
| public: | public: | ||||||
|     static NonnullRefPtr<TextModeConsole> initialize(); |     static NonnullRefPtr<VGATextModeConsole> initialize(); | ||||||
|     virtual size_t chars_per_line() const override { return width(); }; |     virtual size_t chars_per_line() const override { return width(); }; | ||||||
| 
 | 
 | ||||||
|     virtual bool has_hardware_cursor() const override { return true; } |     virtual bool has_hardware_cursor() const override { return true; } | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
| private: | private: | ||||||
|     void clear_vga_row(u16 row); |     void clear_vga_row(u16 row); | ||||||
| 
 | 
 | ||||||
|     TextModeConsole(); |     VGATextModeConsole(); | ||||||
| 
 | 
 | ||||||
|     mutable Spinlock m_vga_lock; |     mutable Spinlock m_vga_lock; | ||||||
| 
 | 
 | ||||||
|  | @ -35,7 +35,7 @@ | ||||||
| #include <Kernel/Firmware/ACPI/Parser.h> | #include <Kernel/Firmware/ACPI/Parser.h> | ||||||
| #include <Kernel/Firmware/Hypervisor/VMWareBackdoor.h> | #include <Kernel/Firmware/Hypervisor/VMWareBackdoor.h> | ||||||
| #include <Kernel/Graphics/Console/BootFramebufferConsole.h> | #include <Kernel/Graphics/Console/BootFramebufferConsole.h> | ||||||
| #include <Kernel/Graphics/Console/TextModeConsole.h> | #include <Kernel/Graphics/Console/VGATextModeConsole.h> | ||||||
| #include <Kernel/Graphics/GraphicsManagement.h> | #include <Kernel/Graphics/GraphicsManagement.h> | ||||||
| #include <Kernel/Heap/kmalloc.h> | #include <Kernel/Heap/kmalloc.h> | ||||||
| #include <Kernel/Interrupts/APIC.h> | #include <Kernel/Interrupts/APIC.h> | ||||||
|  | @ -208,7 +208,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info) | ||||||
|         if (!multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB) { |         if (!multiboot_framebuffer_addr.is_null() && multiboot_framebuffer_type == MULTIBOOT_FRAMEBUFFER_TYPE_RGB) { | ||||||
|             g_boot_console = &try_make_ref_counted<Graphics::BootFramebufferConsole>(multiboot_framebuffer_addr, multiboot_framebuffer_width, multiboot_framebuffer_height, multiboot_framebuffer_pitch).value().leak_ref(); |             g_boot_console = &try_make_ref_counted<Graphics::BootFramebufferConsole>(multiboot_framebuffer_addr, multiboot_framebuffer_width, multiboot_framebuffer_height, multiboot_framebuffer_pitch).value().leak_ref(); | ||||||
|         } else { |         } else { | ||||||
|             g_boot_console = &Graphics::TextModeConsole::initialize().leak_ref(); |             g_boot_console = &Graphics::VGATextModeConsole::initialize().leak_ref(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     dmesgln("Starting SerenityOS..."); |     dmesgln("Starting SerenityOS..."); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A