chore: add DevSE webring
This commit is contained in:
parent
c1cb32f597
commit
3cd1b7c5b6
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -33,3 +33,5 @@ bochsrc.bxrc
|
|||
*.EFI
|
||||
*.fd
|
||||
*.mod
|
||||
webring.json
|
||||
webring.txt
|
||||
|
|
2
Makefile
2
Makefile
|
@ -112,6 +112,8 @@ run-efi: all OVMF32.fd
|
|||
.PHONY: docs
|
||||
docs:
|
||||
@mkdir -p docs/html
|
||||
wget -O docs/webring.json https://webring.devse.wiki/webring.json
|
||||
python3 docs/devsewebring.py docs/webring.json docs/webring.txt
|
||||
naturaldocs -p docs/config -img docs/img -xi sysroot -i . -ro -o HTML docs/html
|
||||
cp docs/img/favicon.ico docs/html/
|
||||
|
||||
|
|
14
docs/devsewebring.py
Normal file
14
docs/devsewebring.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import sys
|
||||
import json
|
||||
|
||||
if __name__ == '__main__':
|
||||
source = sys.argv[1]
|
||||
dest = sys.argv[2]
|
||||
|
||||
data = None
|
||||
with open(source, "r") as f:
|
||||
data = json.load(f)
|
||||
with open(dest, "w") as f:
|
||||
f.write("File: Webring\n\n")
|
||||
for entry in data:
|
||||
f.write(f"- <{entry['name']} at {entry['protocols']['http']['clearnet']}> : {entry['description']}\n\n")
|
32
kernel/gdt.inc
Normal file
32
kernel/gdt.inc
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
gdt:
|
||||
; null descriptor
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
; kernel code descriptor
|
||||
dw 0xFFFF, 0x0000
|
||||
db 0x00, 0x9a, 0xCF, 0x00
|
||||
|
||||
; kernel data descriptor
|
||||
dw 0xFFFF, 0x0000
|
||||
db 0x00, 0x92, 0xCF, 0x00
|
||||
|
||||
; user code descriptor
|
||||
dw 0xFFFF, 0x0000
|
||||
db 0x00, 0xFA, 0xCF, 0x00
|
||||
|
||||
; user data descriptor
|
||||
dw 0xFFFF, 0x0000
|
||||
db 0x00, 0xF2, 0xCF, 0x00
|
||||
|
||||
; Tss
|
||||
;.tss:
|
||||
; dw ?
|
||||
; dd ?
|
||||
|
||||
.end:
|
||||
|
||||
pGDT:
|
||||
dw gdt.end - gdt - 1
|
||||
dd gdt
|
|
@ -52,8 +52,6 @@ kmain:
|
|||
add ebx, KERNEL_VIRT_BASE
|
||||
call pmm_free_range
|
||||
|
||||
; map whole memory
|
||||
|
||||
; idt, gdt
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
;; File: pmm.inc
|
||||
|
||||
macro ALIGN reg {
|
||||
local end
|
||||
local ..end
|
||||
|
||||
push reg
|
||||
and reg, 0xFFF
|
||||
pop reg
|
||||
jz end
|
||||
jz ..end
|
||||
and reg, 0xFFFFF000
|
||||
add reg, 0x1000
|
||||
end:
|
||||
|
||||
..end:
|
||||
}
|
||||
|
||||
;; Function: pmm_init
|
||||
|
@ -37,6 +36,10 @@ pmm_alloc_page:
|
|||
mov eax, [pFreeList]
|
||||
mov edx, [eax]
|
||||
mov [pFreeList], edx
|
||||
|
||||
inc [cUsedPage]
|
||||
dec [cFreePage]
|
||||
|
||||
ret
|
||||
.error:
|
||||
mov esi, szErrorNoMemLeft
|
||||
|
@ -55,11 +58,13 @@ pmm_free_page:
|
|||
mov edx, [pFreeList]
|
||||
mov [eax], edx
|
||||
mov [pFreeList], eax
|
||||
|
||||
inc [cFreePage]
|
||||
dec [cUsedPage]
|
||||
@@:
|
||||
ret
|
||||
|
||||
;; Function: pmm_free_range
|
||||
;; TODO: allignment
|
||||
;;
|
||||
;; In:
|
||||
;; EAX - Start
|
||||
|
@ -84,11 +89,20 @@ pmm_free_range:
|
|||
mov [esi], eax
|
||||
mov [pFreeList], esi
|
||||
|
||||
inc [cTotalPage]
|
||||
inc [cFreePage]
|
||||
|
||||
add esi, 4096
|
||||
cmp esi, [ebp-8]
|
||||
jb .loop
|
||||
|
||||
|
||||
push dword [cFreePage]
|
||||
push dword [cUsedPage]
|
||||
push dword [cTotalPage]
|
||||
mov esi, szMsgPmmStats
|
||||
call klog
|
||||
|
||||
leave
|
||||
ret
|
||||
|
||||
|
@ -96,3 +110,9 @@ pFreeList dd 0
|
|||
szMsgPmmInit db "PMM: initialize", 0
|
||||
szMsgPmmFreeRange db "PMM: add free memory range %x - %x", 0
|
||||
szErrorNoMemLeft db "Error: no free memory left", 0
|
||||
szMsgPmmStats db "PMM: Total page: %x | Used page: %x | Free page: %x", 0
|
||||
|
||||
; Some stats
|
||||
cFreePage dd 0
|
||||
cUsedPage dd 0
|
||||
cTotalPage dd 0
|
||||
|
|
Loading…
Reference in a new issue