mirror of https://github.com/vinc/moros.git
4fd7d68a63
* Display MAC address * Add kernel::pci::find_device * Mask lower bits of 16-bit Memory Space BAR * Use array instead of vector for MAC address * Split interrupts module * Use IRQ constants instead of InterruptIndex enum * Replace kernel::sleep by kernel::time * Add kernel::idt::set_irq_handler * Add interrupt handler for RTL8139 * Enable bus mastering for RTL8139 * Setup NIC * Add features for vga/serial and qwerty/dvorak * Add smoltcp crate * Use EthernetAddress from smoltcp * Add RTL8139 struct to implement smoltcp Device * Save detected device * Add kernel::mem::translate_addr * Use physical address of rx_buffer * Add command to read raw network data * Parse packet header and length * Fix missing ascii on last line * Take CRC into account for packet length * Fix compilation error * Move buffer pointers after packet received * Use buffer slice instead of clone in RxToken * Add packet transmission and dhcp client * Configure network interface with DHCP client * Add debug mode to network interface * Clean dhcp command output * Add ip command * Clean up commands output * Count number of packets transmitted and received * Add route command * Add kernel::random::rand16 * Handle carriage return char * Add HTTP client * Improve http command output * Add DNS resolver command * Parse DNS responses to A IN queries * Resolve http host * Check if interface is ready before operations * Add timeout to polling loops * Fix sleep during polling * Add verbose arg to http command * Add State struct to Device struct * Add subcommand config and dump to net command * Add MTU to RX_BUFFER_LEN when using WRAP * Fix first transmission index * Refactor TxToken implementation * Add user agent to http requests * Add more comments to code * Add llvm-tools-preview component to readme * Add method to translate IRQ into system interrupt * Clear IRQ mask in set_irq_handler * Refactor driver code * Sleep less rather than more * Add rand32 * Disable RTL8139 interrupts * Use arrays instead of vectors for buffers * Add minimum sleep duration * Add phy_addr to dry init * Use CAPR and CBR to compute rx buffer offset * Add debug for alloc issue with continuous physical memory * Fix timeout in loops * Add unused buffer to push the rx buffer into contiguous memory * Add doc about network * Update readme * Add read /net/<proto>/<host>/<path> subcommand |
||
---|---|---|
.cargo | ||
doc | ||
dsk | ||
run | ||
src | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
rust-toolchain | ||
x86_64-moros.json |
README.md
MOROS: Obscure Rust Operating System
.100 110. .1100. 111110. .1001. .01000.
00'1001`11 .11 01. 00 `00 .10 00. 10' 11
01 00 10 10 00 001101' 01 00 `100.
10 01 10 01 11 01`00 01 11 `100.
00 01 01 `00 11' 10 `11. `00 11' 01 00
11 10 10 `1001' 00 01 `0110' `01101'
MOROS is a toy operating system written in Rust for the x86 architecture.
Implemented
- Hardware interrupts
- PS/2 Keyboard (qwerty and dvorak)
- VGA Text mode
- Paging
- Heap allocation
- RTC clock
- PCI enumeration
- ATA PIO mode
- Random number generator
- RTL8139 network card
- IP/TCP/UDP/DHCP/DNS/HTTP protocols
- Basic filesystem
- Basic shell
- Basic text editor
- Basic file and network commands
- A LOT OF SHORTCUTS TO GET EVERYTHING WORKING
- HERE BE DRAGONS
- Processes
- Multitasking
- A real userspace
Usage
Install tools:
curl https://sh.rustup.rs -sSf | sh
rustup install nightly
rustup default nightly
rustup component add rust-src
rustup component add llvm-tools-preview
cargo install cargo-xbuild bootimage
Create disk:
qemu-img create disk.img 128M
Run with:
cargo xrun --release -- \
-cpu phenom \
-rtc base=localtime \
-nic model=rtl8139 \
-hdc disk.img
Or with a serial console:
cargo xrun --release --no-default-features --features serial,dvorak -- \
-cpu phenom \
-rtc base=localtime \
-nic model=rtl8139 \
-serial stdio \
-display none \
-hdc disk.img
Or with cool-retro-term
for a retro console look:
sh run/cool-retro-term.sh
LICENSE
This project started from the seventh post of the second edition of Writing an OS in Rust by Philipp Oppermann.
MOROS is released under MIT.