Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Add v86 demo on website (#927)
- Reserve userspace memory on i686 (#925)
- Add minesweeper game (#924)
- Add i586 support (#922)
Expand Down
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ image: $(img)

qemu-opts = -name "MOROS $$MOROS_VERSION" \
-m $(memory) -smp $(smp) \
-drive file=$(img),format=raw \
-audiodev $(audio),id=a0 -machine pcspk-audiodev=a0 \
-audio driver=$(audio),model=$(snd) \
-netdev user,id=e0,hostfwd=tcp::8080-:80 -device $(nic),netdev=e0
Expand Down Expand Up @@ -117,12 +118,6 @@ ifeq ($(trace),e1000)
qemu-opts += -trace 'e1000*'
endif

ifeq ($(bootloader),rust)
qemu-opts += -drive file=$(img),format=raw
else
qemu-opts += -drive file=$(bin),format=raw
endif

ifeq ($(arch),i686)
qemu = qemu-system-i386
cpu = n270
Expand Down Expand Up @@ -179,6 +174,7 @@ limine-image:
--protective-msdos-label \
run/boot -o $(bin)
$(limine-dir)/bin/limine bios-install $(bin)
dd conv=notrunc if=$(bin) of=$(img)

limine-test: RUSTFLAGS = -C link-arg=-Trun/boot/multiboot.ld -C link-arg=-z -C link-arg=norelro
limine-test: LIMINE_DIR = $(limine-dir)
Expand All @@ -187,19 +183,32 @@ limine-test:
-m $(memory) -cpu $(cpu) -display none -serial stdio \
-device isa-debug-exit,iobase=0xF4,iosize=0x04 -device $(nic)

ifeq ($(shell uname -s),Darwin)
grub = i686-elf-grub
grub-dir = /usr/local/lib/i686-elf/grub/i386-pc/
else
grub = grub
grub-dir = /usr/lib/grub/i386-pc
endif

grub-modules = multiboot2 $(shell cat $(grub-dir)/partmap.lst)

grub-image: RUSTFLAGS = -C link-arg=-Trun/boot/multiboot.ld -C link-arg=-z -C link-arg=norelro
grub-image:
grub-image: $(img)
cargo build $(cargo-opts),multiboot --target $(arch)-moros.json
cp target/$(arch)-moros/$(mode)/moros run/boot/kernel.elf
grub-mkrescue -d $(grub-dir) \
$(grub)-mkrescue -d $(grub-dir) \
--install-modules="$(grub-modules)" \
--fonts= --locales= --themes= \
-o $(bin) /boot=run/boot
dd conv=notrunc if=$(bin) of=$(img)

website:
make grub-image bootloader-proto=multiboot arch=i686 img=demo.img
cp demo.img www/demo/disk.img
zstd -19 --rm -f www/demo/disk.img -o www/demo/disk.img.zst
sh run/grub-floppy.sh
cp moros-i686-floppy.img www/floppy.img
cd www && sh build.sh

spell:
Expand Down
137 changes: 76 additions & 61 deletions doc/hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,112 @@

## Emulators

- [x] QEMU
- [x] CPU: Intel Pentium
- [x] CPU: Intel Atom N270
- [x] CPU: Intel Core 2 Duo T7700
- [x] DSK: ATA
- [x] NET: Intel PRO/1000 MT Desktop
- [x] NET: Realtek RTL8139C
- [x] NET: AMD PCnet-FAST III
- [x] SND: Creative SoundBlaster 16
- [x] SND: Intel 82801AA (AC'97)

- [x] VirtualBox
- [x] DSK: ATA
- [x] NET: Intel PRO/1000 MT Desktop (82540EM)
- [x] NET: Intel PRO/1000 MT Server (82545EM)
- [x] NET: Intel PRO/1000 T Server (82543GC)
- [x] NET: AMD PCnet-FAST III

- [x] Bochs
- [X] v86 ([demo](/demo))
- [X] CPU: Intel Pentium 4 (1.0 GHz)
- [X] DSK: ATA
- [ ] NET: Realtek RTL8390 (NE2000)
- [?] SND: Creative SoundBlaster 16

- [X] QEMU
- [X] CPU: Intel Pentium
- [X] CPU: Intel Atom N270
- [X] CPU: Intel Core 2 Duo T7700
- [X] DSK: ATA
- [X] NET: Intel PRO/1000 MT Desktop
- [X] NET: Realtek RTL8139C
- [X] NET: AMD PCnet-FAST III
- [X] SND: Creative SoundBlaster 16
- [X] SND: Intel 82801AA (AC'97)

- [X] VirtualBox
- [X] DSK: ATA
- [X] NET: Intel PRO/1000 MT Desktop (82540EM)
- [X] NET: Intel PRO/1000 MT Server (82545EM)
- [X] NET: Intel PRO/1000 T Server (82543GC)
- [X] NET: AMD PCnet-FAST III

- [X] 86Box
- [X] MB: Abit BF6
- [X] CPU: Intel Pentium II (233 MHz)
- [X] GPU: Cirrus Logic GD5446
- [X] RAM: 16 MB
- [X] DSK: Western Digital Caviar 14300 (4.3 GB)
- [X] NET: AMD PCnet-FAST III
- [/] SND: Creative SoundBlaster 16

- [X] Bochs

## Computers

### Desktops

- [x] Custom (2004)
- [x] MB: MSI RS482M
- [x] DSK: ATA
- [x] CPU: AMD Athlon 64 3200+ (2.0 GHz)
- [x] NET: Realtek RTL8100C
- [X] Custom (2004)
- [X] MB: MSI RS482M
- [X] DSK: ATA
- [X] CPU: AMD Athlon 64 3200+ (2.0 GHz)
- [X] NET: Realtek RTL8100C
- [ ] SND: Realtek ALC655 (AC'97)

- [x] Custom (2007)
- [x] MB: Asus P5K
- [x] DSK: ATA
- [x] CPU: Intel Core 2 Duo E6850 (3.0 GHz)
- [X] Custom (2007)
- [X] MB: Asus P5K
- [X] DSK: ATA
- [X] CPU: Intel Core 2 Duo E6850 (3.0 GHz)
- [ ] NET: Attansic L1
- [x] NET: Intel PRO/1000 GT Desktop (PCI)
- [x] NET: Realtek RTL8139B (PCI)
- [x] NET: Realtek RTL8139C (PCI)
- [x] NET: Realtek RTL8139D (PCI)
- [X] NET: Intel PRO/1000 GT Desktop (PCI)
- [X] NET: Realtek RTL8139B (PCI)
- [X] NET: Realtek RTL8139C (PCI)
- [X] NET: Realtek RTL8139D (PCI)
- [ ] SND: Realtek ALC883 (HDA)

- [x] HP ProLiant MicroServer N40L (2012)
- [x] CPU: AMD Athlon II Dual Core
- [X] HP ProLiant MicroServer N40L (2012)
- [X] CPU: AMD Athlon II Dual Core
- [ ] NET: HP NC107i

- [x] Lenovo ThinkCentre M83 SFF (2014)
- [x] CPU: Intel Pentium G3220 (3.0 GHz)
- [x] NET: Intel I217-LM
- [X] Lenovo ThinkCentre M83 SFF (2014)
- [X] CPU: Intel Pentium G3220 (3.0 GHz)
- [X] NET: Intel I217-LM

- [x] Intel NUC 5CPYH (2015)
- [x] CPU: Intel Celeron N3050 (1.6 - 2.16 GHz)
- [X] Intel NUC 5CPYH (2015)
- [X] CPU: Intel Celeron N3050 (1.6 - 2.16 GHz)
- [ ] DSK: AHCI
- [ ] NET: Realtek RTL8111HN

### Laptops

- [x] IBM ThinkPad X20 (2000)
- [x] CPU: Intel Mobile Pentium III (600 MHz)
- [x] DSK: ATA
- [X] IBM ThinkPad X20 (2000)
- [X] CPU: Intel Mobile Pentium III (600 MHz)
- [X] DSK: ATA
- [ ] NET: Intel PRO/100 SP Mobile (82550EY)
- [ ] SND: Cirrus Logic CS4297 (AC'97)

- [x] Dell Latitude E6400 (2008)
- [x] CPU: Intel Core 2 Duo P8600 (2.4 GHz)
- [x] DSK: ATA
- [X] Dell Latitude E6400 (2008)
- [X] CPU: Intel Core 2 Duo P8600 (2.4 GHz)
- [X] DSK: ATA
- [ ] DSK: AHCI
- [x] NET: Intel 82567LM
- [X] NET: Intel 82567LM

- [x] Lenovo ThinkPad X200 (2008)
- [x] CPU: Intel Core 2 Duo P8600 (2.4 GHz)
- [x] DSK: ATA
- [X] Lenovo ThinkPad X200 (2008)
- [X] CPU: Intel Core 2 Duo P8600 (2.4 GHz)
- [X] DSK: ATA
- [ ] DSK: AHCI
- [x] NET: Intel 82567LM
- [X] NET: Intel 82567LM

- [x] Lenovo ThinkPad T440p (2013)
- [x] CPU: Intel Core i5-4300M (2.6 - 3.3 GHz)
- [X] Lenovo ThinkPad T440p (2013)
- [X] CPU: Intel Core i5-4300M (2.6 - 3.3 GHz)
- [ ] DSK: AHCI
- [x] NET: Intel I217-LM
- [X] NET: Intel I217-LM

- [x] Lenovo ThinkPad X260 (2016)
- [x] CPU: Intel i3-6100U (2.3 GHz)
- [X] Lenovo ThinkPad X260 (2016)
- [X] CPU: Intel i3-6100U (2.3 GHz)
- [ ] DSK: AHCI
- [x] NET: Intel I219-V
- [X] NET: Intel I219-V

- [x] Lenovo ThinkPad X270 (2017)
- [x] CPU: Intel i3-6100U (2.6 - 3.3 GHz)
- [X] Lenovo ThinkPad X270 (2017)
- [X] CPU: Intel i3-6100U (2.6 - 3.3 GHz)
- [ ] DSK: AHCI
- [x] NET: Intel I219-V
- [X] NET: Intel I219-V

- [x] Lenovo ThinkPad T480 (2018)
- [x] CPU: Intel Core i5-8350U (1.7 - 3.6 GHz)
- [X] Lenovo ThinkPad T480 (2018)
- [X] CPU: Intel Core i5-8350U (1.7 - 3.6 GHz)
- [ ] DSK: AHCI
- [ ] NET: Intel I219-LM
9 changes: 2 additions & 7 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ And it's quite [customizable](colors.md):

![light mode screenshot](images/light.png)

## Demo (currently disabled)
## Demo

Log in to a demo using the name of the system as the password for the guest
account:

$ ssh guest@try.moros.cc

Happy hacking!
Try a [demo](demo) inside your browser.
18 changes: 13 additions & 5 deletions run/grub-floppy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ set -e
# Usage: sh run/grub-floppy.sh [output]
output=${1:-moros-i686-floppy.img}
kernel=target/i686-moros/release/moros
grub=/usr/lib/grub/i386-pc
if [ "$(uname -s)" = "Darwin" ]; then
strip=x86_64-elf-strip
grub=i686-elf-grub
grub_dir=/usr/local/lib/i686-elf/grub/i386-pc
else
strip=strip
grub=grub
grub_dir=/usr/lib/grub/i386-pc
fi
tmp=tmp/floppy

if [ ! -f "$kernel" ]; then
Expand All @@ -15,10 +23,10 @@ fi
rm -rf $tmp
mkdir -p $tmp

grub-mkimage -O i386-pc -d $grub -p "(fd0)/boot/grub" \
$grub-mkimage -O i386-pc -d $grub_dir -p "(fd0)/boot/grub" \
-o $tmp/core.img biosdisk fat multiboot2 gzio normal configfile

strip -o $tmp/kernel.elf "$kernel"
$strip -o $tmp/kernel.elf "$kernel"
gzip -9 $tmp/kernel.elf

cat > $tmp/grub.cfg <<EOF
Expand All @@ -35,8 +43,8 @@ reserved=$(( 1 + (size + 511) / 512 ))
rm -f "$output"
mkfs.fat -C -F 12 -R $reserved -n MOROS "$output" 1440

dd if=$grub/boot.img of="$output" bs=1 count=3 conv=notrunc
dd if=$grub/boot.img of="$output" bs=1 skip=62 seek=62 count=450 conv=notrunc
dd if=$grub_dir/boot.img of="$output" bs=1 count=3 conv=notrunc
dd if=$grub_dir/boot.img of="$output" bs=1 skip=62 seek=62 count=450 conv=notrunc
dd if=$tmp/core.img of="$output" bs=512 seek=1 conv=notrunc

mmd -i "$output" ::/boot ::/boot/grub
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn init(memory_map: &MemoryMap, offset: u64) {
sys::x86::int::enable_interrupts();

sys::serial::init();
sys::keyboard::init();
sys::clk::init();

let v = option_env!("MOROS_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"));
Expand All @@ -57,6 +56,7 @@ pub fn init(memory_map: &MemoryMap, offset: u64) {
sys::ata::init();
sys::fs::init(); // Require ATA
sys::process::init();
sys::keyboard::init(); // Require MEM

log!("RTC {}", sys::clk::date());
}
Expand Down
10 changes: 8 additions & 2 deletions src/sys/ata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ enum IdentifyResponse {
None,
}

impl IdentifyResponse {
fn read_str(buf: &[u8]) -> String {
String::from_utf8_lossy(&buf).trim().trim_matches('\0').into()
}
}

#[allow(dead_code)]
#[repr(usize)]
#[derive(Debug, Clone, Copy)]
Expand Down Expand Up @@ -338,8 +344,8 @@ impl Drive {
let res = buses[bus as usize].identify_drive(dsk);
if let Ok(IdentifyResponse::Ata(res)) = res {
let buf = res.map(u16::to_be_bytes).concat();
let model = String::from_utf8_lossy(&buf[54..94]).trim().into();
let serial = String::from_utf8_lossy(&buf[20..40]).trim().into();
let model = IdentifyResponse::read_str(&buf[54..94]);
let serial = IdentifyResponse::read_str(&buf[20..40]);
let block_count = u32::from_be_bytes(
buf[120..124].try_into().unwrap()
).rotate_left(16);
Expand Down
8 changes: 0 additions & 8 deletions src/sys/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub use paging::{active_page_table, create_page_table};
pub use phys::{phys_addr, PhysBuf};

use crate::sys::boot::MemoryMap;
use crate::sys::pic;
use crate::sys::x86::addr::{PhysAddr, VirtAddr};

use core::sync::atomic::{AtomicUsize, Ordering};
Expand All @@ -33,11 +32,6 @@ static PHYS_MEM_OFFSET: Once<usize> = Once::new();
static MEMORY_SIZE: AtomicUsize = AtomicUsize::new(0);

pub fn init(memory_map: &MemoryMap, offset: u64) {
// Keep the timer interrupt to have accurate boot time measurement but mask
// the keyboard interrupt that would create a panic if a key is pressed
// during memory allocation otherwise.
pic::mask(pic::KBD_IRQ);

let mut memory_size = 0;
let mut last_end_addr = 0;
for region in memory_map.iter() {
Expand Down Expand Up @@ -115,8 +109,6 @@ pub fn init(memory_map: &MemoryMap, offset: u64) {
bitmap::init_frame_allocator(memory_map);
heap::init_heap().expect("heap initialization failed");
}

pic::unmask(pic::KBD_IRQ);
}

pub fn phys_mem_offset() -> usize {
Expand Down
1 change: 1 addition & 0 deletions src/sys/vga/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fn get_attr_ctrl_reg(index: u8) -> u8 {
let tmp = inb(ATTR_ADDR_REG);
outb(ATTR_ADDR_REG, index);
let res = inb(ATTR_READ_REG);
inb(INPUT_STATUS_REG);
outb(ATTR_ADDR_REG, tmp);
res
}
Expand Down
5 changes: 4 additions & 1 deletion src/usr/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
println!("{}Formatting disk ...{}", csi_color, csi_reset);
print!("Enter path of disk to format: ");
let path = io::stdin().read_line();
if path.trim_end() == "/dev/mem" {
if path.trim_end().is_empty() {
error!("No path given");
return Err(ExitCode::Failure);
} else if path.trim_end() == "/dev/mem" {
usr::shell::exec(&format!("memory format"))?;
} else {
usr::shell::exec(&format!("disk format {}", path.trim_end()))?;
Expand Down
Loading
Loading