Page 1 of 1

Interrupts Error Screen?

Posted: Wed Sep 02, 2020 1:46 pm
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.

Re: Interrupts Error Screen?

Posted: Wed Sep 02, 2020 2:41 pm
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.

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 1:25 am
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.

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 2:24 am
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.

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 6:10 am
by yByonic
How can I do that? That's possible with VirtualBox?

Thanks.

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 7:02 am
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).

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 11:56 am
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.

Re: Interrupts Error Screen?

Posted: Thu Sep 03, 2020 4:02 pm
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?

Re: Interrupts Error Screen?

Posted: Fri Sep 04, 2020 4:08 am
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.