From 03f87723d1b7c2a56bbbe9a69a8f3e08575d239e Mon Sep 17 00:00:00 2001 From: xamidev Date: Fri, 20 Mar 2026 10:04:16 +0100 Subject: [PATCH] Splash --- include/config.h | 9 ++++++++- src/arch/x86/cpuid.c | 11 ++++++----- src/arch/x86/init.c | 28 +++++++++++++++++++++++----- src/kmain.c | 16 +++++----------- src/sched/scheduler.c | 4 ++-- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/include/config.h b/include/config.h index 0231bf0..3a1e9e3 100644 --- a/include/config.h +++ b/include/config.h @@ -11,7 +11,14 @@ #define PEPPEROS_VERSION_MAJOR "0" #define PEPPEROS_VERSION_MINOR "0" #define PEPPEROS_VERSION_PATCH "58" -#define PEPPEROS_SPLASH "\x1b[38;5;196mPepperOS\x1b[0m version \x1b[38;5;220m"PEPPEROS_VERSION_MAJOR"."PEPPEROS_VERSION_MINOR"."PEPPEROS_VERSION_PATCH"\x1b[0m built on \x1b[38;5;40m"__DATE__" "__TIME__"\x1b[0m\n" +#define PEPPEROS_SPLASH \ +"\x1b[38;5;196m \x1b[38;5;231m____ _____\r\n\x1b[0m"\ +"\x1b[38;5;196m ____ ___ ____ ____ ___ _____\x1b[38;5;231m/ __ \\/ ___/\r\n\x1b[0m"\ +"\x1b[38;5;196m / __ \\/ _ \\/ __ \\/ __ \\/ _ \\/ ___\x1b[38;5;231m/ / / /\\__ \\ \r\n\x1b[0m"\ +"\x1b[38;5;196m / /_/ / __/ /_/ / /_/ / __/ / \x1b[38;5;231m/ /_/ /___/ / \r\n\x1b[0m"\ +"\x1b[38;5;196m / .___/\\___/ .___/ .___/\\___/_/ \x1b[38;5;231m\\____//____/ \r\n\x1b[0m"\ +"\x1b[38;5;196m/_/ /_/ /_/ \r\n\x1b[0m"\ +" --- version \x1b[38;5;220m"PEPPEROS_VERSION_MAJOR"."PEPPEROS_VERSION_MINOR"."PEPPEROS_VERSION_PATCH"\x1b[0m built on \x1b[38;5;40m"__DATE__" "__TIME__"\x1b[0m\r\n" /* process */ #define PROCESS_NAME_MAX 64 diff --git a/src/arch/x86/cpuid.c b/src/arch/x86/cpuid.c index 2d96368..b4a9a55 100644 --- a/src/arch/x86/cpuid.c +++ b/src/arch/x86/cpuid.c @@ -5,14 +5,15 @@ */ #include +#include /* * cpuid - Wrapper for CPUID instruction - * @leaf: Requested leaf - * @eax: EAX register value - * @ebx: EBX register value - * @ecx: ECX register value - * @edx: EDX register value + * @leaf: Requested leaf (input EAX) + * @eax: EAX register value (output) + * @ebx: EBX register value (output) + * @ecx: ECX register value (output) + * @edx: EDX register value (output) */ void cpuid(uint32_t leaf, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) { diff --git a/src/arch/x86/init.c b/src/arch/x86/init.c index 0a97bff..9d74333 100644 --- a/src/arch/x86/init.c +++ b/src/arch/x86/init.c @@ -4,10 +4,30 @@ * @license GPL-3.0-only */ +#include #include #include #include +/* + * x86_overwrite_pat - Set PAT to WC + * + * This function overwrites the 1st Page Attribute + * Table entry, to enable the Write-Combining property + * when we map memory regions later on. + * The framebuffer will be mapped with WC, which makes + * memory access significantly faster by using burst + * operations. +*/ + +static void x86_overwrite_pat() +{ + uint64_t pat = rdmsr(0x277); + pat &= ~(0xFFULL << 8); // Clear PAT1 + pat |= (0x01ULL << 8); // PAT1 = 0x01 (WC) + wrmsr(0x277, pat); +} + /* * x86_arch_init - Initialize x86 CPU structures * @@ -20,9 +40,7 @@ */ void x86_arch_init() { - uint64_t pat = rdmsr(0x277); - pat &= ~(0xFFULL << 8); // Clear PAT1 - pat |= (0x01ULL << 8); // PAT1 = 0x01 (WC) - wrmsr(0x277, pat); - DEBUG("Overrode PAT1 entry to set up Write-Combining"); + x86_overwrite_pat(); + idt_init(); + gdt_init(); } \ No newline at end of file diff --git a/src/kmain.c b/src/kmain.c index 56aca6f..1a83b8f 100644 --- a/src/kmain.c +++ b/src/kmain.c @@ -69,7 +69,7 @@ struct process_t* idle_proc; // Never gets executed although pedicel is scheduled? void pedicel_main(void* arg) { - printf("\n\nWelcome to PepperOS! Pedicel speaking.\r\nNothing left to do, let's go idle!\r\n"); + printf("\n\n\rWelcome to PepperOS! Pedicel speaking.\r\nNothing left to do, let's go idle!\r\n"); } void idle_main(void* arg) @@ -81,11 +81,10 @@ void idle_main(void* arg) void thing_main(void* arg) { -/* printf("What's your name, pal? "); + printf("What's your name, pal? "); char name[10]; keyboard_getline(name, 10); - printf("\r\n{%s} is such a nice name!\r\n", name); */ - while (ticks < 500); + printf("\r\n{%s} is such a nice name!\r\n", name); } extern uintptr_t kheap_start; @@ -118,23 +117,18 @@ void kmain() boot_mem_display(); pmm_init(boot_ctx); - // Remap kernel , HHDM and framebuffer paging_init(boot_ctx); kheap_init(); keyboard_init(FR); - - gdt_init(); - idt_init(); process_init(); idle_proc = process_create("idle", (void*)idle_main, 0); - struct process_t* pedicel = process_create("pedicel", (void*)pedicel_main, 0); + process_create("pedicel", (void*)pedicel_main, 0); process_create("thing", thing_main, NULL); - process_display_list(processes_list); scheduler_init(); - kputs(PEPPEROS_SPLASH); + printf(PEPPEROS_SPLASH); idle(); } diff --git a/src/sched/scheduler.c b/src/sched/scheduler.c index a03e314..34acfdf 100644 --- a/src/sched/scheduler.c +++ b/src/sched/scheduler.c @@ -64,9 +64,9 @@ struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context) return idle_proc->context; } else { current_process->status = RUNNING; - if (prev_process != current_process) { +/* if (prev_process != current_process) { DEBUG("Changed from {pid=%u, name=%s} to {pid=%u, name=%s}", prev_process->pid, prev_process->name, current_process->pid, current_process->name); - } + } */ break; } }