aboutsummaryrefslogtreecommitdiff
path: root/src/arch
Commit message (Collapse)AuthorAge
* interrupt: add irq_save/restore helpersTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* dev: add x86 PIT (programmable interrupt timer)Tianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* proc: basic task/stack creationTianhao Wang2024-06-11
| | | | Now we can do a simple context swap (without scheduler though)
* chore: format asm codeTianhao Wang2024-06-11
| | | | | | | | | | | | | | mostly fixing identation and tabstop: 0. line width is 80 chars 1. tab is 8 chars wide (tabstop = 8) 2. leading indentation and only leading indentations are __hard_tabs__ 3. non-leading tabs are expanded into spaces 4. instrs are always indented 1 level, and only 1 level 5. the first operand (if any) starts at the next tabstop after the instruction, but the tab inbetween is expanded to spaces (3) Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* proc: basic infra for multithreadingTianhao Wang2024-06-11
| | | | | | | including task and scheduler wrapper, context swap assembly, and some notes... The lifetime of task is tricky, I'll fix it later Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* interrupt: set up dummy pagefault handlerTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* interrupt: better trampolines for interruptsTianhao Wang2024-06-11
| | | | | | | | | | | 1. define trampolines for both exceptions with error code (automatically pushed to stack) and those without. 2. do not repeat vectors for unused IRQ numbers: we need 48, no need to fill in 256. 3. also pass the pointer to trap frame (on the stack) to the handler code Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* proc: interrupt: define context and trap frameTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* pic: replace hardcoded values, add docsTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* toolchain: bump rust toolchain versionTianhao Wang2024-06-11
| | | | | | | | | | | | | | | | | | | 1. allow unexpected cfgs in lib.rs, in this case "no_global_oom_handling" is cause warnings [1] 2. for large code models the compiler (rust linkers) now put code and data in `.ltext`, `.ldata`, `.lbss`, `.lrodata` instead of the same `.text` , `.data` ... etc. We are adjusting accordingly in the linker script. 3. unsafe assertions identified undefined behaviours, in this case a repr(C) struct was not mared as repr(packed), therefore having an unexpected size. The unsafe assertions was not enabled by default in debug builds so the idt setup code with from_raw_parts_mut() has been working on UB. Glad we can catch this.... related: [1] https://github.com/rust-lang/rust/pull/123501 related: [2] https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html#asserting-unsafe-preconditions
* idt: mm: move idt and vectors also to upper memoryTianhao Wang2024-06-11
|
* chore: add v2p and p2v conversion wrt. id mappingTianhao Wang2024-06-11
| | | | Also renamed a few symbols to avoid confusion.
* chore: cleanupTianhao Wang2024-06-11
| | | | Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* mm: fully map the kernel to high memoryTianhao Wang2024-06-11
|
* mm: add basic paging infra from x86_64 crateTianhao Wang2024-06-11
| | | | | | | | | | the x86_64 crate is pretty solid and has a permissive license (Apache/MIT), but I want to make this myself in the future to "experience" the unsafe rust further....Also it has too many abstractions, which is justified as a library, but not ideal for a from sctrach toy OS as it hides the lower end. Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* multiboot: basic support for multiboot infoTianhao Wang2024-06-11
| | | | | | | | well, it's not trivial to use bios function because thanks to grub + multiboot, we are already in protected mode when the startup code takes control. Also the MB info is easier to play with than BIOS (or ACPI) Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
* choreTianhao Wang2024-06-11
|
* rename wraper -> vectorTianhao Wang2024-06-11
|
* choreTianhao Wang2024-06-11
|
* linker: "optimize" section arrangementsTianhao Wang2024-06-11
| | | | | | | 1. throw vectors in a custom ".reserved" section 2. throw idt in a NOLOAD ".reserved_0" section: save some binary size (like .bss) since we don't care for its initial value. 3. squash all ".data.*" sections from rust into ".data"
* interrupt: add rust binding for idtTianhao Wang2024-06-11
|
* formatting codeTianhao Wang2024-06-11
|
* split idt and vectors from startup codeTianhao Wang2024-06-11
|
* interrupt: rename `guardian` to `interrupt_gate`Tianhao Wang2024-06-11
|
* mask interrupt during handler routineTianhao Wang2024-06-11
|
* pic: initialize with rust codeTianhao Wang2024-06-11
|
* re-organize codeTianhao Wang2024-06-11
|
* thredding 1/?Tianhao Wang2024-06-11
|
* chore: make clippy happyTianhao Wang2024-06-11
|
* define memory layout (if there was a layout)Tianhao Wang2024-06-11
|
* MM: add modules for memory managementTianhao Wang2024-06-11
|
* add IOPort structTianhao Wang2024-06-11
| | | | So that device IO can be be synchronized.
* basic interrupt/PIC supportTianhao Wang2024-06-11
|
* use inline asm for x86 IO instrTianhao Wang2024-02-01
|
* formatting code, use tab identation -- before it's too lateTianhao Wang2024-01-30
|
* add delay between IOsTianhao Wang2023-03-14
|
* CGA cursor locationTianhao Wang2023-03-14
|
* rework makefile, include other asm sourcesTianhao Wang2023-03-14
|
* adding io portTianhao Wang2023-03-11
|
* a minimal working demo on bare metalTianhao Wang2023-03-10
|
* basic project structureTianhao Wang2023-03-10