diff --git a/release_notes.md b/release_notes.md deleted file mode 100644 index 8ed4b4e..0000000 --- a/release_notes.md +++ /dev/null @@ -1,88 +0,0 @@ -# BoredOS 26.4 "Voyager" - -**Welcome to BoredOS Voyager**, the next generation of the BoredOS kernel featuring significant architectural improvements and system-level refinements. - ---- - -## Kernel Upgrade - -The headline of this release is the **Kernel 4.0.0** upgrade, a major step forward from Kernel 3.2.3, bringing enhanced stability and performance improvements. - -- **Kernel Version**: Boredkernel 4.0.0-stable -- **Major Focus**: Multi-processor reliability and VFS infrastructure - ---- - -## Virtual File System (VFS) - -A new VFS layer implementation, providing robust path normalization and mount management. - -- **Path Normalization**: Proper handling of relative and absolute paths -- **Mount System**: Support for multiple filesystem mounts -- **Stability**: Comprehensive error handling and resource management - ---- - -## System Introspection - -New kernel introspection frameworks enabling real-time system monitoring: - -- **SysFS**: Virtual filesystem exposing system information and device states - - Graphics information (resolution, framebuffer details) - - Memory tracking and allocation statistics - - Module information - -- **ProcFS**: Process filesystem with enhanced process information exposure - ---- - -## Storage & Filesystem - -Significant improvements to disk and filesystem handling: - -- **FAT32 Enhancements**: Major refactor with improved file operations -- **AHCI Driver**: Better disk controller support and reliability -- **Disk Manager**: Refined disk operation handling - ---- - -## Performance & Stability - -- **SMP Improvements**: Enhanced multi-processor support and synchronization -- **Kernel Subsystem Architecture**: Reorganized for better modularity -- **Syscall System**: Refined syscall interface for better reliability - ---- - -## User Interface & Tools - -- **Task Manager**: Improved process viewing and management -- **File Explorer**: Removed legacy drive selector for streamlined operation -- **Standard Library**: Added `strstr()` and `strchr()` string functions - ---- - - - ---- - -## Installation & Updates - -To update to the latest version, pull the latest changes from the repository and rebuild your environment: - -```bash -git pull -make clean -make -``` - -Or download the provided `.iso` from this release. - -## 🔐 Security & Verification -If downloading from a third-party source, please verify your image. -SHA-256 Hash: ```55cca8f07b9570276afbdc8eb71b1a9c9a34ebd003ae9754a8371e00ece8e986``` - - ---- - - diff --git a/src/core/version.c b/src/core/version.c index 1675bbf..0be079d 100644 --- a/src/core/version.c +++ b/src/core/version.c @@ -16,7 +16,7 @@ void get_os_info(os_info_t *info) { const char *os_version = "26.4"; const char *os_codename = "Voyager"; const char *kernel_name = "Boredkernel"; - const char *kernel_version = "4.0.0-stable"; + const char *kernel_version = "4.0.1-stable"; const char *build_date = __DATE__; const char *build_time = __TIME__; const char *build_arch = "x86_64"; diff --git a/src/fs/procfs.c b/src/fs/procfs.c index f472c32..0dab24d 100644 --- a/src/fs/procfs.c +++ b/src/fs/procfs.c @@ -56,7 +56,8 @@ int procfs_read(void *fs_private, void *handle, void *buf, int size) { procfs_handle_t *h = (procfs_handle_t*)handle; if (!h) return -1; - char out[1024]; + char *out = (char*)kmalloc(16384); + if (!out) return -1; out[0] = 0; if (h->pid == 0xFFFFFFFF) { @@ -291,7 +292,7 @@ int procfs_read(void *fs_private, void *handle, void *buf, int size) { } else { process_t *proc = process_get_by_pid(h->pid); - if (!proc) return -1; + if (!proc) { kfree(out); return -1; } if (k_strcmp(h->type, "name") == 0 || k_strcmp(h->type, "cmdline") == 0) { k_strcpy(out, proc->name); @@ -320,13 +321,14 @@ int procfs_read(void *fs_private, void *handle, void *buf, int size) { } int len = k_strlen(out); - if (h->offset >= len) return 0; + if (h->offset >= len) { kfree(out); return 0; } int to_copy = len - h->offset; if (to_copy > size) to_copy = size; k_memcpy(buf, out + h->offset, to_copy); h->offset += to_copy; + kfree(out); return to_copy; } diff --git a/src/sys/syscall.c b/src/sys/syscall.c index cd72824..8c5528f 100644 --- a/src/sys/syscall.c +++ b/src/sys/syscall.c @@ -415,10 +415,18 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = uy + font_manager_get_font_ascent_scaled(font, font->pixel_height) - 2; int cur_x = ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, font->pixel_height, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, font->pixel_height); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, font->pixel_height); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', font->pixel_height) * 4; + } else { + font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, font->pixel_height, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, font->pixel_height); + } } } else { draw_string(ux, uy, kernel_str, color); @@ -430,10 +438,18 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = win->y + uy + font_manager_get_font_ascent_scaled(font, font->pixel_height) - 2; int cur_x = win->x + ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, font->pixel_height, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, font->pixel_height); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, font->pixel_height); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', font->pixel_height) * 4; + } else { + font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, font->pixel_height, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, font->pixel_height); + } } } else { draw_string(win->x + ux, win->y + uy, kernel_str, color); @@ -519,10 +535,18 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = uy + font_manager_get_font_ascent_scaled(font, scale) - 2; int cur_x = ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, scale, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, scale); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', scale) * 4; + } else { + font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, scale, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + } } } else { draw_string_scaled(ux, uy, kernel_str, color, scale); @@ -534,10 +558,18 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = win->y + uy + font_manager_get_font_ascent_scaled(font, scale) - 2; int cur_x = win->x + ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, scale, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, scale); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', scale) * 4; + } else { + font_manager_render_char_scaled(font, cur_x, baseline, codepoint, color, scale, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + } } } else { draw_string_scaled(win->x + ux, win->y + uy, kernel_str, color, scale); @@ -595,11 +627,19 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = uy + font_manager_get_font_ascent_scaled(font, scale) - 2; int cur_x = ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { extern void font_manager_render_char_sloped(ttf_font_t *font, int x, int y, uint32_t codepoint, uint32_t color, float scale, float slope, void (*put_pixel_fn)(int, int, uint32_t)); uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_sloped(font, cur_x, baseline, codepoint, color, scale, slope, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, scale); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', scale) * 4; + } else { + font_manager_render_char_sloped(font, cur_x, baseline, codepoint, color, scale, slope, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + } } } else { draw_string_scaled_sloped(ux, uy, kernel_str, color, scale, slope); @@ -611,11 +651,19 @@ static uint64_t syscall_handler_inner(registers_t *regs) { int baseline = win->y + uy + font_manager_get_font_ascent_scaled(font, scale) - 2; int cur_x = win->x + ux; const char *s = kernel_str; + int start_x = cur_x; while (*s) { extern void font_manager_render_char_sloped(ttf_font_t *font, int x, int y, uint32_t codepoint, uint32_t color, float scale, float slope, void (*put_pixel_fn)(int, int, uint32_t)); uint32_t codepoint = utf8_decode(&s); - font_manager_render_char_sloped(font, cur_x, baseline, codepoint, color, scale, slope, put_pixel); - cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + if (codepoint == '\n') { + cur_x = start_x; + baseline += font_manager_get_font_line_height_scaled(font, scale); + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(font, ' ', scale) * 4; + } else { + font_manager_render_char_sloped(font, cur_x, baseline, codepoint, color, scale, slope, put_pixel); + cur_x += font_manager_get_codepoint_width_scaled(font, codepoint, scale); + } } } else { draw_string_scaled_sloped(win->x + ux, win->y + uy, kernel_str, color, scale, slope); diff --git a/src/sys/sysfs_init.c b/src/sys/sysfs_init.c index 886df13..b66bf47 100644 --- a/src/sys/sysfs_init.c +++ b/src/sys/sysfs_init.c @@ -132,8 +132,9 @@ static int read_pci_bus(char *buf, int size, int offset) { // --- CPU System Implementation --- static int read_cpu_info(char *buf, int size, int offset) { - char out[2048]; - k_memset(out, 0, 2048); + char *out = (char*)kmalloc(16384); + if (!out) return 0; + out[0] = 0; char vendor[16]; char model[64]; @@ -147,34 +148,105 @@ static int read_cpu_info(char *buf, int size, int offset) { uint32_t cpu_count = smp_cpu_count(); - k_strcpy(out, "Vendor: "); - k_strcpy(out + k_strlen(out), vendor); - k_strcpy(out + k_strlen(out), "\nModel: "); - k_strcpy(out + k_strlen(out), model); - k_strcpy(out + k_strlen(out), "\nCores: "); - char c_s[16]; k_itoa(cpu_count, c_s); - k_strcpy(out + k_strlen(out), c_s); - k_strcpy(out + k_strlen(out), "\nCPU Family: "); - k_itoa(info.family, c_s); - k_strcpy(out + k_strlen(out), c_s); - k_strcpy(out + k_strlen(out), "\nModel Number: "); - k_itoa(info.model, c_s); - k_strcpy(out + k_strlen(out), c_s); - k_strcpy(out + k_strlen(out), "\nStepping: "); - k_itoa(info.stepping, c_s); - k_strcpy(out + k_strlen(out), c_s); - k_strcpy(out + k_strlen(out), "\nCache Size: "); - k_itoa(info.cache_size, c_s); - k_strcpy(out + k_strlen(out), c_s); - k_strcpy(out + k_strlen(out), " KB\nSpeed: ~3.00 GHz\nFlags: "); - k_strcpy(out + k_strlen(out), flags); - k_strcpy(out + k_strlen(out), "\n"); + for (uint32_t i = 0; i < cpu_count; i++) { + char c_s[32]; + + k_strcpy(out + k_strlen(out), "processor\t: "); + k_itoa(i, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "vendor_id\t: "); + k_strcpy(out + k_strlen(out), vendor); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "cpu family\t: "); + k_itoa(info.family, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "model\t\t: "); + k_itoa(info.model, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "model name\t: "); + k_strcpy(out + k_strlen(out), model); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "stepping\t: "); + k_itoa(info.stepping, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "microcode\t: 0x"); + char hex[16]; + int temp = info.microcode; + int hex_pos = 0; + for (int j = 7; j >= 0; j--) { + int digit = (temp >> (j * 4)) & 0xF; + hex[hex_pos++] = digit < 10 ? '0' + digit : 'a' + (digit - 10); + } + hex[hex_pos] = '\0'; + k_strcpy(out + k_strlen(out), hex); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "cache size\t: "); + k_itoa(info.cache_size, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), " KB\n"); + + k_strcpy(out + k_strlen(out), "physical id\t: 0\n"); + k_strcpy(out + k_strlen(out), "siblings\t: "); + k_itoa(cpu_count, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "core id\t\t: "); + k_itoa(i, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "cpu cores\t: "); + k_itoa(cpu_count, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "apicid\t\t: "); + k_itoa(i, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "initial apicid\t: "); + k_itoa(i, c_s); + k_strcpy(out + k_strlen(out), c_s); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "fpu\t\t: yes\n"); + k_strcpy(out + k_strlen(out), "fpu_exception\t: yes\n"); + + k_strcpy(out + k_strlen(out), "cpuid level\t: 13\n"); + + k_strcpy(out + k_strlen(out), "wp\t\t: yes\n"); + + k_strcpy(out + k_strlen(out), "flags\t\t: "); + k_strcpy(out + k_strlen(out), flags); + k_strcpy(out + k_strlen(out), "\n"); + + k_strcpy(out + k_strlen(out), "bugs\t\t: \n"); + k_strcpy(out + k_strlen(out), "bogomips\t: 4800.00\n"); + + if (i < cpu_count - 1) { + k_strcpy(out + k_strlen(out), "\n"); + } + } int len = (int)k_strlen(out); - if (offset >= len) return 0; + if (offset >= len) { kfree(out); return 0; } int to_copy = len - offset; if (to_copy > size) to_copy = size; k_memcpy(buf, out + offset, to_copy); + kfree(out); return to_copy; } diff --git a/src/wm/font_manager.c b/src/wm/font_manager.c index 60dc70f..c873c65 100644 --- a/src/wm/font_manager.c +++ b/src/wm/font_manager.c @@ -330,6 +330,13 @@ int font_manager_get_string_width_scaled(ttf_font_t *font, const char *s, float while (*s) { int advance, lsb; uint32_t codepoint = utf8_decode(&s); + + if (codepoint == '\t') { + stbtt_GetCodepointHMetrics(info, ' ', &advance, &lsb); + width += (int)(advance * real_scale + 0.5f) * 4; + continue; + } + stbtt_fontinfo *current_info = info; float current_scale = real_scale; @@ -350,6 +357,12 @@ int font_manager_get_codepoint_width_scaled(ttf_font_t *font, uint32_t codepoint stbtt_fontinfo *info = (stbtt_fontinfo *)font->info; float real_scale = stbtt_ScaleForPixelHeight(info, scale); + if (codepoint == '\t') { + int advance, lsb; + stbtt_GetCodepointHMetrics(info, ' ', &advance, &lsb); + return (int)(advance * real_scale + 0.5f) * 4; + } + if (stbtt_FindGlyphIndex(info, codepoint) == 0 && fallback_font) { info = (stbtt_fontinfo *)fallback_font->info; real_scale = stbtt_ScaleForPixelHeight(info, scale); diff --git a/src/wm/graphics.c b/src/wm/graphics.c index 8315508..3e2f45f 100644 --- a/src/wm/graphics.c +++ b/src/wm/graphics.c @@ -555,6 +555,8 @@ void draw_string_bitmap(int x, int y, const char *str, uint32_t color) { if (*s == '\n') { cur_x = x; cur_y += 10; + } else if (*s == '\t') { + cur_x += 8 * 4; } else { draw_char_bitmap(cur_x, cur_y, *s, color); cur_x += 8; @@ -583,8 +585,9 @@ int graphics_get_string_width_scaled(const char *s, float scale) { } int len = 0; while (s && *s) { - utf8_decode(&s); - len++; + uint32_t codepoint = utf8_decode(&s); + if (codepoint == '\t') len += 4; + else len++; } return len * 8; // Fallback bitmap width } @@ -607,6 +610,8 @@ void draw_string_scaled(int x, int y, const char *s, uint32_t color, float scale if (codepoint == '\n') { cur_x = x; baseline += line_height; + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(g_current_ttf, ' ', scale) * 4; } else { font_manager_render_char_scaled(g_current_ttf, cur_x, baseline, codepoint, color, scale, put_pixel); cur_x += font_manager_get_codepoint_width_scaled(g_current_ttf, codepoint, scale); @@ -621,6 +626,8 @@ void draw_string_scaled(int x, int y, const char *s, uint32_t color, float scale if (codepoint == '\n') { cur_x = x; cur_y += 10; + } else if (codepoint == '\t') { + cur_x += 8 * 4; } else { draw_char(cur_x, cur_y, (codepoint < 128) ? (char)codepoint : '?', color); cur_x += 8; @@ -646,6 +653,8 @@ void draw_string_scaled_sloped(int x, int y, const char *s, uint32_t color, floa if (codepoint == '\n') { cur_x = x; baseline += line_height; + } else if (codepoint == '\t') { + cur_x += font_manager_get_codepoint_width_scaled(g_current_ttf, ' ', scale) * 4; } else { font_manager_render_char_sloped(g_current_ttf, cur_x, baseline, codepoint, color, scale, slope, put_pixel); cur_x += font_manager_get_codepoint_width_scaled(g_current_ttf, codepoint, scale);