Which is why we use paging to prevent this.SpyderTL wrote:Any time you see repeated three stacked horizontal lines followed by an S, you are printing your 16-bit Interrupt Table to the screen. This is likely because you are passing a null to a draw string function, so it is drawing everything from RAM address zero until it finds a null value.
[Solved] IRQ Firing Bug
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: IRQ Firing Bug
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: IRQ Firing Bug
Damn, that is not good.Ch4ozz wrote:Your drawstring function probably draws a string but your passing single characters to it which simply wont work.
Either code a proper printf function and you can useor you find another solution.Code: Select all
printf("%c", kbdus[keycode]);
How my PrintString functions works:
1. PrintString gets called: PrintString("abc123");
2. PrintString has a loop, foreach char inside that loop it calls another function called PrintCharacter.
3. PrintCharacter prints given char with wanted color using 0xB8000
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
SpyderTL wrote:Yes. You should notify the master PIC any time it signals an IRQ (0-7), and notify both the master and slave PIC when the slave PIC signals an IRQ (8-15). Any IRQs that you have unmasked should have valid interrupt handlers that will notify the proper PICs installed before you unmask them.thehardcoreOS wrote:Should I use SendEOI Inside my kbd and timer handlers?
Any time you see repeated three stacked horizontal lines followed by an S, you are printing your 16-bit Interrupt Table to the screen. This is likely because you are passing a null to a draw string function, so it is drawing everything from RAM address zero until it finds a null value.thehardcoreOS wrote:When I enable while(1) loop I can use my timer and my keyboard. But I get these weird glyphs:
That's my guess.
(I get this a lot, by the way.. )
I see you get this a lot. You seem to be interrupts expert.
Hmm, about that slave master EOI sending etc, I already have that function inside my IRQ_Handler that does the same exact thing, to just copy paste it inside my Keyboard_Handler and Timer_Handler?
What do you mean by it prints 16bit interrupt table? I don't think so, because it prints only what I tell it to print. Little bit confused in there. Drawing from RAM??? I don't have any kind of memory management set up and I don't interact with RAM as fair as I know, or maybe I do?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
It is sad that I still don't have any kind of memory management. Paging is my next big thing on the list.omarrx024 wrote:Which is why we use paging to prevent this.SpyderTL wrote:Any time you see repeated three stacked horizontal lines followed by an S, you are printing your 16-bit Interrupt Table to the screen. This is likely because you are passing a null to a draw string function, so it is drawing everything from RAM address zero until it finds a null value.
Also I already know that: string paging; paging = "hell".
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: IRQ Firing Bug
Paging is actually very easy; but beginners to it seem to think it's difficult and I thought so myself.thehardcoreOS wrote:It is sad that I still don't have any kind of memory management. Paging is my next big thing on the list.
Also I already know that: string paging; paging = "hell".
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: IRQ Firing Bug
What I meant to say is that whenever I see that pattern on the screen, with three horizontal lines and an S, it looks like what you would see if you copied the bytes starting at RAM address zero to the screen.thehardcoreOS wrote:Hmm, about that slave master EOI sending etc, I already have that function inside my IRQ_Handler that does the same exact thing, to just copy paste it inside my Keyboard_Handler and Timer_Handler?
What do you mean by it prints 16bit interrupt table? I don't think so, because it prints only what I tell it to print. Little bit confused in there. Drawing from RAM??? I don't have any kind of memory management set up and I don't interact with RAM as fair as I know, or maybe I do?
RAM address 0000:0000 is where the interrupt handler table is located when the machine first boots. My guess is that you are (accidentally) passing the wrong address to your print string function, and from the looks of the screen, I'm guessing that your print string function is attempting to draw whatever string is sitting at memory address zero.
Maybe that is a hint to help you track down the actual problem, but I could be wrong.
No, you only have to send the EOI once per interrupt (for each PIC, of course). Your original code looks like you were sending it twice per interrupt. I'm assuming that's fixed now.Hmm, about that slave master EOI sending etc, I already have that function inside my IRQ_Handler that does the same exact thing, to just copy paste it inside my Keyboard_Handler and Timer_Handler?
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: IRQ Firing Bug
Oh, so that's why I always get an S when I pass a NULL pointer to a string output function in my kernel, I never realised that. Not that it's a problem, just fascinating.SpyderTL wrote:What I meant to say is that whenever I see that pattern on the screen, with three horizontal lines and an S, it looks like what you would see if you copied the bytes starting at RAM address zero to the screen.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: IRQ Firing Bug
lol, never tried printing an empty string. fascinating yeahonlyonemac wrote:Oh, so that's why I always get an S when I pass a NULL pointer to a string output function in my kernel, I never realised that. Not that it's a problem, just fascinating.SpyderTL wrote:What I meant to say is that whenever I see that pattern on the screen, with three horizontal lines and an S, it looks like what you would see if you copied the bytes starting at RAM address zero to the screen.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
There is a difference between passing a null address and passing an address to an empty string. If I had to guess, I'd say that your code is passing a null address.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: IRQ Firing Bug
No worries, I fixed it.SpyderTL wrote:There is a difference between passing a null address and passing an address to an empty string. If I had to guess, I'd say that your code is passing a null address.
For all future generations reading this: don't be stupid like me and instead of PrintStringFunction use PrintCharacterFunction and everything should be just fine.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
Thats what I told you before didnt I?thehardcoreOS wrote:No worries, I fixed it.SpyderTL wrote:There is a difference between passing a null address and passing an address to an empty string. If I had to guess, I'd say that your code is passing a null address.
For all future generations reading this: don't be stupid like me and instead of PrintStringFunction use PrintCharacterFunction and everything should be just fine.
Re: IRQ Firing Bug
ROFL, paging is easy. We shall see.omarrx024 wrote:Paging is actually very easy; but beginners to it seem to think it's difficult and I thought so myself.thehardcoreOS wrote:It is sad that I still don't have any kind of memory management. Paging is my next big thing on the list.
Also I already know that: string paging; paging = "hell".
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
Hmm... Did you? Lol, I forgot. oopsCh4ozz wrote:Thats what I told you before didnt I?thehardcoreOS wrote:No worries, I fixed it.SpyderTL wrote:There is a difference between passing a null address and passing an address to an empty string. If I had to guess, I'd say that your code is passing a null address.
For all future generations reading this: don't be stupid like me and instead of PrintStringFunction use PrintCharacterFunction and everything should be just fine.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
Now, I get it. Thanks for explaining. I send EOI only once per interrupts as supposed to, everything works just okay.SpyderTL wrote:What I meant to say is that whenever I see that pattern on the screen, with three horizontal lines and an S, it looks like what you would see if you copied the bytes starting at RAM address zero to the screen.thehardcoreOS wrote:Hmm, about that slave master EOI sending etc, I already have that function inside my IRQ_Handler that does the same exact thing, to just copy paste it inside my Keyboard_Handler and Timer_Handler?
What do you mean by it prints 16bit interrupt table? I don't think so, because it prints only what I tell it to print. Little bit confused in there. Drawing from RAM??? I don't have any kind of memory management set up and I don't interact with RAM as fair as I know, or maybe I do?
RAM address 0000:0000 is where the interrupt handler table is located when the machine first boots. My guess is that you are (accidentally) passing the wrong address to your print string function, and from the looks of the screen, I'm guessing that your print string function is attempting to draw whatever string is sitting at memory address zero.
Maybe that is a hint to help you track down the actual problem, but I could be wrong.
No, you only have to send the EOI once per interrupt (for each PIC, of course). Your original code looks like you were sending it twice per interrupt. I'm assuming that's fixed now.Hmm, about that slave master EOI sending etc, I already have that function inside my IRQ_Handler that does the same exact thing, to just copy paste it inside my Keyboard_Handler and Timer_Handler?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: IRQ Firing Bug
Are you positive this works as intended?omarrx024 wrote:Code: Select all
void ps2_wait_write() { while(inb(0x64) & 2 == 0); } void ps2_wait_read() { while(inb(0x64) & 1 == 0); }
Shouldn't this be:
Code: Select all
void ps2_wait_write()
{
while((inb(0x64) & 2) != 0);
}
void ps2_wait_read()
{
while((inb(0x64) & 1) != 0);
}