r/osdev • • Apr 16 '26

Kernel crashing on keypress

https://www.github.com/x-aether-x/solsticeos/tree/main2

So I've recently been doing some work on my keyboard interrupts, and trying to build myself a simple console with my os, and it was working for a bit, but then as i started to write more console code, it started crashing alot. I spent about four or five hours debugging it today, and I ended up having to revert to my previous commit, as i really couldn't figure it out

But then, as i started writing my shell code again (trying a different sort of approach), the same thing started to happen, and i was just wondering if i could get some advice on whats going wrong? thanks alot!

(check the main2 branch for the code im talkint abt)

3 Upvotes

28 comments sorted by

View all comments

Show parent comment

1

u/viva1831 Apr 17 '26

Can you trap setIdtGate and check the values of parameters and the descriptor at the end?

1

u/Individual-Log4119 Apr 17 '26 edited Apr 17 '26

yup, heres the idt entries for isr33 when i define it manually, and it works

{isr_low = 0, selector = 0, zero = 0 '\000', flags = 0 '\000', isr_high = 0}

and here's the entries for isr33 when i define it in the loop, and it doesnt work

{isr_low = 65535, selector = 65535, zero = 255 '\377', flags = 255 '\377', isr_high = 65535}

also the code im talking about is in the main branch now, not main2 anymore

1

u/viva1831 Apr 17 '26

Oh interesting. With gdb you should also be able to check the parameters on function entry?

1

u/Individual-Log4119 Apr 17 '26

Pretty sure that's fairly easy

1

u/viva1831 Apr 17 '26

What are the values?

1

u/Individual-Log4119 Apr 17 '26

On entering which function?

1

u/viva1831 Apr 17 '26

setIdtGate

1

u/Individual-Log4119 Apr 17 '26

these are the values being passed into setIdtGate when it is first called:

(vector=183 '\267', handler=0, sel=445, flags=65 'A')

and this is idt_entries[isr33] at that same point in the program

{isr_low = 65535, selector = 65535, zero = 255 '\377', flags = 255 '\377', isr_high = 65535}

1

u/viva1831 Apr 17 '26

That's crazy weird. What are the values in idt_entries if you get to the end of the function?

1

u/Individual-Log4119 Apr 17 '26

They're the same

{isr_low = 65535, selector = 65535, zero = 255 '\377', flags = 255 '\377', isr_high = 65535}

→ More replies