build: docs + website
Some checks failed
Build / test (push) Has been cancelled
Docs / test (push) Has been cancelled

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-03-26 08:39:40 +01:00
parent 0666a769d3
commit 4acbdade68
10 changed files with 125 additions and 181 deletions

1
.gitignore vendored
View file

@ -30,3 +30,4 @@ bochsrc.bxrc
*.sys *.sys
*.obj *.obj
*.efi *.efi
*.EFI

View file

@ -79,6 +79,12 @@ run-efi: all OVMF32.fd
-device ide-hd,drive=hdd \ -device ide-hd,drive=hdd \
-serial stdio -serial stdio
.PHONY: docs
docs:
@mkdir -p docs/html
naturaldocs -p docs/config -img docs/img -xi sysroot -i . -ro -o HTML docs/html
cp docs/img/favicon.ico docs/html/
.PHONY: clean .PHONY: clean
clean: $(SUBDIRS) clean: $(SUBDIRS)
$(RM) $(TARGET) $(RM) $(TARGET)

View file

@ -1,3 +1,4 @@
;; File: floppy.asm
format binary format binary
use16 use16

View file

@ -1,3 +1,4 @@
; File: bootia32.asm
format PE DLL EFI at 10000000h format PE DLL EFI at 10000000h
entry efimain entry efimain

View file

@ -1,3 +1,4 @@
;; File: loader.asm
format binary format binary
include '../common/const.inc' include '../common/const.inc'

View file

@ -115,14 +115,5 @@ Format: 1.51
Alter Language: Assembly Alter Language: Assembly
Add Extensions: s inc Add Extensions: asm s inc
Struct Prototype Ender: endstruc Struct Prototype Ender: }
Language: PL/S
Extension: pls
Line Comment: //
Block Comment: /* */
Function Prototype Ender: ;
Variable Prototype Enders: ; =

View file

@ -2,9 +2,9 @@ Format: 1.51
Title: StupidOS Title: StupidOS
SubTitle: Tiny *NIX-like Operating System SubTitle: 32-bit Operating System written in x86 assembly.
Footer: Copyright (C) 2023 d0p1 Footer: Copyright (C) 2024 d0p1
Timestamp: Updated yyyy/mm/dd Timestamp: Updated yyyy/mm/dd
# m - One or two digit month. January is "1" # m - One or two digit month. January is "1"
# mm - Always two digit month. January is "01" # mm - Always two digit month. January is "01"
@ -39,128 +39,57 @@ Timestamp: Updated yyyy/mm/dd
File: Introduction (docs/intro.txt) File: Introduction (docs/intro.txt)
Link: Source Code (https://github.com/d0p1s4m4/StupidOS) Link: Source Code (https://git.cute.engineering/d0p1/StupidOS)
File: Coding Style (docs/coding-style.txt) File: Coding Style (docs/coding-style.txt)
File: Building (building.txt)
File: FAQ (docs/faq.txt) File: FAQ (docs/faq.txt)
Group: BootLoader {
Group: BootSector {
File: floppy.asm (boot/bootsect/floppy.asm)
} # Group: BootSector
Group: Loader {
File: loader.asm (boot/loader/loader.asm)
} # Group: Loader
Group: EFI {
File: bootia32.asm (boot/efi/bootia32.asm)
} # Group: EFI
} # Group: BootLoader
Group: Kernel { Group: Kernel {
File: Introduction (kernel/intro.txt) File: kernel.asm (kernel/kernel.asm)
Group: boot {
File: gdt.s (kernel/boot/gdt.s)
File: head.s (kernel/boot/head.s)
File: idt.s (kernel/boot/idt.s)
} # Group: boot
File: kernel.s (kernel/kernel.s)
File: pic.s (kernel/pic.s)
Group: dev {
Group: AT {
File: IBM PC/AT (kernel/dev/at/intro.txt)
File: cmos.s (kernel/dev/at/cmos.s)
File: pit.s (kernel/dev/at/pit.s)
File: serial.s (kernel/dev/at/serial.s)
} # Group: AT
} # Group: dev
Group: i18n {
File: msg_en.s (kernel/i18n/msg_en.s)
} # Group: i18n
File: pmm.s (kernel/pmm.s)
Group: sys {
File: multiboot.inc (kernel/sys/multiboot.inc)
Group: i386 {
File: cpu.inc (kernel/sys/i386/cpu.inc)
File: cpuid.inc (kernel/sys/i386/cpuid.inc)
File: mmu.inc (kernel/sys/i386/mmu.inc)
File: registers.inc (kernel/sys/i386/registers.inc)
} # Group: i386
} # Group: sys
File: vm.inc (kernel/vm/vm.inc)
File: pmap.s (kernel/vm/pmap.s)
} # Group: Kernel } # Group: Kernel
Group: Lib { Group: Lib {
Group: Base { Group: LZP {
File: base.inc (lib/base/base.inc) File: lzp.asm (lib/lzp/lzp.asm)
File: log.s (lib/base/log.s) } # Group: LZP
} # Group: Base
Group: Crypto { Group: Crypto {
Group: Hash { Group: SHA2 {
File: sha256.s (lib/crypto/hash/sha256.s) File: sha256.asm (lib/crypto/sha2/sha256.asm)
File: keccak.s (lib/crypto/hash/keccak.s) } # Group: SHA2
} # Group: Hash
Group: Sign {
File: ecdsa.s (lib/crypto/sign/ecdsa.s)
} # Group: Sign
} # Group: Crypto } # Group: Crypto
Group: PL/Stupid {
Group: Runtime {
File: crt0.s (lib/pls/runtime/crt0.s)
} # Group: Runtime
} # Group: PL/Stupid
} # Group: Lib } # Group: Lib
Group: Bin {
Group: motd {
File: main.pls (bin/motd/main.pls)
} # Group: motd
} # Group: Bin
Group: Share {
Group: Mk {
File: stupid.clean.mk (share/mk/stupid.clean.mk)
File: stupid.kernel.mk (share/mk/stupid.kernel.mk)
File: stupid.lib.mk (share/mk/stupid.lib.mk)
File: stupid.own.mk (share/mk/stupid.own.mk)
File: stupid.prog.mk (share/mk/stupid.prog.mk)
File: stupid.subdir.mk (share/mk/stupid.subdir.mk)
File: stupid.sys.mk (share/mk/stupid.sys.mk)
} # Group: Mk
} # Group: Share
Group: Index { Group: Index {
Index: Everything Index: Everything
Constant Index: Constants Constant Index: Constants
File Index: Files File Index: Files
Function Index: Functions Function Index: Functions
Macro Index: Macros
Variable Index: Variables
Class Index: Classes
} # Group: Index } # Group: Index

View file

@ -1,11 +1,12 @@
INCLUDE 'const.inc' ;; File: kernel.asm
include 'const.inc'
ORG KBASE org KBASE
USE32 use32
jmp kmain jmp kmain
INCLUDE 'mm/mm.inc' include 'mm/mm.inc'
kmain: kmain:
nop nop

View file

@ -1,10 +1,7 @@
; file: sha256.s ;; File: sha256.asm
; SHA-256 cryptographic hash ;; SHA-256 cryptographic hash
;
; Implementation is based on <Wikipedia's pseudocode at https://en.wikipedia.org/wiki/SHA-2#Pseudocode> ; Implementation is based on <Wikipedia's pseudocode at https://en.wikipedia.org/wiki/SHA-2#Pseudocode>
;
; About: CPU compatibility
; /!\ Only work on *486+* due to bswap for now.
format COFF format COFF
use32 use32
@ -23,7 +20,7 @@ K:
section '.text' code section '.text' code
; Function: sha256_compute_block ;; Function: sha256_compute_block
sha256_compute_block: sha256_compute_block:
push ebp push ebp
mov ebp, esp mov ebp, esp
@ -31,16 +28,14 @@ sha256_compute_block:
leave leave
ret ret
; Function: sha256_internal ;; Function: sha256_internal
; ;;
; in: ;; Parameters:
; - state ;;
; - Input buffer ;; [esp+8] - state
; - Input buffer size ;; [esp+12] - input buffer
; ;; [esp+16] - size of the input buffer
; out: ;;
; none
;
sha256_internal: sha256_internal:
push ebp push ebp
push edi push edi
@ -80,16 +75,14 @@ sha256_internal:
leave leave
ret ret
; Function: sha256 ;; Function: sha256
; ;;
; in: ;; Parameters:
; - Output buffer ;;
; - Input buffer ;; [esp+8] - output buffer
; - Input buffer size ;; [esp+12] - input buffer
; ;; [esp+16] - size of the input buffer
; out: ;;
; none
;
public sha256 public sha256
sha256: sha256:
push ebp push ebp

View file

@ -1,6 +1,9 @@
;; Lempel-Ziv + Prediction (a fast, efficient, and memory-use ;; File: lzp.asm
;; conservative compression algorithm)
;; (paper: https://ieeexplore.ieee.org/document/488353)
; Lempel-Ziv + Prediction (a fast, efficient, and memory-use
; conservative compression algorithm)
; (paper: https://ieeexplore.ieee.org/document/488353)
format COFF format COFF
use32 use32
@ -15,39 +18,44 @@
section '.code' code section '.code' code
;; xor hash, hash ; xor hash, hash
;; xor mask, mask ; xor mask, mask
;; j = 1 ; j = 1
;; while (insz > 0) ; while (insz > 0)
;; { ; {
;; if (ecx == 8) ; if (ecx == 8)
;; { ; {
;; mov [out], mask ; mov [out], mask
;; xor ecx, ecx ; xor ecx, ecx
;; xor mask, mask ; xor mask, mask
;; j = 1; ; j = 1;
;; } ; }
;; c = in[inpos++] ; c = in[inpos++]
;; if (c == table[hash]) ; if (c == table[hash])
;; { ; {
;; mask |= 1 << ecx ; mask |= 1 << ecx
;; } ; }
;; else ; else
;; { ; {
;; table[hash] = c ; table[hash] = c
;; out[j] = c; ; out[j] = c;
;; } ; }
;; HASH(hash, c) ; HASH(hash, c)
;; ecx++; ; ecx++;
;; } ; }
;; Function: lzp_compress(void *out, const void *in, int size) ;; Function: lzp_compress
;; In: ;;
;; - [esp+8]: out buffer address (can be null) ;; Parameters:
;; - [esp+12]: input buffer address ;;
;; - [esp+16]: size of the input buffer ;; [esp+8] - output buffer (can be NULL)
;; Out: ;; [esp+12] - input buffer
;; - eax: size of compressed data ;; [esp+16] - size of the input buffer
;;
;; Returns:
;;
;; eax - size of compressed data
;;
param_out equ [ebp+8] param_out equ [ebp+8]
param_in equ [ebp+12] param_in equ [ebp+12]
param_insz equ [ebp+16] param_insz equ [ebp+16]
@ -105,6 +113,18 @@ lzp_compress:
leave leave
ret ret
;; Function: lzp_decompress
;;
;; Parameters:
;;
;; [esp+8] - output buffer (can be null)
;; [esp+12] - input buffer
;; [esp+16] - size of the input buffer
;;
;; Returns:
;;
;; eax - size of uncompressed data
;;
lzp_decompress: lzp_decompress:
push ebp push ebp
mov ebp, esp mov ebp, esp