Age | Commit message (Collapse) | Author |
|
Fix a bug in which the kfree function would ignore the last mem_block
struct. This allows the kernel to free a mem_block at the end of the
linked list.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Reserve the last, usable page table for temporary mappings, such as
those required by the physical memory manager.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Create a generic interface for drivers to make use of interrupt vectors.
This API should be platform-agnostic enough to allow any driver to make
use of virtually any interrupt vector on any CPU. On x86, the first 32
interrupts are set aside for CPU exceptions, and interrupt 128 is set
aside for system calls.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a function that will walk the stack and save the return addresses
into an array. This will allow the kernel to print out stack traces
during a panic or on demand inside a debugger.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Set the ESP register to NULL before calling any C code. This allows a
stack trace to occur without overrunning the initial bootstrap stack.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Refactor the i386_entry function such that it is in line with how the
paging and memory systems operate. Further, the kernel command line must
now be copied before calling the physical memory initialization routines
due to an address conflict that cannot be resolved otherwise.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Don't hardcode the __stack_chk_guard value, generate a random value
(using RDRAND on x86) before running any C code.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
The function flush_gdt() no longer accepts arguments. Update the
function call to reflect this change.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Refactor the physical memory manager to be more efficient and require
fewer function calls from layers above.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Map the page directory to the last page table. This allows the kernel to
access every page table on the system from the address 0xFFC00000 plus
an offset.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Allocate a few pages at startup just to get the paging and physical
memory manager up and running.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Make the declaration of flush_gdt available to files including asm.h.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Make a temporary mapping for a alloc'd page in init_page_table. This
ensures that the mapping is firmly inside the page table set aside for
page accounting structures.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Remove a reference to a non-existant header file in an include
statement.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Remove all the remaining references to headers that were moved into the
libk.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix several triple-faulting bugs in the paging initialization routines.
These include causing a page fault during physical memory manager
initialization, causing a page fault during paging initialization and
other double-faulting and triple-faulting bugs.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Refactor the physical memory manager to be dramatically simpler. The new
design uses only a single freelist, and only uses temporary mappings
where needed.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Update all the files under arch to make use of the new libk
implementation. Most of these changes are simply path changes in include
directives.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add two functions to control thread-local spinlocks.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a third argument to i386_entry. This argument is the bootstrap page
directory. Pages can be temporarily mapped in during the initialization
of the paging system.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Create a subdirectory branching from the project root. This directory
will contain nothing but driver and device code.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a basic thread scheduler. This should allow the kernel to schedule
threads according to the round robin algorithm.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add a basic kmalloc implementation. This allows the kernel to allocate
blocks smaller than a whole page.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add the mostly finished physical memory allocator and expose its
functions to the paging system.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
Move the function that jumps to ring 3 to its own assembly file.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
Move all the data structures required for operation of the GDT to their
own header file.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
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>
|
|
Add functions to the syscall handlers that dump registers and stack in
case of catastrophic failure.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Fix a bug in the GDT that prevented the kernel from jumping to userspace
correctly.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Remove an inline assembly instruction that was placed for debugging
purposes.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add new source files to the x86 architecture build configuration.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add references to the PMM bitmap to the linker script.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
Add a simple, bitmap-based physical memory management system.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
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>
|
|
Finish implementing pic_eoi and similar. This allows standardized
communication with the x86 PIC chip.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Define a few standard Unix system calls. These may change based on
future needs.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Make the register_irq_function accessible from files including pic.h.
Signed-off-by: Danny Holman <dholman@gymli.org>
|