Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Create the ISR stubs for use by IRQ handlers.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Actually install the ISR handlers to the IDT.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
Add a infinite while loop just in case the "hlt" instruction fails.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Remove several preprocessor macros that serve no purpose and pollute the
source file.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Perform some initialization routines on the TSS structure before loading
its address.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
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>
|
|
Fix several small bugs in assembler.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
The x86 system call/interrupt handlers should be refactored to be more
readable.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
Add support for rudementary system calls and IRQ interrupts.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Simplify the setup and definitions of GDT/TSS entries.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Simplify the interrupt descriptor table setup and frame assembly.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
Add support for the tab character in the virtual terminal.
Signed-off-by: Danny Holman <dholman@gymli.org>
|
|
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>
|
|
Include information about the current stack frame in the IDT handler(s).
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add functions that let the OS read the internal state registers of the
8259 PIC.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Fix the i386's general exception handler to actually work. Fix provided
by Jon Sanderson (jjs295356@gmail.com).
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Fix a bug in which the size of the main GDT array and the actual number
of descriptors are different values.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add support for the 8259 programmable interrupt controller.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Create files that add IDT support for i386.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add two ring-3 segment discriptors to the GDT during gdt_install.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add parenthesis around the GDT setup macros. This is done to prevent
having to do it when using them.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add a set of routines that setup the x86's global descriptor table.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Move the start of the kernel image to the "higher half" of memory. This
also enables paging.
|
|
Add support for scrolling the terminal at the end of the VGA buffer.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add support for the newline character in the TTY layer.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|
|
Add structure to the internals of the x86 directory.
Signed-off-by: Danny Holman <dholman@gymli.xyz>
|