chore: sync repo

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-07-10 08:17:00 +02:00
parent 3cd1b7c5b6
commit 5379d0e924
5 changed files with 132 additions and 10 deletions

View file

@ -6,3 +6,7 @@ insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
[*.py]
indent_style = space
indent_size = 4

View file

@ -1,10 +1,29 @@
struc TSS {
.link dw ?
.link_h dw ?
.esp0 dd ?
.ss0 dw ?
.ss0_h dw ?
.esp1 dd ?
.ss1 dw ?
.prev_tss dd ?
.esp0 dd ?
.ss0 dd ?
.esp1 dd ?
.ss1 dd ?
.esp2 dd ?
.ss2 dd ?
.cr3 dd ?
.eip dd ?
.eflags dd ?
.eax dd ?
.ecx dd ?
.edx dd ?
.ebx dd ?
.esp dd ?
.ebp dd ?
.esi dd ?
.edi dd ?
.es dd ?
.cs dd ?
.ss dd ?
.ds dd ?
.fs dd ?
.gs dd ?
.ldt dd ?
.trap dw ?
.iomap dw ?
}

34
kernel/isr.inc Normal file
View file

@ -0,0 +1,34 @@
macro ISR_ERROR num {
cli
jmp isr_common
}
macro ISR_NOERROR num {
cli
jmp isr_common
}
isr_common:
pusha
mov ax, ds
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
pop eax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
popa
add esp, 8
sti
iret

View file

@ -82,6 +82,67 @@ mm_kmap:
leave
ret
;; Function: mm_clone_pte
;;
;; In:
;; EAX - source page table
;;
;; Out:
;; EAX - cloned page table
;;
mm_clone_pte:
push esp
mov ebp, esp
sub esp, 0x10
leave
ret
;; Function: mm_clone_pgdir
;;
;; In:
;; EAX - source page dir
;;
;; Out:
;; EAX - cloned page dir
mm_clone_pgdir:
push esp
mov ebp, esp
sub esp, 0x10
mov [ebp-4], eax
call pmm_alloc_page
mov [ebp-8], eax
mov ecx, 4096
mov edi, eax
xor al, al
rep stosb
xor ecx, ecx
.loop:
mov eax, [ebp-4]
add eax, ecx
mov eax, [eax]
cmp eax, 0
je .next
cmp ecx, (768*4)
jb @f
mov edx, [ebp-8]
add edx, ecx
mov [edx], eax
jmp .next
@@:
mov edx, eax
call pmm_alloc_page
.next:
add ecx, 4
cmp ecx, 4096
jb .loop
leave
ret
;; Function: mm_init
mm_init:
mov esi, szMsgMmInit

View file

@ -96,14 +96,18 @@ pmm_free_range:
cmp esi, [ebp-8]
jb .loop
call pmm_stats
leave
ret
;; Function: pmm_stats
pmm_stats:
push dword [cFreePage]
push dword [cUsedPage]
push dword [cTotalPage]
mov esi, szMsgPmmStats
call klog
leave
ret
pFreeList dd 0