diff options
author | Galen Sagarin <gps5307@rit.edu> | 2025-05-06 15:05:22 -0400 |
---|---|---|
committer | Galen Sagarin <gps5307@rit.edu> | 2025-05-06 15:05:22 -0400 |
commit | e4324f180c31ebf06206be6dff5f3863d6ec2675 (patch) | |
tree | 73f197fe28c8cc9efdb113b9702790d0085caaff /kernel | |
parent | tar.c documentation (diff) | |
parent | start docs (diff) | |
download | comus-e4324f180c31ebf06206be6dff5f3863d6ec2675.tar.gz comus-e4324f180c31ebf06206be6dff5f3863d6ec2675.tar.bz2 comus-e4324f180c31ebf06206be6dff5f3863d6ec2675.zip |
Merge branch 'main' of https://github.com/kenshineto/kern
Should have fixed
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/efi/gop.c | 4 | ||||
-rw-r--r-- | kernel/fs/ramfs.c | 16 | ||||
-rw-r--r-- | kernel/include/comus/limits.h | 2 | ||||
-rw-r--r-- | kernel/procs.c | 1 | ||||
-rw-r--r-- | kernel/term.c | 26 |
5 files changed, 36 insertions, 13 deletions
diff --git a/kernel/efi/gop.c b/kernel/efi/gop.c index 899bbee..5495980 100644 --- a/kernel/efi/gop.c +++ b/kernel/efi/gop.c @@ -4,6 +4,8 @@ static EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; +#define MAX_H_RES 1920 + EFI_STATUS efi_load_gop(EFI_SYSTEM_TABLE *ST) { EFI_STATUS status = EFI_SUCCESS; @@ -33,6 +35,8 @@ EFI_STATUS efi_load_gop(EFI_SYSTEM_TABLE *ST) if (info->PixelFormat != PixelBlueGreenRedReserved8BitPerColor && info->PixelFormat != PixelRedGreenBlueReserved8BitPerColor) continue; + if (info->HorizontalResolution > MAX_H_RES) + continue; if (info->HorizontalResolution > width) { width = info->HorizontalResolution; best = i; diff --git a/kernel/fs/ramfs.c b/kernel/fs/ramfs.c index e9d5bc2..0c92c96 100644 --- a/kernel/fs/ramfs.c +++ b/kernel/fs/ramfs.c @@ -1,5 +1,5 @@ -/*#include <comus/fs.h> -#include <lib.h> +#include <comus/fs.h> +/*#include <lib.h> //#include <comus/tar.h> //#include <string.h> #include <comus/ramfs.h> @@ -36,7 +36,7 @@ int ramfs_delete(const char *name) { kfree(allTheFiles[i].data); for(int j = i; j < numberOfFiles; j++) { allTheFiles[j] = allTheFiles[j+1]; - numberOfFiles -= 1; + numberOfFiles -= 1; } return NOERROR; @@ -62,7 +62,7 @@ int ramfs_write(const char *name, char *buffer) { } // here we return the index of the file as well. -/*int ramfs_find_file(root *r, const char *fullpath, const char *name, file *out, directory *outDirectory) { +*int ramfs_find_file(root *r, const char *fullpath, const char *name, file *out, directory *outDirectory) { directory *location = r->root; if(ramfs_find_directory(r, fullpath, name, location) == NOERROR) { for(int i = 0; i < location->file_count; i++) { @@ -89,14 +89,14 @@ int ramfs_find_directory(root *r, const char *fullpath, const char *name, direct location = location->directories[i]; wasItFound = true; break; - + } } if(!wasItFound) { return ERROR; } tempPath = strtok(NULL, "/"); - + } out = location; return NOERROR; @@ -142,7 +142,7 @@ int ramfs_delete_file(root *r, const char *fullpath, const char *name) { return NOERROR; } return ERROR; - + } return ERROR; } @@ -155,7 +155,7 @@ int ramfs_delete_directory() { } int ramfs_write() { - + } diff --git a/kernel/include/comus/limits.h b/kernel/include/comus/limits.h index 1ef13b4..a036fcb 100644 --- a/kernel/include/comus/limits.h +++ b/kernel/include/comus/limits.h @@ -7,7 +7,7 @@ */ /// number of pts to identity map the kernel (1pt = 2MB) -#define N_IDENT_PTS 4 // max 512 (1G) +#define N_IDENT_PTS 64 // max 512 (1G) /// max number of processes #define N_PROCS 256 diff --git a/kernel/procs.c b/kernel/procs.c index d471416..6017e3a 100644 --- a/kernel/procs.c +++ b/kernel/procs.c @@ -1,4 +1,3 @@ -#include "lib/kio.h" #include <comus/drivers/pit.h> #include <comus/syscalls.h> #include <comus/memory.h> diff --git a/kernel/term.c b/kernel/term.c index 917f645..88fa072 100644 --- a/kernel/term.c +++ b/kernel/term.c @@ -7,8 +7,10 @@ // terminal data static char buffer[TERM_MAX_WIDTH * TERM_MAX_HEIGHT]; static uint16_t buffer_line = UINT16_MAX; -static uint16_t width = 80; // baseline vga text mode until resized -static uint16_t height = 25; +static uint16_t last_width = 80, + width = 80; // baseline vga text mode until resized +static uint16_t last_height = 25, height = 25; +static uint16_t scrolling = 0; static uint16_t x = 0; static uint16_t y = 0; @@ -140,10 +142,26 @@ void term_redraw(void) for (uint16_t j = 0; j < height; j++) { for (uint16_t i = 0; i < width; i++) { - char c = buffer[BUFIDX(i, j)]; + char c; + + c = buffer[BUFIDX(i, j)]; + + // if screen hasnet changed size + // dont redraw what we dont need to redraw + if (last_width == height && last_width == width) { + char prev; + prev = buffer[BUFIDX(i, (j - scrolling))]; + if (c == prev) + continue; + } + gpu_draw_char(c, i, j); } } + + last_width = width; + last_height = height; + scrolling = 0; } void term_scroll(uint16_t lines) @@ -151,6 +169,8 @@ void term_scroll(uint16_t lines) if (!lines) return; buffer_line += lines; + term_clear_line(y); + scrolling = lines; term_redraw(); } |