[Sovled] Problem with 32 bit interrupt handling in C.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
psimonson1988
Member
Member
Posts: 40
Joined: Tue Jul 16, 2019 8:40 pm

Re: Problem with 32 bit interrupt handling in C.

Post by psimonson1988 »

It results in a triple fault because ebp is pushed but never popped... CPU pops important registers back from the stack and since the stack is corrupted it faults.
Where did you see that I'm pushing ebp and never popping it back from the stack? I cannot seem to find it.
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: Problem with 32 bit interrupt handling in C.

Post by austanss »

you don't in particular, it is automatically generated by the compiler for normal functions like the one you have defined.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
psimonson1988
Member
Member
Posts: 40
Joined: Tue Jul 16, 2019 8:40 pm

Re: Problem with 32 bit interrupt handling in C.

Post by psimonson1988 »

So is there a way to stop this from happening or how do I fix it?
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: Problem with 32 bit interrupt handling in C.

Post by austanss »

__attribute__(interrupt)
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: [Sovled] Problem with 32 bit interrupt handling in C.

Post by nexos »

I write my handlers in seperate ASM files. Thats the cleanest way to do it.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply