ci: build and publish documentation

This commit is contained in:
d0p1 🏳️‍⚧️ 2023-05-17 09:51:10 +02:00
parent 459a4b0b2a
commit 8e77928997
16 changed files with 366 additions and 32 deletions

24
.github/workflows/doc.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Docs
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential naturaldocs
- name: Build
run: |
make docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/html
cname: stupidos.d0p1.eu

3
.gitignore vendored
View file

@ -14,3 +14,6 @@ vmstupid
/sysroot
log.txt
/docs/html
/docs/config/Data

View file

@ -18,16 +18,17 @@ TOOLS_DIR = tools
include $(TOOLS_DIR)/build.mk
ASFLAGS = -DSTUPID_VERSION="\"$(shell $(GIT-VERSION))\"" -Ilib \
ASFLAGS = -F dwarf -g -DSTUPID_VERSION="\"$(shell $(GIT-VERSION))\"" -Ilib \
-DBUILD_DATE="\"$(shell date --iso)\"" \
-DNASM_VERSION="\"$(shell nasm -v)\""
QEMUFLAGS = -serial stdio
QEMUFLAGS = -serial stdio -no-reboot
GARBADGE = stupid.iso
include $(KERNEL_DIR)/build.mk
include $(LIB_DIR)/build.mk
include $(BIN_DIR)/build.mk
include $(DOC_DIR)/build.mk
all: stupid.iso

4
docs/build.mk Normal file
View file

@ -0,0 +1,4 @@
.PHONY: docs
docs:
-mkdir -p $(DOC_DIR)/html
naturaldocs -p $(DOC_DIR)/config -i . -o HTML $(DOC_DIR)/html

118
docs/config/Languages.txt Normal file
View file

@ -0,0 +1,118 @@
Format: 1.51
# This is the Natural Docs languages file for this project. If you change
# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change
# something for all your projects, edit the Languages.txt in Natural Docs'
# Config directory instead.
# You can prevent certain file extensions from being scanned like this:
# Ignore Extensions: [extension] [extension] ...
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Unlike other Natural Docs configuration files, in this file all comments
# MUST be alone on a line. Some languages deal with the # character, so you
# cannot put comments on the same line as content.
#
# Also, all lists are separated with spaces, not commas, again because some
# languages may need to use them.
#
# Language: [name]
# Alter Language: [name]
# Defines a new language or alters an existing one. Its name can use any
# characters. If any of the properties below have an add/replace form, you
# must use that when using Alter Language.
#
# The language Shebang Script is special. It's entry is only used for
# extensions, and files with those extensions have their shebang (#!) lines
# read to determine the real language of the file. Extensionless files are
# always treated this way.
#
# The language Text File is also special. It's treated as one big comment
# so you can put Natural Docs content in them without special symbols. Also,
# if you don't specify a package separator, ignored prefixes, or enum value
# behavior, it will copy those settings from the language that is used most
# in the source tree.
#
# Extensions: [extension] [extension] ...
# [Add/Replace] Extensions: [extension] [extension] ...
# Defines the file extensions of the language's source files. You can
# redefine extensions found in the main languages file. You can use * to
# mean any undefined extension.
#
# Shebang Strings: [string] [string] ...
# [Add/Replace] Shebang Strings: [string] [string] ...
# Defines a list of strings that can appear in the shebang (#!) line to
# designate that it's part of the language. You can redefine strings found
# in the main languages file.
#
# Ignore Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ...
#
# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# Specifies prefixes that should be ignored when sorting symbols in an
# index. Can be specified in general or for a specific topic type.
#
#------------------------------------------------------------------------------
# For basic language support only:
#
# Line Comments: [symbol] [symbol] ...
# Defines a space-separated list of symbols that are used for line comments,
# if any.
#
# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ...
# Defines a space-separated list of symbol pairs that are used for block
# comments, if any.
#
# Package Separator: [symbol]
# Defines the default package separator symbol. The default is a dot.
#
# [Topic Type] Prototype Enders: [symbol] [symbol] ...
# When defined, Natural Docs will attempt to get a prototype from the code
# immediately following the topic type. It stops when it reaches one of
# these symbols. Use \n for line breaks.
#
# Line Extender: [symbol]
# Defines the symbol that allows a prototype to span multiple lines if
# normally a line break would end it.
#
# Enum Values: [global|under type|under parent]
# Defines how enum values are referenced. The default is global.
# global - Values are always global, referenced as 'value'.
# under type - Values are under the enum type, referenced as
# 'package.enum.value'.
# under parent - Values are under the enum's parent, referenced as
# 'package.value'.
#
# Perl Package: [perl package]
# Specifies the Perl package used to fine-tune the language behavior in ways
# too complex to do in this file.
#
#------------------------------------------------------------------------------
# For full language support only:
#
# Full Language Support: [perl package]
# Specifies the Perl package that has the parsing routines necessary for full
# language support.
#
#-------------------------------------------------------------------------------
# The following languages are defined in the main file, if you'd like to alter
# them:
#
# Text File, Shebang Script, C/C++, C#, Java, JavaScript, Perl, Python,
# PHP, SQL, Visual Basic, Pascal, Assembly, Ada, Tcl, Ruby, Makefile,
# ActionScript, ColdFusion, R, Fortran
# If you add a language that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# languages [at] naturaldocs [dot] org.
Alter Language: Assembly
Add Extensions: s inc

76
docs/config/Menu.txt Normal file
View file

@ -0,0 +1,76 @@
Format: 1.51
Title: StupidOS
# You can also add a sub-title to your menu like this:
# SubTitle: [subtitle]
# You can add a footer to your documentation like this:
# Footer: [text]
# If you want to add a copyright notice, this would be the place to do it.
Timestamp: Updated yyyy/mm/dd
# m - One or two digit month. January is "1"
# mm - Always two digit month. January is "01"
# mon - Short month word. January is "Jan"
# month - Long month word. January is "January"
# d - One or two digit day. 1 is "1"
# dd - Always two digit day. 1 is "01"
# day - Day with letter extension. 1 is "1st"
# yy - Two digit year. 2006 is "06"
# yyyy - Four digit year. 2006 is "2006"
# year - Four digit year. 2006 is "2006"
# --------------------------------------------------------------------------
#
# Cut and paste the lines below to change the order in which your files
# appear on the menu. Don't worry about adding or removing files, Natural
# Docs will take care of that.
#
# You can further organize the menu by grouping the entries. Add a
# "Group: [name] {" line to start a group, and add a "}" to end it.
#
# You can add text and web links to the menu by adding "Text: [text]" and
# "Link: [name] ([URL])" lines, respectively.
#
# The formatting and comments are auto-generated, so don't worry about
# neatness when editing the file. Natural Docs will clean it up the next
# time it is run. When working with groups, just deal with the braces and
# forget about the indentation and comments.
#
# --------------------------------------------------------------------------
Group: Kernel {
File: head.s (kernel/head.s)
File: idt.s (kernel/idt.s)
File: multiboot.inc (kernel/multiboot.inc)
File: pic.s (kernel/pic.s)
File: setup_paging (kernel/paging.s)
Group: Driver {
File: serial.s (no auto-title, kernel/drivers/serial.s)
} # Group: Driver
} # Group: Kernel
Group: Lib {
File: base.inc (lib/base.inc)
} # Group: Lib
Group: Index {
Index: Everything
Class Index: Classes
Constant Index: Constants
File Index: Files
Function Index: Functions
Macro Index: Macros
Type Index: Types
Variable Index: Variables
} # Group: Index

View file

@ -27,6 +27,14 @@ DLH equ 0x0
in al, dx
%endmacro
; Function: serial_init
;
; in:
; none
;
; out:
; none
;
global serial_init
serial_init:
COM_OUT COM1, IER, 0x00
@ -38,6 +46,14 @@ serial_init:
ret
; Function: serial_write
;
; in:
; none
;
; out:
; none
;
global serial_write
serial_write:
push ebp

View file

@ -1,3 +1,5 @@
; file: head.s
;
[BITS 32]
%include "base.inc"
@ -21,6 +23,16 @@ stack_bottom:
stack_top:
section .text
; Function: entry
;
; in:
; EAX - Multiboot magic
; EBX - Multiboot structure
;
; out:
; none
;
global entry
entry:
mov esp, stack_top

View file

@ -1,3 +1,5 @@
; file: idt.s
;
[BITS 32]
section .text
global setup_idt
@ -29,9 +31,10 @@ extern isr %+ i
section .data
align 8
idt_ptr:
dw 255 * 8
dw idt_entries.end-idt_entries-1
dd idt_entries
; variable: idt_entries
align 8
idt_entries:
times 256 dd 0x00000000, 0x00000000

View file

@ -5,20 +5,50 @@
%macro ISR_NO_ERR 1
global isr%1
isr%1:
cli
push byte 0
push byte %1
xchg bx, bx
push dword 0
push dword %1
jmp isr_handler
%endmacro
%macro ISR_ERR 1
global isr%1
isr%1:
cli
push byte %1
xchg bx, bx
push dword 1
push dword %1
jmp isr_handler
%endmacro
struc intframe
;; registers
.edi: resd 1
.esi: resd 1
.ebp: resd 1
.esp: resd 1
.ebx: resd 1
.edx: resd 1
.ecx: resd 1
.eax: resd 1
;;
.gs: resd 1
.fs: resd 1
.es: resd 1
.ds: resd 1
.intno: resd 1
;; by x86 hardware
.err: resd 1
.eip: resd 1
.cs: resd 1
.eflags: resd 1
;; crossring
.useresp: resd 1
.ss: resd 1
endstruc
section .text
ISR_NO_ERR 0
@ -54,36 +84,47 @@ ISR_NO_ERR 29
ISR_NO_ERR 30
ISR_NO_ERR 31
panic:
LOG msg_interrupt
htl
jmp panic
global isr_handler
isr_handler:
push ds
push es
push fs
push gs
mov edi, 0x11111111
mov eax, 0xAAAAAAAA
pusha
mov ax, ds
push eax
mov ax, 0x10
mov ax, 0x10 ; data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
LOG msg_interrupt
call panic
extern pic_eoi
call pic_eoi
pop eax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
;extern pic_eoi
;call pic_eoi
popa
add esp, 8
pop gs
pop fs
pop es
pop ds
add esp, 8 ; int no & error code
sti
iret
section .rodata
msg_interrupt db "interrupt", 0
msg_interrupt db "interrupt", 0xA
db "edi: %x esi: %x ebp: %x esp: %x", 0xA
db "ebx: %x edx: %x ecx: %x eax: %x", 0xA
db "gs: %x fs: %x es: %x ds: %x", 0xA
db "int: %x err: %x eip: %x cs: %x", 0xA
db "flg: %x usp: %x ss: %x", 0x0
file db __FILE__, 0

View file

@ -1,3 +1,5 @@
; file: multiboot.inc
struc mb_info
.flags: resd 1

View file

@ -14,13 +14,21 @@ page_directory:
section .text
; Function: setup_paging
;
; in:
; none
;
; out:
; none
;
global setup_paging
setup_paging:
mov eax, page_directory
mov cr3, eax
mov eax, cr0
or eax, 0x80000001
or eax, 1 << 31 ; enable paging
mov cr0, eax
ret

View file

@ -7,6 +7,14 @@ PIC2_DATA equ 0xA1
section .text
; Function: setup_pic
;
; in:
; none
;
; out:
; none
;
global setup_pic
setup_pic:
mov al, 0x11
@ -29,6 +37,14 @@ setup_pic:
out PIC2_DATA, al
ret
; Function: pic_eoi
;
; in:
; none
;
; out:
; none
;
global pic_eoi
pic_eoi:
mov al, 0x20

View file

@ -164,8 +164,8 @@ setup_pmm_mmap:
;; TODO: mark as free in bitmap
.third_pass:
push dword [edi + mb_mmap.addr]
push dword [edi + mb_mmap.length]
push dword [edi + mb_mmap.addr]
call bitmap_mark_range_free
add esp, 8
jmp .next
@ -338,19 +338,27 @@ setup_pmm:
leave
ret
global alloc_frame
alloc_frame:
global alloc_frames
alloc_frames:
push esp
mov ebp, esp
push edi
push esi
mov edi, [ebp + 8] ; count
pop esi
pop edi
leave
ret
global free_frame
free_frame:
global free_frames
free_frames:
push esp
mov ebp, esp
call bitmap_mark_range_free
leave
ret

View file

@ -1,5 +1,7 @@
; file: base.inc
extern log_impl
; macro: LOG
%macro LOG 1-*
%rep %0
%rotate -1

View file

@ -21,4 +21,4 @@ include lib/*/build.mk
$(foreach lib, $(LIBS), $(eval $(call LIBS_TEMPLATE,$(lib))))
lib/%.o: lib/%.s
$(AS) $(ASFLAGS) -o $@ $<
$(AS) -felf $(ASFLAGS) -o $@ $<