Live data from Hacker News

Show HN: A DOS-like hobby OS written in Rust and x86 assembly

github.com

41–50 of 62 posts

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#42
post #2

Memory-safe language. x86_64, with Arm on the roadmap. Networking stack. Boots from a CD and via multiboot. Your hobby project wipes the floor with DOS.

> Rust and x86 assembly then > Memory-safe language. What's the point? Looks like today Rust is like 3D printing was. As if it makes something better. Printing was hyped and advertised by printers sellers and manufacturers. Finally they run out of money. As for project, it's cool if compatible with old soft. Otherwise suitable mostly for education and masochism. Long way to become practical anyway even if it gets tra…

You can write memory safe code in any language, but having a machine i.e. the Rust compiler check it for you is less error-prone than if a human does it.

Also if you look at the repo, only 3% of the codebase is in Assembly. IMO if >95% project is in Rust, you can definitely claim it's a Rust project.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#43
post #2

Memory-safe language. x86_64, with Arm on the roadmap. Networking stack. Boots from a CD and via multiboot. Your hobby project wipes the floor with DOS.

> Rust and x86 assembly then > Memory-safe language. What's the point? Looks like today Rust is like 3D printing was. As if it makes something better. Printing was hyped and advertised by printers sellers and manufacturers. Finally they run out of money. As for project, it's cool if compatible with old soft. Otherwise suitable mostly for education and masochism. Long way to become practical anyway even if it gets tra…

The idea of Rust is not that it is 100% safe, but rather that it is able to encapsulate unsafety and divide the program in two parts:

- unsafe code plus modules that support it (the "trusted base")

- all the rest

Rust's promise is that there is no way to trigger any undefined behavior from bugs happening in "all the rest" of the code. If that code makes for more than 95% of the total, then that's a huge win compared to a completely unsafe language.

Also, Rust's support for inline assembly is in my opinion better than C's, it's much easier to specify and figure out the constraints on the boundary between Rust/assembly.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#45
post #27

Earlier quoted context omitted.

Afaik there is a 'DIR' command in MS-DOS. Anyway, what would be a better command to list a directory? I could think of 'ls' maybe

I would most likely end up with something like this: CAT CATalogue - output the contents of current directory RM to Raster Memory - load contents of named file in framebuffer MV Make Virtual - map the file into memory and output the address LS Load System - attempt to reboot using the named file as the kernel CD Create Directory - self-explanatory SH System Halt - immediately stop all processing ...and so on.

Love it.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#47

Earlier quoted context omitted.

Booting from an EFI system partition has not been tested yet. FAT12 is the only filesystem (ok, there is a memdisk implementation, but it won't work now) supported, so GPT is not supported at the moment too (yet). Kinda aiming for FAT32 implementation to be the very next implemented (flash disks are usually FAT32 iirc). Not sure about the last question: the OS utilizes/directly writes to the VGA buffer in memory, the…

So MBR partitions? Or no partitions, like from a floppy? Or perhaps it doesn’t know because grub handles that part.

For FAT12, it reads the first sector (0 or bootsector) of the floppy provided to gather information like bytes per sector, reserved sectors count, LBA of the root directory, etc.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#48

Out of curiosity, why x86? Is it the preponderance of resources? The weird instruction format? The complexity of the boot sequence? Are you specifically trying to mimic DOS? > A support for the ARM architecture (aarch) is coming soon too. Wow! How do you support a DOS-like OS across multiple architectures when DOS itself is tightly tied to interactions among the program, the system code, and the architecture?

The x86 arch is used because this system iteration derives from the first one, which relies on BIOS interrupts and inline assembly in Turbo C. I am not trying to mimic (MS-)DOS exclusively, but both systems are highly inspired by it.

IMO multiple archs could be supported as Rust compiler allows the target arch specification, so one would build a specific target before the build itself.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#49
post #29

Earlier quoted context omitted.

You are right. The first iteration however is 16bit and is very close to MS-DOS in terms of compatibility. Moreover, any OS that can handle simple disk I/O ops could be considered a DOS system too, innit?

The 16bit one also looks fun[0] and would run on old PCs the new one does not. Have you considered open sourcing that one? 0. https://krusty.space/projects/rourexos/

NGL, the codebase of the first iteration is pretty much a mess. It had been written in my mid-teenage years, so the C code is not very consistent across the project. There is a filesystem prototype written in Go as well... Also, it is quite complex to even compile RoureXOS: it needs Borland TCC and TASM (ca 1989 btw) to properly build a 16bit executable(s). It is feasible to compile it using DOSBox though. Maybe some day I could open source that one repository too.

Re: Show HN: A DOS-like hobby OS written in Rust and x86 assembly

#50
post #2

Memory-safe language. x86_64, with Arm on the roadmap. Networking stack. Boots from a CD and via multiboot. Your hobby project wipes the floor with DOS.

> Rust and x86 assembly then > Memory-safe language. What's the point? Looks like today Rust is like 3D printing was. As if it makes something better. Printing was hyped and advertised by printers sellers and manufacturers. Finally they run out of money. As for project, it's cool if compatible with old soft. Otherwise suitable mostly for education and masochism. Long way to become practical anyway even if it gets tra…

Well, the point is to experiment with Rust no_std+no_main environment while trying to educate myself on how the things work under the hood. The project itself is part "just" a rewritten system (from C to Rust), and part an enhancement of such system furthermore. It lacks the external program execution though yet.
Post reply on HN