Tiberiu Chibici
913e65b856
==================================================== + Changed 'align 0x4' line above multiboot header in loader.asm to 'align 4' + Removed -e option for echo in build.sh + Modified build.sh for linux + Fixed triple fault when enabling paging + Fixed page faults at memory manager initialization + Fixed 'mem' console function + Added more info about page fault at crash screen + Added Panic() macro + Added verbose mode for memory manager [ BAD] BUILD 0.1.0.390 DATE 8/27/2011 AT 10:54 PM ==================================================== + Added stdlib routines, separated in different files + Rewritten physical memory manager + Added virtual mem manager + Added memory allocation/freeing + Added memory library + Added temporary allocation (at end of kernel), until paging is started - Removed functionality from debug console function 'mem' - Removed system.h, the one remaining function now in stdio.h
218 lines
4.3 KiB
NASM
218 lines
4.3 KiB
NASM
bits 32
|
|
|
|
; !!! ISRs !!!
|
|
global isr_exception_0
|
|
global isr_exception_1
|
|
global isr_exception_2
|
|
global isr_exception_3
|
|
global isr_exception_4
|
|
global isr_exception_5
|
|
global isr_exception_6
|
|
global isr_exception_7
|
|
global isr_exception_8
|
|
global isr_exception_9
|
|
global isr_exception_10
|
|
global isr_exception_11
|
|
global isr_exception_12
|
|
global isr_exception_13
|
|
global isr_exception_14
|
|
global isr_exception_15
|
|
global isr_exception_16
|
|
global isr_exception_17
|
|
global isr_exception_18
|
|
global isr_exception_19
|
|
global isr_exception_20
|
|
global isr_exception_21
|
|
global isr_exception_22
|
|
global isr_exception_23
|
|
global isr_exception_24
|
|
global isr_exception_25
|
|
global isr_exception_26
|
|
global isr_exception_27
|
|
global isr_exception_28
|
|
global isr_exception_29
|
|
global isr_exception_30
|
|
global isr_exception_31
|
|
|
|
isr_exception_0:
|
|
cli
|
|
push byte 0; A normal ISR stub that pops a dummy error code to keep a
|
|
; uniform stack frame
|
|
push byte 0
|
|
jmp isr_common_stub
|
|
isr_exception_1:
|
|
cli
|
|
push byte 0
|
|
push byte 1
|
|
jmp isr_common_stub
|
|
isr_exception_2:
|
|
cli
|
|
push byte 0
|
|
push byte 2
|
|
jmp isr_common_stub
|
|
isr_exception_3:
|
|
cli
|
|
push byte 0
|
|
push byte 3
|
|
jmp isr_common_stub
|
|
isr_exception_4:
|
|
cli
|
|
push byte 0
|
|
push byte 4
|
|
jmp isr_common_stub
|
|
isr_exception_5:
|
|
cli
|
|
push byte 0
|
|
push byte 5
|
|
jmp isr_common_stub
|
|
isr_exception_6:
|
|
cli
|
|
push byte 0
|
|
push byte 6
|
|
jmp isr_common_stub
|
|
isr_exception_7:
|
|
cli
|
|
push byte 0
|
|
push byte 7
|
|
jmp isr_common_stub
|
|
isr_exception_8:
|
|
cli
|
|
push byte 8
|
|
jmp isr_common_stub
|
|
isr_exception_9:
|
|
cli
|
|
push byte 0
|
|
push byte 9
|
|
jmp isr_common_stub
|
|
isr_exception_10:
|
|
cli
|
|
push byte 10
|
|
jmp isr_common_stub
|
|
isr_exception_11:
|
|
cli
|
|
push byte 11
|
|
jmp isr_common_stub
|
|
isr_exception_12:
|
|
cli
|
|
push byte 12
|
|
jmp isr_common_stub
|
|
isr_exception_13:
|
|
cli
|
|
push byte 13
|
|
jmp isr_common_stub
|
|
isr_exception_14:
|
|
cli
|
|
push byte 14
|
|
jmp isr_common_stub
|
|
isr_exception_15:
|
|
cli
|
|
push byte 0
|
|
push byte 15
|
|
jmp isr_common_stub
|
|
isr_exception_16:
|
|
cli
|
|
push byte 0
|
|
push byte 16
|
|
jmp isr_common_stub
|
|
isr_exception_17:
|
|
cli
|
|
push byte 0
|
|
push byte 17
|
|
jmp isr_common_stub
|
|
isr_exception_18:
|
|
cli
|
|
push byte 0
|
|
push byte 18
|
|
jmp isr_common_stub
|
|
isr_exception_19:
|
|
cli
|
|
push byte 0
|
|
push byte 19
|
|
jmp isr_common_stub
|
|
isr_exception_20:
|
|
cli
|
|
push byte 0
|
|
push byte 20
|
|
jmp isr_common_stub
|
|
isr_exception_21:
|
|
cli
|
|
push byte 0
|
|
push byte 21
|
|
jmp isr_common_stub
|
|
isr_exception_22:
|
|
cli
|
|
push byte 0
|
|
push byte 22
|
|
jmp isr_common_stub
|
|
isr_exception_23:
|
|
cli
|
|
push byte 0
|
|
push byte 23
|
|
jmp isr_common_stub
|
|
isr_exception_24:
|
|
cli
|
|
push byte 0
|
|
push byte 24
|
|
jmp isr_common_stub
|
|
isr_exception_25:
|
|
cli
|
|
push byte 0
|
|
push byte 25
|
|
jmp isr_common_stub
|
|
isr_exception_26:
|
|
cli
|
|
push byte 0
|
|
push byte 26
|
|
jmp isr_common_stub
|
|
isr_exception_27:
|
|
cli
|
|
push byte 0
|
|
push byte 27
|
|
jmp isr_common_stub
|
|
isr_exception_28:
|
|
cli
|
|
push byte 0
|
|
push byte 28
|
|
jmp isr_common_stub
|
|
isr_exception_29:
|
|
cli
|
|
push byte 0
|
|
push byte 29
|
|
jmp isr_common_stub
|
|
isr_exception_30:
|
|
cli
|
|
push byte 0
|
|
push byte 30
|
|
jmp isr_common_stub
|
|
isr_exception_31:
|
|
cli
|
|
push byte 0
|
|
push byte 31
|
|
jmp isr_common_stub
|
|
|
|
extern IsrsFaultHandler
|
|
|
|
isr_common_stub:
|
|
pusha
|
|
push ds
|
|
push es
|
|
push fs
|
|
push gs
|
|
mov ax, 0x10 ; Load the Kernel Data Segment descriptor!
|
|
mov ds, ax
|
|
mov es, ax
|
|
mov fs, ax
|
|
mov gs, ax
|
|
mov eax, esp ; Push us the stack
|
|
push eax
|
|
mov eax, IsrsFaultHandler
|
|
call eax ; A special call, preserves the 'eip' register
|
|
pop eax
|
|
pop gs
|
|
pop fs
|
|
pop es
|
|
pop ds
|
|
popa
|
|
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
|
|
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP!
|