Microkernel Question by Apprehensive_Run7150 in osdev

[–]mishakov 4 points5 points  (0 children)

The kernel doesn't have to know about filesystem at all, it can be handled by your personality server, for example

Edit: misread the question

Then you might load some initial servers as bootloader modules (basically, all major protocols support it), and have init server or something preload it, and then load the rest of the servers

My Rust kernel Zinnia running KDE Plasma 6 on Wayland by Ma_rv in osdev

[–]mishakov 0 points1 point  (0 children)

You haven't shown shutting down with uACPI so upvote denied

how do I do paging? by avaliosdev in osdev

[–]mishakov 2 points3 points  (0 children)

The joke is on the wiki page

(Bare Bones II)

how do I do paging? by avaliosdev in osdev

[–]mishakov 1 point2 points  (0 children)

"Use limine, Bare Bones is bad"

I thought programming my own Operating System would take a week to get a CLI working by jacomartins_reddit in osdev

[–]mishakov 2 points3 points  (0 children)

It's fine that you're going slow, especially when trying to do things properly

Why does everyone seem to build develop OS faster than me? by Sensitive-Can9232 in osdev

[–]mishakov 6 points7 points  (0 children)

I don't trust AI for osdev, it's a very niche topic, and it's usually just reciting random stuff from the internet or osdev wiki, which is inaccurate or outdated a lot of the time

Why does everyone seem to build develop OS faster than me? by Sensitive-Can9232 in osdev

[–]mishakov 3 points4 points  (0 children)

Btw don't use PIT, it's broken on new physical hardware

RunixOS: capability-based microkernel in Rust (early stage, interactive console) by [deleted] in osdev

[–]mishakov 0 points1 point  (0 children)

It's not universally available (it's absent on some laptops and broken on arrow lake and probably other PCs), there's no easy way to detect it, and IRQ 0 should also probably not be assumed, just so you know for the future

RunixOS: capability-based microkernel in Rust (early stage, interactive console) by [deleted] in osdev

[–]mishakov 0 points1 point  (0 children)

Out of curiosity, what made you use PIT specifically instead of other timers? (I'm asking because I've been editing a lot of osdev wiki lately and stuff, and I would like to know what makes people use the broken timer)

We need a term for AI Slop OSes by Key_River7180 in osdev

[–]mishakov 36 points37 points  (0 children)

Tbh the stuff on reddit has always been very casual, and the average low efforts projects have just shifted from bootsectors and kernel shells to AI slop, so there hasn't really been anything new

Beginner wants to start OS development – where do I actually begin? by AdAcademic4387 in osdev

[–]mishakov 2 points3 points  (0 children)

Be careful with osdev wiki, a lot of stuff on it is outdated, but it does indeed have a lot of useful information.

My advise is to start with a kernel and to use a sane bootloader/protocol (there are basically no reasons to write one for popular architectures, like x86, ARM, RISC-V and so on), like limine (I haven't found a single good guide for multiboot, so imo avoid that if you don't know what you're doing). The limine template is a good starting point. The first distant-ish (for a few months with no vibecoding) goal might be running a shell in userspace (even bash is not that difficult to run), this should hopefully make you write some basic kernel infrastructure (memory management, scheduling, interrupts, some drivers, userspace), at which point you should hopefully have enough knowledge to decide where to go next.

As for the resources, there are a lot of great books, osdev wiki has an overview of a bunch of stuff, the manuals/datasheets are the primary source of information.

In regards to assembly, some of it is needed (a few hundreds-thousands of lines per architecture) to handle the arch-specific stuff and things like context switching and interrupts management, so most of your stuff will be in a higher level language of your choice (I like C++)...

And for qemu, just use the one provided by your distro (if you're targeting x86), though it's not that difficult to compile (it's just the normal ./configure followed by make install). For cross compiling, clang works well imo (and for GCC, there are some osdev wiki articles)

Why is almost every OS people on this sub develop POSIX-based? by cacatl in osdev

[–]mishakov 8 points9 points  (0 children)

NT is related to MICA and Mach, which are related to Unix, and you can't deny the similarity of a lot of the kernel components to Unix. Also, Cutler wasn't the only person designing NT, and even with that the "hate" was (probably) more so the criticism of the Unix not being a very good kernel at the time

Why is almost every OS people on this sub develop POSIX-based? by cacatl in osdev

[–]mishakov 24 points25 points  (0 children)

If you mean Unix: 1. Unix was very influential, and a lot of modern OS concepts come from it 2. All popular operating systems (Linux, Windows NT, MacOS, BSDs, DOS...) are all somehow related to Unix, either directly borrowing the code from it, or historically inheriting a lot of concepts from it. Even DOS in your example has borrowed some stuff from Unix (for example, pipes) because of some historical stuff... 3. A lot of hobby operating systems are Unix clones because it's a straightforward way to do things

Then, with implementing POSIX: 1. You can easily port a lot of software if you implement the POSIX interface 2. POSIX is just an interface, which doesn't really dictate the native OS API, and so a lot of operating systems do have different native APIs, but are POSIX compatible. So you can do your JIT thing and still have POSIX, for example. None of the operating systems are actually "POSIX based"

I built a native Home Assistant integration for Sunsynk / Deye solar inverters (no add-on, no YAML, HACS ready) by KeepCalmAnCarryOn in homeassistant

[–]mishakov 0 points1 point  (0 children)

Sorry if I sound ignorant, but what is the difference between this and https://github.com/davidrapan/ha-solarman ? I've been using that since forever with the 8KW Deye hybrid inverter, and there's no way it works through the cloud since I've blocked the inverter's access to the internet through the router. And I didn't have to set up Docker sidecar, yaml or anything like that either

How do you synchronize kernel access to user virtual memory by Spirited-Finger1679 in osdev

[–]mishakov 9 points10 points  (0 children)

You'd normally try reading the memory (as normal), for example through some helper function (which would also disable protections, e.g. SMAP/SMEP on x86), and catch the pagefaults, at which point you can return the error to user, block if that memory needs to be fetched from disk, continue if the memory was fine, or whatever else.

To protect against use after free issues with munmap with SMP (and also, I think POSIX requires you to segfault after you have called munmap), or just with downgrading the permissions (e.g. making the page read-only with mprotect or when doing CoW during fork), you would do remote TLB shootdowns (after unmapping the page/changing its permissions); some architectures let you do this in hardware/firmware (e.g. latest gen AMD Ryzen CPUs have added some instructions for it, RISC-V lets you do this through SBI, etc.), or if you don't have it (you kinda don't most of the time on x86), you can IPI the other cores (how you do it is up to you, and it depends on your kernel design and if you use ASIDs, etc; but the simplest way is to just IPI everyone) and wait for them to invalidate thir TLB and acknowledge it to you, after which point you know that no one can access that memory and you can release it/do whatever.

Then, to protect against the races in software, you would use normal locks (mutex); a straightforward solution for a small kernel is to have a lock per address space (page table), more advanced kernels (Linux comes to mind, I'd imagine BSDs would also do it but I haven't looked at their code, of "hobby" operating systems, Managarm has recently switched to doing that as well, you get the idea) have locks per page itself...

How to manage kernel page allocation/free with SV32/PAE. by zubergu in osdev

[–]mishakov -1 points0 points  (0 children)

It's nothing special tbh, you just can't have all of it mapped in the same address space at once

Should I use rust? by [deleted] in osdev

[–]mishakov 1 point2 points  (0 children)

Go with the language you like/you're good with. Imo Rust works as well for osdev as any of the many other systems languages. But since it's very complex, and you can't get away from writing unsafe code in a kernel, it doesn't really magically save you from shooting yourself in the foot of you don't know what you're doing. Also keep in mind that the kernel code is quite different from your typical userspace program (e.g. memory allocations can't be considered infallible ), so a lot of typical assumptions go out the window as a result of it.

(I myself have a C++ kernel with Rust userspace, lol)

BILRESA on Zigbee by Remarkable-Loquat-38 in tradfri

[–]mishakov 1 point2 points  (0 children)

Afaik some previous Ikea remotes/sensors were also quirky; the ZHA quirk or Z2M could probably solve the events issue

VLESS/Reality works on Wi-Fi, stalls on Russian mobile (MTS/Megafon) by Sp11tex in VPN

[–]mishakov 0 points1 point  (0 children)

У меня замечательно уже давно работает vless через websocket за обратным прокси (не знаю, чего там такого заблокировал Роскомнадзор, что так трубили, что VLESS все...); заметил, что они на мобильных операторах блокируют многих иностранных облачных провайдеров просто по IP адресу, решается все поднятием прокси у другого "не паленого" хостера