6 ms·
Writing a RISC-V OS in Rust: System Calls
- Koshkin 7y agoI just wonder what chances any new general-purpose OS kernel may have against Linux.
- beisner 7y agoI suspect that whatever replaces Linux will probably involve a paradigm shift at the lowest level. Perhaps capability-based IPC, perhaps seamlessly integrating local and networked nodes, etc. It’s going to take major major improvements to move the world off of the Linux kernel.
- monocasa 7y agoI imagine it's going to be an exokernel that can run pretty arbitrary user lands as if they were containers, built on cap based security. If anyone agrees with me and wants to help out making that happen on an open source code base, hit me up.
- dnautics 7y agoI don't have time to work on this, but I highly recommend looking at using the erlang Virtual machine as your exokernel environment.
- SkyMarshal 7y agoWhy BEAM? I know it’s good, just curious why this specific use case.
- ummonk 7y agoYes, that's definitely where things should be going. Definitely interested, though I don't have too much time to dedicate for an open source project.
- Geezus42 7y agoWhat kind of help do you need?
- Geezus42 7y agohttps://geezus42.github.io/personal-website/ https://geezus42.github.io/personal-website/
- wyldfire 7y agoHow different is this from the NT kernel? Or Fuchsia?
- dannyobrien 7y agoI'm seeing a few people heading in this direction (and wrote very provisionally about possible wider applications here: https://mastodon.social/@mala/103548286708316253 https://mastodon.social/@mala/103548286708316253 ). I think it's certainly an idea that's in the air.
- jhvkjhk 7y agoIs Qubes OS what you are talking? I heard it can run Windows or Linux like containers on it.
- blattimwind 7y agoQubes = Xen hypervisor
- eyberg 7y agoHave you looked at https://github.com/nanovms/nanos https://github.com/nanovms/nanos yet? What you are describing is fairly close and this is under active development.
- ErotemeObelus 7y agoI want to name my kernel Lennox
- Aloha 7y agoYou just described s hybrid of OS/400 and Plan 9.
- quietbritishjim 7y agoYou could be right, but it's interesting to note that Linux took off because it was actually trying not to be too ambitious. I can't find it now, but I think Linus's original email announcing it said something along the lines of it just being a toy project for experimentation, and not a "proper" OS like the one GNU is building. As you're probably aware, the kernel of the GNU OS, Hurd, involved am ambitious microkernel design, and now 30 years into its development it's still not usable.
- moron4hire 7y agoThat has more to do with the people involved than that they were microkernels.
- msla 7y agoI agree: Trying to create a new general-purpose OS is futile. You're handicapping yourself by attempting a feat which likely can't achieve anything beyond your own satisfaction, which will be limited by the aforementioned self-handicapping. It's like sublimating your musical drive in a knock-off, unoriginal rock band in the vague hope you'll someday become the next Nickleback. Go for the gusto and put the Research in Research OS. Make something to explore an idea mainstream OSes can't pursue because it would break too much compatibility. Be Captain Beefheart, or at least Tool.
- tyingq 7y agoFuchsia has the advantage that Google can force it onto a bunch of phones, Chromebooks, and personal assistants and get instant "market share". I think it's likely the #1 threat to the Linux dominance in the backend, ironically by hijacking the front end first. Based on market share, it could create an expectation that AWS, Azure, etc, provide backend support. Doesn't hurt that Google owns K8S as well. See, for example, EKS. Google can manipulate Amazon in select spaces.
- pjmlp 7y agoOnly with the deep pockets of FAANG like companies. Android or ChromeOS would never have taken off the ground without Google's keeping pushing them forward no matter what. In both OSes the kernel is hardly exposed to userspace, Google could move to something else and it would be hardly noticeable to app developers (OEMs and rooted phones is another matter). And then there is Fuschia. Outside general-purpose domain, the IoT world is getting full of BSD licensed OSes, RTOS, Zephyr, NuttX, Tizen RT. Ironically Zephyr is managed by Linux Foundation, although it doesn't have anything to do with Linux code.
- hhas01 7y agoThat would be wrong battle to fight first. Pick one special-purpose market it can win and take that. Rinse, repeat. Dog knows IoT needs something a lot better than Linux to run on; fat flabby old-school hacker-culture footguns are absolutely not an option when smart tech is being built into everything and everyone. That tech must be small, hard, absolutely focused, and take ZERO shit from NO-ONE; starting with itself. Remember, the only code which can be 100% guaranteed impossible to compromise is code that isn’t there. Today’s Linux kernel is around 20 MILLION LOC, and counting. No prizes for figuring what any competing product’s USP must be. .. “General-purposeness” designed into the product at the start enables it to adapt to each new market quicker and easier, but it shouldn’t be a public selling point in itself. Because the moment you start pitching it as being “everything to everyone”, everyone wants to throw their own crap into it as well—and you’re back to building ”another Linux”, in a market that already has a resident Linux and no room or need for another. Think smart. Don’t covet all the things that Linux does well and try to replicate those. Instead, identify the things Linux doesn’t do well (and CAN’T ever do well because of why and how it’s built) and knock those balls clean out of the park. Think about how Steve Jobs finally beat Microsoft at its own game. Not by building a better PC, but by fundamentally redefining what “Personal Computing” means; and then being first to market with the perfect product for that.
- bogomipz 7y ago>"Each mode has a different ecall cause. If we make an ecall in machine mode (the most privileged mode), we get cause #11. Otherwise, if we make an ecall in supervisor mode (typically the kernel mode), we get cause #9." Could someone say if the kernel runs in Supervisor mode what is the intention of machine mode in RISC-V?
- monocasa 7y agoStuff like "this board/chip needs real time response in order to not melt itself despite not being able to trust that the OS is hard real time" like System Management Mode was originally intended. It's also been handy for trying out supervisor mode concepts and adding software based support on chips that don't support all the features like hypervisor extensions.
- andrekandre 7y agoright, afaiui basically you can trap on unimplemented instructions and emulate risc-v extensions without hardware support (very cool imho) this short video explained it well (to me anyways): https://www.youtube.com/watch?v=4JIvnWEs_pA https://www.youtube.com/watch?v=4JIvnWEs_pA (hypervisor trap explanation at 11m20s mark)
- muricula 7y agoMachine mode is the equivalent of el3 on arm. That's where processor firmware tends to run. There is no paging and very little in the way of security boundaries or seatbelts.
- FullyFunctional 7y agoIt was supposed to be where vendors can patch up differences and provide platform bindings. The (standard) Linux kernel expects to be started in S mode and doesn’t include M mode code. OpenSBI is an example of template firmware that belongs in M mode, not OSes.
- MisterTea 7y agoFor inspiration, have a look at the plan 9 syscall table: http://aiju.de/plan_9/plan9-syscalls http://aiju.de/plan_9/plan9-syscalls This is how you make a simple yet flexible OS. Use an rpc protocol to do all the talking to objects within the system which are exposed as files. It's very REST like and allows any programming language to interact with those objects by reading/writing them as files. So you have a very uniform interface that eliminates a lot of binaries as now simple scripts can handle the work of reading and writing those files. Then realize that you can easily export those files to other machines on a lan or the internet. So the tcp stack of an internet facing machine can be exported and mounted on multiple machines who now all talk to the internet via that one machines tcp stack. And that can even be done across the net to bypass "great firewalls". Bye bye nat.
- pjmlp 7y agoLike WebDAV. As far as I can remember Inferno did syscalls in a different way, given that Limbo with DisVM was the main programming language.
- monocasa 7y agoThey added a couple pieces to help the VMs, but the syscall layer is pretty Plan 9 inspired on Inferno. A few of the man pages call out 9p explicitly. All of the Sys_* here are the system calls on Inferno https://bitbucket.org/inferno-os/inferno-os/src/master/os/port/inferno.c https://bitbucket.org/inferno-os/inferno-os/src/master/os/po...
- pjmlp 7y agoThanks for the hint.
- zozbot234 7y ago> Use an rpc protocol to do all the talking to objects within the system which are exposed as files. At some point, you're just adding pointless layers of indirection by doing this. NT tried this approach, and it is anything but "simple". You can do many things quite naturally by interacting with bytestream-like or block-like objects that are exposed via some sort of hierarchical namespace ("files"), but this doesn't really cover everything. Some things may be better done, even in a script, by interacting with a "binary" that in turn just wraps a binary library exposing some kind of ABI.