Hacker News new | past | comments | ask | show | jobs | submit login
The 539kernel Book: A journey in creating an operating system kernel (539kernel.com)
251 points by atan2 on Nov 20, 2022 | hide | past | favorite | 10 comments



Very quickly skimming through the various chapters, it appears that content offers a gentle introduction to the topic. Attention has been made to provide clear and verbose explanations with supportive diagrams.

Comparable other "guides" that I have stumbled across is osdev101 [1] and "Writing an operating system from scratch" [2].

[1] https://github.com/tuhdo/os01/blob/master/Operating_Systems_...

[2] https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures...


I was wondering how this compares with xv6, which is a Unix v6 like 32 bit system written for teaching so peeked at the book and the code. I've only scratched the surface but the developer of the project says that he's deliberately written the code in a very simple style to make its function clear and obvious. I'd agree. It does seem pretty easy to understand. It's also very much simpler in structure and the facilities that xv6 in terms of the facilities that it offers. Fun project and it might be a good place those wanting to understand operating systems to start. Here's the repo for it.

https://github.com/MaaSTaaR/539kernel


539 appears to only be a kernel, there isn’t any userspace. Xv6 includes a kernel as well as a userspace containing well known utilities like sh, ls, cat, and others.


What's the significance of 539? Form I-539, "Application to Extend/Change Nonimmigrant Status" doesn't seem to be a relevant reference.



Idk but this seems slightly more probable at least:

> The angel number 539 is suggesting you focus on your success. It will be the opportunity to interchange your ideas with others who will assist you in sailing through challenges.

https://www.sunsigns.org/angel-number-539-meaning/

> stick with your plan. It is a good plan that can guarantee great results.

> Get the job done and let your creative ideas flow. When people start offering their help and assistance, don’t say no!

https://angelnumber.org/539-angel-number/


Angel number 538 seems equally fitting …


If I want to porting it to x86_64, except the register width, what else do I mainly need to take care of? Thanks!


If you're going to port it to a different architecture, do arm64 or risc-v. Don't waste your time learning about the quirks of a processor lineage which has compatibility with features meant to solve problems from the 70s, like segmentation for example.

If you do want to do x86_64, off the top of my head by rough order where you will encounter things:

0. bootstrapping the kernel either gets more complicated or easier based on whether you start in 32 bit mode or 64 bit mode with UEFI. Just start from UEFI and save yourself the headache.

1. The gdt (segmentation table) format changes

2. The tss (another segmentation table) format changes

3. The idt (interrupt table) format changes

4. The ABI (application binary interface, calling convention mostly) changes, leading to a ton of subtle changes to the asm, much deeper than just the register width

5. The page table format changes.

6. Modern processors kick off sibling cores slightly differently. That's not really a 32->64 bit thing but is good to keep in mind.

7. I didn't look to see how they implement their syscall path, but you want to have your kernel ABI be the sysenter instruction, and not say int 0x80. It will simplify your life


I would consider booting from UEFI rather than writing your own bootloader.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: