mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2024-11-21 05:46:52 -08:00
fixed some assembly
This commit is contained in:
parent
e6ca3f7488
commit
73ad94400b
BIN
.vscode/browse.vc.db
vendored
BIN
.vscode/browse.vc.db
vendored
Binary file not shown.
BIN
.vscode/browse.vc.db-shm
vendored
BIN
.vscode/browse.vc.db-shm
vendored
Binary file not shown.
BIN
.vscode/browse.vc.db-wal
vendored
BIN
.vscode/browse.vc.db-wal
vendored
Binary file not shown.
@ -6,231 +6,11 @@
|
||||
|
||||
#IncludeRegexTransform:
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.c
|
||||
audio.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.h
|
||||
time.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.h
|
||||
stdint.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/eisa.c
|
||||
eisa.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/eisa.h
|
||||
stdarg.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/eisa.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdarg.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/isa.c
|
||||
isa.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/isa.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdarg.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/isa.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/mca.c
|
||||
mca.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/mca.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/mca.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/pci.c
|
||||
pci.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/pci.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/pci.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/vesa.c
|
||||
vesa.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/vesa.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/bus/vesa.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/display/display.c
|
||||
display.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/display/display.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/display/display.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/io/io.c
|
||||
io.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/io/io.h
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/io/io.h
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.c
|
||||
keyboard.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.h
|
||||
../io/io.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/io/io.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.h
|
||||
stdbool.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/screen/screen.c
|
||||
screen.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/screen/screen.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/screen/screen.h
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/tty/./tty.h
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/tty/tty.c
|
||||
stdbool.h
|
||||
-
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
../display/display.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/display/display.h
|
||||
../io/io.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/io/io.h
|
||||
../keyboard/keyboard.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.h
|
||||
../screen/screen.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/screen/screen.h
|
||||
./tty.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/tty/./tty.h
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/gdt.h
|
||||
stdint.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/idt.h
|
||||
include/types.h
|
||||
@ -273,18 +53,8 @@ sys/cdefs.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/gdt.h
|
||||
stdint.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/idt.c
|
||||
idt.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/idt.h
|
||||
../../../drivers/keyboard/keyboard.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.h
|
||||
isr/isr.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h
|
||||
stdint.h
|
||||
-
|
||||
|
||||
@ -294,56 +64,14 @@ include/types.h
|
||||
stdbool.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/memory.h
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/types.h
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.c
|
||||
exceptions.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.h
|
||||
setjmp.h
|
||||
-
|
||||
signal.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.h
|
||||
stddef.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.c
|
||||
isr.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h
|
||||
../include/types.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/types.h
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/memory/memory.c
|
||||
../include/memory.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/memory.h
|
||||
stddef.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/kernel.c
|
||||
kernel.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h
|
||||
@ -382,15 +110,3 @@ stddef.h
|
||||
stddef.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/print.c
|
||||
kernel.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h
|
||||
stdio.h
|
||||
-
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/stack.c
|
||||
stack.h
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/stack.h
|
||||
|
||||
/home/gbowne1/Documents/ClassicOS/src/kernel/stack.h
|
||||
|
||||
|
1
build/CMakeFiles/Progress/6
Normal file
1
build/CMakeFiles/Progress/6
Normal file
@ -0,0 +1 @@
|
||||
empty
|
1
build/CMakeFiles/Progress/7
Normal file
1
build/CMakeFiles/Progress/7
Normal file
@ -0,0 +1 @@
|
||||
empty
|
1
build/CMakeFiles/Progress/8
Normal file
1
build/CMakeFiles/Progress/8
Normal file
@ -0,0 +1 @@
|
||||
empty
|
BIN
build/ClassicOS
BIN
build/ClassicOS
Binary file not shown.
@ -2,9 +2,7 @@ global LoadGDT
|
||||
|
||||
section .text
|
||||
LoadGDT:
|
||||
/* LGDT [ESP + 32]
|
||||
RET
|
||||
*/
|
||||
|
||||
mov eax, [esp+4] ; Get the pointer to the GDT pointer structure
|
||||
lgdt [eax] ; Load the GDT
|
||||
mov ax, 0x10 ; Set the kernel data segment selector
|
||||
|
@ -57,6 +57,7 @@ extern bool gdt_init(void)
|
||||
// Set up GDT pointer
|
||||
struct gdt_ptr gp;
|
||||
gp.limit = (sizeof(struct gdt_entry) * 3) - 1;
|
||||
gp.base = (uintptr_t)&gdt_entries[0];
|
||||
|
||||
// Initialize GDT entries
|
||||
gdt_set_gate(0, 0, 0, 0, 0, &gdt_entries[0]); // Null segment
|
||||
@ -64,26 +65,23 @@ extern bool gdt_init(void)
|
||||
gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF, &gdt_entries[2]); // Data segment
|
||||
|
||||
// Load GDT
|
||||
struct gdt_ptr gdtp;
|
||||
gdtp.limit = gp.limit;
|
||||
gdtp.base = (uint32_t)&gdt_entries[0];
|
||||
|
||||
LoadGDT(&gdtp);
|
||||
LoadGDT(&gp);
|
||||
|
||||
// Switch to protected mode
|
||||
__asm__ volatile(
|
||||
"cli\n\t" // Disable interrupts
|
||||
"mov %[base], %%eax\n\t" // Move the base address of the GDT to eax
|
||||
"mov %[limit], %%ebx\n\t" // Move the limit of the GDT to ebx
|
||||
"shl $16, %%ebx\n\t" // Shift left 16 bits to get the full 32-bit value
|
||||
"or %%eax, %%ebx\n\t" // Combine the base and limit
|
||||
"mov %[address], %%ecx\n\t" // Move the address of gdtr to ecx
|
||||
"mov %%ebx, (%[address])\n\t" // Store the combined value at gdtr
|
||||
"lgdt (%[address])\n\t" // Load the GDT
|
||||
"sti\n\t" // Enable interrupts
|
||||
"movw $0x10, %%ax\n\t"
|
||||
"movw %%ax, %%ds\n\t"
|
||||
"movw %%ax, %%es\n\t"
|
||||
"movw %%ax, %%fs\n\t"
|
||||
"movw %%ax, %%gs\n\t"
|
||||
"movw %%ax, %%ss\n\t"
|
||||
"ljmp $0x08, $1f\n\t"
|
||||
"1:\n\t"
|
||||
:
|
||||
: [base] "a"(gdtp.base), [limit] "b"(gdtp.limit), [address] "c"(&gdtp)
|
||||
: "%ebx", "%ecx", "%edx");
|
||||
:
|
||||
: "ax");
|
||||
|
||||
return true; // Indicate successful GDT initialization
|
||||
}
|
||||
|
||||
// Exception handlers
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef GDT_H
|
||||
#define GDT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// GDT entry structure
|
||||
struct gdt_entry
|
||||
@ -16,10 +16,9 @@ struct gdt_entry
|
||||
} __attribute__((packed));
|
||||
|
||||
// GDT pointer structure
|
||||
struct gdt_ptr
|
||||
{
|
||||
uint16_t limit; // The upper 16 bits of all selector limits
|
||||
uint32_t base; // The address of the first gdt_entry_t struct
|
||||
struct gdt_ptr {
|
||||
uint16_t limit;
|
||||
uintptr_t base;
|
||||
} __attribute__((packed));
|
||||
|
||||
// Function prototypes
|
||||
|
@ -1,12 +1,10 @@
|
||||
global LoadIDT ; Declare function as global
|
||||
|
||||
_offset idt db 0
|
||||
|
||||
section .data
|
||||
idt_offset db 0
|
||||
section .text ; Code section
|
||||
|
||||
%include "idt.h"
|
||||
|
||||
LoadIDT:
|
||||
mov eax, [esp + 4] ; Get IDT address (ensure offset idt is defined)
|
||||
LIDT [eax] ; Load timer interrupt entry (check for correct brackets)
|
||||
RET ; Return from function
|
||||
mov eax, [esp + 4] ; Get IDT address
|
||||
lidt [eax] ; Load IDT
|
||||
ret ; Return from function
|
Loading…
Reference in New Issue
Block a user