summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* kernel: mem: kmalloc should not call page allocationDanny Holman2024-02-162-15/+7
| | | | | | | | 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>
* kernel: add a panic functionDanny Holman2024-02-162-0/+14
| | | | | | | 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>
* arch: i386: syscall.c: add functions that dump dataDanny Holman2024-02-162-1/+9
| | | | | | | Add functions to the syscall handlers that dump registers and stack in case of catastrophic failure. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: gdt.c: fix a bug in userspace jumpDanny Holman2024-02-161-52/+12
| | | | | | | Fix a bug in the GDT that prevented the kernel from jumping to userspace correctly. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: boot: ISR frame should not include ESPDanny Holman2024-02-161-2/+6
| | | | | | | | 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>
* Makefile: add flags to qemu that activate the serial portDanny Holman2024-02-161-1/+1
| | | | Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: add operations to control PIT timerDanny Holman2024-02-162-0/+38
| | | | | | | | 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>
* include: kernel: add the container_of.h fileDanny Holman2024-02-161-0/+10
| | | | | | | | 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>
* kernel: string: add more functions to string libraryDanny Holman2024-02-162-0/+69
| | | | | | Add more functions to the string library to process buffers and strings. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: put framebuffer ops in own fileDanny Holman2024-02-164-99/+122
| | | | | | | 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>
* arch: i386: kernel: the serial driver should be more POSIX-yDanny Holman2024-02-162-21/+27
| | | | | | | 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>
* kernel: make kprintf print to a ring bufferDanny Holman2024-02-163-13/+75
| | | | | | | | 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>
* include: kernel: move list.h to a data struct directoryDanny Holman2024-02-161-7/+8
| | | | | | Move list.h into a designated directory for data structure definitions. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: alloc: remove erroneous halt instructionDanny Holman2023-11-261-1/+0
| | | | | | | Remove an inline assembly instruction that was placed for debugging purposes. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: make: add source filesv0.05Danny Holman2023-11-262-5/+15
| | | | | | Add new source files to the x86 architecture build configuration. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: linker.ld: add references to the bitmapDanny Holman2023-11-261-0/+5
| | | | | | Add references to the PMM bitmap to the linker script. Signed-off-by: Danny Holman <dholman@gymli.org>
* kernel: list: add a linked-list implementationDanny Holman2023-11-261-0/+31
| | | | | | Add a linked-list implementation using the kmalloc system. Signed-off-by: Danny Holman <dholman@gymli.org>
* kernel: mem: add a simple kmalloc implementationDanny Holman2023-11-262-0/+32
| | | | | | | 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>
* arch: i386: paging: add a proper paging APIDanny Holman2023-11-262-0/+140
| | | | | | | 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>
* arch: i386: alloc: add a physical memory managerDanny Holman2023-11-262-0/+56
| | | | | | Add a simple, bitmap-based physical memory management system. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: add multiboot supportDanny Holman2023-11-262-0/+127
| | | | | | | | 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>
* arch: i386: serial.c: make serial_writestring staticDanny Holman2023-11-261-1/+1
| | | | | | | 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>
* arch: i386: tty.c: remove unneeded local variableDanny Holman2023-11-261-3/+4
| | | | | | | 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>
* arch: i386: syscall.c: replace function calls with single switchDanny Holman2023-11-261-21/+9
| | | | | | | | 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>
* arch: i386: pic.c: finish implementing functions from pic.hDanny Holman2023-11-261-1/+3
| | | | | | | Finish implementing pic_eoi and similar. This allows standardized communication with the x86 PIC chip. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: syscall.h: define some example system callsDanny Holman2023-11-261-5/+22
| | | | | | | Define a few standard Unix system calls. These may change based on future needs. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: pic.h: make register_irq_handler accessibleDanny Holman2023-11-261-0/+2
| | | | | | Make the register_irq_function accessible from files including pic.h. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: pic.h: change all chars into uint8_tDanny Holman2023-11-261-1/+2
| | | | | | | 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>
* arch: i386: idt.h: remove extern functionsDanny Holman2023-11-261-4/+1
| | | | | | | Remove references to extern functions. All the necessary functionality for this file is already contained. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: isr.s: create the irq stubsDanny Holman2023-11-261-3/+21
| | | | | | Create the ISR stubs for use by IRQ handlers. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: idt.c: install the ISR handlersDanny Holman2023-11-261-47/+62
| | | | | | Actually install the ISR handlers to the IDT. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: idt.c: remove the irq number from handlerDanny Holman2023-11-261-1/+2
| | | | | | | 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>
* arch: i386: idt.c: call the page fault handlerDanny Holman2023-11-261-3/+1
| | | | | | | 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>
* arch: i386: idt.c: add a stopgap to halt_catch_fireDanny Holman2023-11-261-0/+1
| | | | | | Add a infinite while loop just in case the "hlt" instruction fails. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: idt.c: remove unneeded define macrosDanny Holman2023-11-261-23/+1
| | | | | | | Remove several preprocessor macros that serve no purpose and pollute the source file. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: gdt.c: init the TSS before loading itDanny Holman2023-11-261-2/+5
| | | | | | | Perform some initialization routines on the TSS structure before loading its address. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: boot.s: define functions for page managementDanny Holman2023-11-261-0/+27
| | | | | | | | 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>
* arch: i386: boot.s: move C entry point to fileDanny Holman2023-11-261-10/+3
| | | | | | | 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>
* arch: i386: boot: boot.sDanny Holman2023-11-261-8/+4
| | | | | | Fix several small bugs in assembler. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: make serial_writestring inlineDanny Holman2022-03-223-20/+15
| | | | | | | | The serial_writestring function is small enough and platform-agnostic, and therefore it should be moved into the main serial header and marked as inline. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: refactor the system call APIDanny Holman2022-03-225-11/+4
| | | | | | | The x86 system call/interrupt handlers should be refactored to be more readable. Signed-off-by: Danny Holman <dholman@gymli.org>
* Makefile: explicitly define CC variableDanny Holman2022-03-221-2/+4
| | | | | | | The CC variable is already defined by the make program, so use "CC:=" instead of "CC?=". This makes sure the proper cross compiler is in use. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: move non-critial files out of bootDanny Holman2022-01-219-91/+52
| | | | | | | Move all files not needed for the bootstrap process out of boot and into the main x86 source directory. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: fix coding style issueDanny Holman2022-01-151-2/+2
| | | | | | Make the inline assembly calls consistent across different i386 files. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: add support for IRQs and system callsDanny Holman2022-01-157-3/+61
| | | | | | Add support for rudementary system calls and IRQ interrupts. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: simplifiy GDT setupDanny Holman2022-01-154-68/+176
| | | | | | Simplify the setup and definitions of GDT/TSS entries. Signed-off-by: Danny Holman <dholman@gymli.org>
* Makefile: add dry run and debug targetsDanny Holman2022-01-151-0/+6
| | | | | | Add targets to perform a test run and debug run inside a VM. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: simplify IDT setupDanny Holman2022-01-155-31/+128
| | | | | | Simplify the interrupt descriptor table setup and frame assembly. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: add support for tab charactersDanny Holman2021-11-291-0/+10
| | | | | | Add support for the tab character in the virtual terminal. Signed-off-by: Danny Holman <dholman@gymli.org>
* arch: i386: rename the GDT array pointerDanny Holman2021-10-091-7/+7
| | | | | | | Rename the array/pointer to the GDT array in gdt.c pointer to be a bit clearer. Signed-off-by: Danny Holman <dholman@gymli.xyz>