Lurker News
Finally got my hobby OS up and running on real hardware. I love the old IBM thinkpads, so thought it was the perfect machine to get it working on. Been working on it for quite some time now, but this has been a big milestone!

Comments (116) 39 threads

Earlier comments
byte_01 reply#
Just adding this comment to say congratulations and how impressed I am by your project! I've been an OS Dev fan since my teens and it feels great to see this achievement come to life. I am a little curious to know how the graphics subsystem is initialized. I wish you the best of success.
xyst2 replies#
I wish I could spare time like this to work passion projects.

Forget practicality.
Forget "go to market" strategy.
Forget target fit.
Just build and learn.

joexbayer#
Yeah! It’s really refreshing, not having to think about it actually being “used” or the market. Simply just for fun and learning.
anyfoo#
Out of curiosity, why can’t you spare time? I’d be pretty lost without my hobby projects (one of them was a toy OS, but that stopped when low level OS development became my actual job), ever since I was a kid.
Hashex1295421 reply#
Hi, I'm in this field about decades and trying to learn OS development. I've an idea of FASM, NASM, FASM-G. But I need to study the output of assembler program. So I can understand how the OS is actually works in the binary level. Do you learned opcodes for the particular architecture? What did you for device driver programs? Can you please list out the steps to develop my own OS.
joexbayer2 replies#
I think the two best places to learn about it is the osdev forum and osdev wiki. There are so many useful resources to get you started there.

There are some tutorials out there too, but a lot of them have bugs and you basically recreate their OS.
Regarding studying opcodes, I never went that deep, closest I got was looking them up for my C compiler, so I know the most common basic ones.
https://forum.osdev.org/ https://wiki.osdev.org/Expanded_Main_Page

Hashex129542#
I understood. Thank you very much for the information. It's definitely much helpful to me.
peterfirefly#
An x86 disassembler is not that hard, as long as you stick to a single mode and ignore the SIMD alphabet soup.

You have a short loop that scans through the prefixes, checks for a REX prefix (if you handle 64-bit mode), reads the opcode (1-3 bytes), reads the MOD/RM byte if there is one (use a table lookup), reads the SIB byte if there is one (table), reads offset if there is one (table), reads immediate if there is one (table).
It's probably easiest if you use an "expanded/normalized" opcode internally so the 1-3 opcode bytes + the 3 extra bits from some MOD/RM bytes + prefix info (for certain SIMD instructions) map to a single 16-bit opcode (likely around a couple hundred to a thousand opcodes in total).
You have a table that maps those to mnemonics + operand info. You have some tables that map 0-7 (or 0-15) to AL/AH/... and AX/BX/CX/... and CS/DS/ES/... and various system registers.
Not that much code all in all. Several tables. You can squeeze them and bit pack them to your heart's content if you want.
Once you have that, a simple assembler isn't so hard.

ummonk1 reply#
That is so awesome! I'd really like to see more people bringing back the spirit of early computing with much more tinkering at the computer rather than app level.

I've been thinking about doing a long term hobby project of creating a personal computer - one where I create the entire software stack myself and can know the provenance of every bit that goes into the system (though I can't do the same with the hardware, unless I can get enough performance out of an FPGA to run everything on it).
Until now it seemed unrealistic but you proved it's possible! And looks like you're even implementing a hobby C compiler: https://github.com/joexbayer/C-Compiler

joexbayer#
Thanks! Yes, knowing that you’ve written everything from high up in userspace down to the drivers is a great feeling! But also a debugging hell…

The C compiler is built for the OS, and works inside it. The project became just so big that I wanted to take it out of the OS repo. Especially because it works on Linux too.

Load more comments