84 Followers
181 Following
1,034 Posts

Hi!

I'm interested in gamedev, operating systems, embedded systems, console emulators, electronics and graphics programming. I'm not particularly proficient in any of those, but hey, I'm learning.

I don't post regularly because I tend to work on stuff slowly. Sometimes I do post a lot, though.

...aaaaaaaaaaaaaaaaaaaaaaa
aaaaaAAAAAAAAAAAAAAAAAAAAAAHH
HHHHHHHHHHH...hi :)
Mwahahaha.
Everything back in order. Now I can compile the os with optimizations on. Yay!
Insert feet in mouth. I'm just a ginormous, bloody idiot. k_int_Init calls k_int_Lidt, which loads the IDT. And k_int_Lidt isn't saving ebx. Nor eax. No wonder things go to shit. It doesn't crash when not optimizing because values are reloaded from the stack all the time.
This is the code it gets generated from. ebx is holding the init_data pointer. The null pointer check before the k_int_Init call is there because I was suspecting the bootloader was screwing up.
This is where the issue happens. At 0xe517 a pointer stored in the stack by the bootloader gets read into ebx. Before the call at 0xe520 the value is correct. After it it's some nonsense that crashes the kernel further down the road. This is at -O3.
Hmm, I wonder if undefined behavior would lead gcc to fail saving a register before a function call that clobbers it.
Fuck, I got them post-anime blues again...

YES! The CPU passes the smoke test. And just executed its first code!

First few manual clock cycles were NOPs, then I fed it a steady stream of additions to a register (add r2 r1 r2) to make the lights on the top register start counting.

So it's actually computing!

Then I started on interfacing it to the emulator so I can feed it actual programs. Not completely finished with that yet, but it's close enough that I can see it starting to work.

All signs are looking good!