Interrupts Error Screen?

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.
Post Reply
yByonic
Posts: 13
Joined: Mon Aug 24, 2020 2:25 pm

Interrupts Error Screen?

Post by yByonic »

Hello everyone,
I'm working with Interrupts. In VGA text-mode I sent a message to prove it works. This message appears and very quickly the text-mode disappears and this black screen with orange dots appears.

After a while (~ 3min) the screen is completely black.

PS: I'm using VirtualBox.

Thanks in advance for your help.
Thank you.
Attachments
The black screen with orange dots.
The black screen with orange dots.
VirtualBox_My OS_02_09_2020_20_36_23.png (5.27 KiB) Viewed 1477 times
Octocontrabass
Member
Member
Posts: 5574
Joined: Mon Mar 25, 2013 7:01 pm

Re: Interrupts Error Screen?

Post by Octocontrabass »

It's hard to say what's going on without seeing any code.

My crystal ball says your stack is overflowing into the frame buffer.
yByonic
Posts: 13
Joined: Mon Aug 24, 2020 2:25 pm

Re: Interrupts Error Screen?

Post by yByonic »

Hi,

I'm following this: https://www.youtube.com/watch?v=AgeX-U4 ... 6M&index=6

My source is in here: https://github.com/yByonic/MyOS/tree/master/src

What's wrong? I checked my code 3 times and I can't find the mistake.

Thanks for your help.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Interrupts Error Screen?

Post by iansjack »

Run your code under a debugger and set a watch point on one of the video memory cells that is being overwritten. The stack trace will then show you the code that is causing the problem.
yByonic
Posts: 13
Joined: Mon Aug 24, 2020 2:25 pm

Re: Interrupts Error Screen?

Post by yByonic »

How can I do that? That's possible with VirtualBox?

Thanks.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Interrupts Error Screen?

Post by iansjack »

qemu with gdb is a more versatile combination for debugging. Virtual box does have a built-in debugger, but I don't think it supports watchpoints. On the other hand, yet single-step ping through your code should supply some clues.

As already said, most likely your stack is continually growing (which would indicate that you don't pop all that you push).
yByonic
Posts: 13
Joined: Mon Aug 24, 2020 2:25 pm

Re: Interrupts Error Screen?

Post by yByonic »

I suspect this piece of code:

Code: Select all

int_bottom:

    pusha 
    pushl %ds  
    pushl %es 
    pushl %fs 
    pushl %gs 

    pushl %esp
    push (interruptnumber)
    call _ZN16InterruptManager15handleInterruptEhj
    movl %eax, %esp
    
    popl %gs 
    popl %fs 
    popl %es 
    popl %ds  
    popa 

_ZN16InterruptManager22IgnoreInterruptRequestEv:

    iret
All code in here: https://github.com/yByonic/MyOS/blob/ma ... uptstubs.s

PS: I was unable to identify the error with the debugger. I was stopped by mistakes that don't even exist.

Thanks.
Octocontrabass
Member
Member
Posts: 5574
Joined: Mon Mar 25, 2013 7:01 pm

Re: Interrupts Error Screen?

Post by Octocontrabass »

I suggest you start by adding "-Wall" and "-Wextra" to your compiler parameters. Just browsing around I spotted at least one bug that the compiler will warn you about once you add those options.

You don't have any exception handlers. Setting those up might help you find certain issues, although I'm not sure if they would help in this case.

And finally...

Code: Select all

    movl %eax, %esp
What is this line of code supposed to do?
yByonic
Posts: 13
Joined: Mon Aug 24, 2020 2:25 pm

Re: Interrupts Error Screen?

Post by yByonic »

YEESS!!!

Thanks Octocontrabass, I researched the warning parameters and corrected several other errors.
While researching about what is "movl %eax, %esp" for, I went back in the video and saw that for him to pop %esp and pop (interruptnumber) he would overwrite with the return of the handleInterrupt method (call _ZN16InterruptManager15handleInterruptEhj). When I went to see, this method had no return.

Thank you all.
Post Reply