From 36e9e3c23a256ac267a4e953413134fa7f207418 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Mon, 4 Nov 2024 12:46:37 +0100 Subject: [PATCH 1/5] fix the Copyright disclaimer --- kernel/src/cmd/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/src/cmd/mod.rs b/kernel/src/cmd/mod.rs index 5b38009..5989a50 100644 --- a/kernel/src/cmd/mod.rs +++ b/kernel/src/cmd/mod.rs @@ -44,8 +44,7 @@ fn cc(_args: Vec<&str>) -> i32 { This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + the Free Software Foundation,version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From 45809088835ed43d199afc0fda111b25aa64cae0 Mon Sep 17 00:00:00 2001 From: Sebaguardian <68247013+Sebaguardian@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:23:45 +0100 Subject: [PATCH 2/5] docs(pl): fix Git hyperlink (#33) --- README-pl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-pl.md b/README-pl.md index 4536baf..ac0fcc4 100644 --- a/README-pl.md +++ b/README-pl.md @@ -29,7 +29,7 @@ x86_64 System Operacyjny (kernel) zrobiony od zera w Assembly & Rust ## Budowa ze źródła na Linuxie ### Główny Kernel **Wymagania:** - - System kontroli wersji[Git] (https://git-scm.com) + - System kontroli wersji [Git](https://git-scm.com) - [Rust toolchain](https://www.rust-lang.org/tools/install) **Kroki:** From 6546249c356572bc8de4b77fe9d6a2122db91c36 Mon Sep 17 00:00:00 2001 From: nyx Date: Sat, 9 Nov 2024 05:07:51 -0500 Subject: [PATCH 3/5] fix cursor issues (#34) closes #9 --- kernel/src/vga_buffer.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kernel/src/vga_buffer.rs b/kernel/src/vga_buffer.rs index 858dfb0..f2e8d58 100644 --- a/kernel/src/vga_buffer.rs +++ b/kernel/src/vga_buffer.rs @@ -132,6 +132,22 @@ pub struct Writer { } impl Writer { + fn update_cursor(&mut self) { + let pos = (BUFFER_HEIGHT - 1) * BUFFER_WIDTH + self.column_position; + unsafe { + let mut port = x86_64::instructions::port::Port::new(0x3D4); + port.write(0x0F_u8); + let mut data_port = x86_64::instructions::port::Port::new(0x3D5); + data_port.write((pos & 0xFF) as u8); + port.write(0x0E_u8); + data_port.write(((pos >> 8) & 0xFF) as u8); + } + self.buffer.chars[BUFFER_HEIGHT - 1][self.column_position].write(ScreenChar { + ascii_character: b' ', + color_code: self.color_code, + }); + } + pub fn write_byte(&mut self, byte: u8) { match byte { b'\n' => self.new_line(), @@ -149,6 +165,7 @@ impl Writer { color_code, }); self.column_position += 1; + self.update_cursor(); } } } @@ -171,6 +188,7 @@ impl Writer { } self.clear_row(BUFFER_HEIGHT - 1); self.column_position = 0; + self.update_cursor(); } fn clear_row(&mut self, row: usize) { @@ -188,6 +206,7 @@ impl Writer { self.clear_row(row); } self.column_position = 0; + self.update_cursor(); } pub fn change_color(&mut self, fgc: Color, bgc: Color) { From e6f2c485cb760266c055e22da294e8c4062f2b8f Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Sat, 9 Nov 2024 11:42:45 +0100 Subject: [PATCH 4/5] fix a bug in #34 --- kernel/src/vga_buffer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/src/vga_buffer.rs b/kernel/src/vga_buffer.rs index f2e8d58..1539eec 100644 --- a/kernel/src/vga_buffer.rs +++ b/kernel/src/vga_buffer.rs @@ -165,7 +165,10 @@ impl Writer { color_code, }); self.column_position += 1; - self.update_cursor(); + + if self.column_position < BUFFER_WIDTH { + self.update_cursor(); + } } } } From aa9653599b23b134284b89421264c7965be1986a Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Sat, 9 Nov 2024 11:51:49 +0100 Subject: [PATCH 5/5] fix: inc/dec cusrsor pos --- kernel/src/vga_buffer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/src/vga_buffer.rs b/kernel/src/vga_buffer.rs index 1539eec..38dcf4d 100644 --- a/kernel/src/vga_buffer.rs +++ b/kernel/src/vga_buffer.rs @@ -226,9 +226,11 @@ impl Writer { pub fn decrement_column_position(&mut self) { self.column_position -= 1; + self.update_cursor(); } pub fn increment_column_position(&mut self) { self.column_position += 1; + self.update_cursor(); } }