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
*.obj
*.efi
*.EFI

View file

@ -79,6 +79,12 @@ run-efi: all OVMF32.fd
-device ide-hd,drive=hdd \
-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
clean: $(SUBDIRS)
$(RM) $(TARGET)

View file

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

View file

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

View file

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

View file

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

View file

@ -2,9 +2,9 @@ Format: 1.51
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
# m - One or two digit month. January is "1"
# mm - Always two digit month. January is "01"
@ -39,128 +39,57 @@ Timestamp: Updated yyyy/mm/dd
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: Building (building.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 {
File: Introduction (kernel/intro.txt)
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)
File: kernel.asm (kernel/kernel.asm)
} # Group: Kernel
Group: Lib {
Group: Base {
Group: LZP {
File: base.inc (lib/base/base.inc)
File: log.s (lib/base/log.s)
} # Group: Base
File: lzp.asm (lib/lzp/lzp.asm)
} # Group: LZP
Group: Crypto {
Group: Hash {
Group: SHA2 {
File: sha256.s (lib/crypto/hash/sha256.s)
File: keccak.s (lib/crypto/hash/keccak.s)
} # Group: Hash
Group: Sign {
File: ecdsa.s (lib/crypto/sign/ecdsa.s)
} # Group: Sign
File: sha256.asm (lib/crypto/sha2/sha256.asm)
} # Group: SHA2
} # Group: Crypto
Group: PL/Stupid {
Group: Runtime {
File: crt0.s (lib/pls/runtime/crt0.s)
} # Group: Runtime
} # Group: PL/Stupid
} # 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 {
Index: Everything
Constant Index: Constants
File Index: Files
Function Index: Functions
Macro Index: Macros
Variable Index: Variables
Class Index: Classes
} # Group: Index

View file

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

View file

@ -1,16 +1,13 @@
; file: sha256.s
; SHA-256 cryptographic hash
;
; 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.
;; File: sha256.asm
;; SHA-256 cryptographic hash
; Implementation is based on <Wikipedia's pseudocode at https://en.wikipedia.org/wiki/SHA-2#Pseudocode>
format COFF
use32
section '.data' data
; Constant: K
; SHA-256 round constants
; Constant: K
; SHA-256 round constants
K:
dd 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
dd 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174
@ -23,7 +20,7 @@ K:
section '.text' code
; Function: sha256_compute_block
;; Function: sha256_compute_block
sha256_compute_block:
push ebp
mov ebp, esp
@ -31,16 +28,14 @@ sha256_compute_block:
leave
ret
; Function: sha256_internal
;
; in:
; - state
; - Input buffer
; - Input buffer size
;
; out:
; none
;
;; Function: sha256_internal
;;
;; Parameters:
;;
;; [esp+8] - state
;; [esp+12] - input buffer
;; [esp+16] - size of the input buffer
;;
sha256_internal:
push ebp
push edi
@ -80,16 +75,14 @@ sha256_internal:
leave
ret
; Function: sha256
;
; in:
; - Output buffer
; - Input buffer
; - Input buffer size
;
; out:
; none
;
;; Function: sha256
;;
;; Parameters:
;;
;; [esp+8] - output buffer
;; [esp+12] - input buffer
;; [esp+16] - size of the input buffer
;;
public sha256
sha256:
push ebp

View file

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