summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-02-24kernel: string: add a strcpy functionDanny Holman
Add an implmentation of strcpy. This function is used in several places in the kernel to copy strings between memory addresses. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-24arch: i386: cleanup everything and reorganizeDanny Holman
Clean up everything in the i386 arch directory. This code has been in dire need of refactoring for a long while. All the inline assembly functions and the data structures related to the architecture should be placed into their own header file. Now the scheduler can access registers and ISRs without having to deal with arch-specific code. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-24arch: i386: move jump_userspace to its own fileDanny Holman
Move the function that jumps to ring 3 to its own assembly file. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-21README: update copyright lineDanny Holman
Update the copyright year and contact email in the README file. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: add basic keyboard driverDanny Holman
Add a basic driver for the PS/2 keyboard. This driver just prints whatever it receives back out to the framebuffer. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16kernel: panic: add a variable that locks other CPUsDanny Holman
Add a static variable to the panic function that should lock all other CPUs. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: roll physical memory control into VMMDanny Holman
The VMM should control the physical memory as well as paging. This allows the VMM to grab frames as it sees fit. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: move GDT definitions to their own headerDanny Holman
Move all the data structures required for operation of the GDT to their own header file. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: multiboot: move arch-specific inits hereDanny Holman
Move all the architecture-specific initialization calls to this file. This frees up the main function to initialize other parts of the kernel. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: move IRQ functions to PIC driverDanny Holman
Move all the functions that control IRQ lines to the PIC driver. This allows the IDT controller to handle only raw interrupts no matter where they come from. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: move raw assembly calls to their own headerDanny Holman
Move simple assembly calls to their own header. All one or two line assembly calls should be defined in a single place. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16kernel: mem: kmalloc should not call page allocationDanny Holman
Strip the code calling for the memory manager to allocate pages to kmalloc. The function should just return a raw pointer while a page fault will allocate the required memory. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16kernel: add a panic functionDanny Holman
Add a panic function that stops the current CPU and prints an error message into the ring buffer. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: syscall.c: add functions that dump dataDanny Holman
Add functions to the syscall handlers that dump registers and stack in case of catastrophic failure. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: gdt.c: fix a bug in userspace jumpDanny Holman
Fix a bug in the GDT that prevented the kernel from jumping to userspace correctly. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: boot: ISR frame should not include ESPDanny Holman
The code that constructs an isr_frame struct should not push ESP to the stack. In addition, the kernel should set its own copy of ESP into a function defined elsewhere for scheduling purposes. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16Makefile: add flags to qemu that activate the serial portDanny Holman
Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: add operations to control PIT timerDanny Holman
Add a set of functions that control the programmable interrupt timer. This will be used as the primary means of preemption on this architecture. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16include: kernel: add the container_of.h fileDanny Holman
Add the container_of.h file that defines the container_of macro. This macro allows the kernel to get the parent struct of a pointer with an offset. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16kernel: string: add more functions to string libraryDanny Holman
Add more functions to the string library to process buffers and strings. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: put framebuffer ops in own fileDanny Holman
Move all operations related to the x86 framebuffer into its own set of files. This makes the TTY layer more architecture agnostic. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16arch: i386: kernel: the serial driver should be more POSIX-yDanny Holman
Make the serial driver behave more like a standard POSIX call. It should have write and read functions that call architecture specific functions. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16kernel: make kprintf print to a ring bufferDanny Holman
The function kprintf should print to an internal ringbuffer instead of directly to the framebuffer. This reduces dependence on the existence of a framebuffer in the first place. Signed-off-by: Danny Holman <dholman@gymli.org>
2024-02-16include: kernel: move list.h to a data struct directoryDanny Holman
Move list.h into a designated directory for data structure definitions. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: alloc: remove erroneous halt instructionDanny Holman
Remove an inline assembly instruction that was placed for debugging purposes. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: make: add source filesDanny Holman
Add new source files to the x86 architecture build configuration. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: linker.ld: add references to the bitmapDanny Holman
Add references to the PMM bitmap to the linker script. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26kernel: list: add a linked-list implementationDanny Holman
Add a linked-list implementation using the kmalloc system. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26kernel: mem: add a simple kmalloc implementationDanny Holman
Add a simple implementation of kmalloc. This system only works on x86-based processors at the time of commit. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: paging: add a proper paging APIDanny Holman
Add a proper page control API. These functions allow the kernel to directly map and unmap pages in the logical address space. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: alloc: add a physical memory managerDanny Holman
Add a simple, bitmap-based physical memory management system. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: add multiboot supportDanny Holman
Add support for the multiboot specification. These files will allow the kernel to read the multiboot header information as well as the provided memory map. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: serial.c: make serial_writestring staticDanny Holman
Make the function serial_writestring static. This is an optimization specifically for small functions such as this one. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: tty.c: remove unneeded local variableDanny Holman
Remove an unused local variable from tty_putchar. Instead, just cast the signed char to unsigned as needed. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: syscall.c: replace function calls with single switchDanny Holman
Replace individual function calls with a single switch-case structure for system calls. The new function, handle_syscall, will construct and call the interrupt without input from the programmer. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: pic.c: finish implementing functions from pic.hDanny Holman
Finish implementing pic_eoi and similar. This allows standardized communication with the x86 PIC chip. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: syscall.h: define some example system callsDanny Holman
Define a few standard Unix system calls. These may change based on future needs. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: pic.h: make register_irq_handler accessibleDanny Holman
Make the register_irq_function accessible from files including pic.h. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: pic.h: change all chars into uint8_tDanny Holman
Make all variables with char or char* type into uint8_t. This makes the system more consistent and issues fewer compiler warnings. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.h: remove extern functionsDanny Holman
Remove references to extern functions. All the necessary functionality for this file is already contained. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: isr.s: create the irq stubsDanny Holman
Create the ISR stubs for use by IRQ handlers. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.c: install the ISR handlersDanny Holman
Actually install the ISR handlers to the IDT. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.c: remove the irq number from handlerDanny Holman
Remove the irq number from the irq handler. This information is already stored in the ISR frame structure. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.c: call the page fault handlerDanny Holman
Call the page fault handler when a page fault occurs instead of just dumping the registers and halting. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.c: add a stopgap to halt_catch_fireDanny Holman
Add a infinite while loop just in case the "hlt" instruction fails. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: idt.c: remove unneeded define macrosDanny Holman
Remove several preprocessor macros that serve no purpose and pollute the source file. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: gdt.c: init the TSS before loading itDanny Holman
Perform some initialization routines on the TSS structure before loading its address. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: boot.s: define functions for page managementDanny Holman
Define the load_page_dir and enable_paging functions in assembly. This allows normal C code to initialize the CR3 register and control paging without using inline assembler. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: boot.s: move C entry point to fileDanny Holman
Move the initial C entry-point to its own file. Call all the i386 specific initialization routines from the new i386_entry function. Signed-off-by: Danny Holman <dholman@gymli.org>
2023-11-26arch: i386: boot: boot.sDanny Holman
Fix several small bugs in assembler. Signed-off-by: Danny Holman <dholman@gymli.org>