#Rust OS Tutorial (inspired by Phil Opp)

1 messages · Page 1 of 1 (latest)

sharp dew
#

https://github.com/ChocolateLoverRaj/rust-os-tutorial

A walkthrough for making your own operating system in Rust, inspired by Philipp Oppermann's blog "Writing an OS in Rust"

It uses Limine

right now I'm still working on a large part of it (the scheduler) and once that's done I will write tutorials for it.

If someone can make a tutorial for the PCI (+PCIe) or USB that would be great, since I have no experience with it.

GitHub

A walkthrough for making your own operating system in Rust, inspired by Philipp Oppermann's blog "Writing an OS in Rust" - ChocolateLoverRaj/rust-os-tutorial

#

My Mutex syscalls work

#

but it might be suboptimal / have unnecessary stuff

#

Can someone give suggestions?

use crate::Syscall;

/// Attempts to acquire this mutex without blocking. Returns `true`
/// if the lock was successfully acquired and `false` otherwise.
pub struct SyscallTryAquireLock;
impl Syscall for SyscallTryAquireLock {
    const ID: u64 = 0xAEC8487CB8CB65F9;
    type Input = u64;
    type Output = bool;
}

pub struct SyscallAquireLock;
impl Syscall for SyscallAquireLock {
    const ID: u64 = 0x682560F987F7F2C2;
    type Input = u64;
    type Output = ();
}

pub struct SyscallReleaseLock;
impl Syscall for SyscallReleaseLock {
    const ID: u64 = 0x48D2AA22D39E6EF9;
    type Input = u64;
    type Output = ();
}
#

I think TryAquireLock might be unnecessary

#

currently my OS has 1 GUI thread which has the highest priority which can smoothly draw a cursor, and can have many lower priority CPU-heavy threads that run on all available CPUs

sharp dew
sharp dew
vocal vault
#

pretty sure that is another problem in and of itself

sharp dew
#

i'm starting to understand futex

sharp dew
#

I think I need to map guard pages for my kernel stacks

#

I don't want to deal with stack overflows or possible stack overflows

sharp dew
#

I now have a config file for my kernel to read at run time:

(
    log_serial: Debug,
    log_screen: Warn,
    log_sample_messages: true,
)