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.
I have successfully accessed the RSDT and retrieved it's address. Now I am trying to pass that to the MADT in order to find the address of the IOAPIC. I had taken the function from the MADT article on the Wiki and modified it a bit so that it only retrieved the IOAPIC.
However, any of the code within the first if statement triggers a triple fault (even only having the 'break;'). I am a little confused as to why this is happening. I know it may be a stupid mistake or error I am missing but help would be much appreciated.
FunnyGuy9796 wrote:However, any of the code within the first if statement triggers a triple fault (even only having the 'break;').
It triggers some other fault, and your fault-handling (or lack thereof) triggers the triple fault. That "some other fault" will tell you what's going on.
Now would be a good time to set up exception handlers. They don't have to be too fancy - just dump the CPU registers to the screen or a serial port and halt.
If you don't want to do that right now, your virtual machine can give you that information. (For example, if you're using QEMU, add "-d int" to your command line.)
rdos wrote:I think the IOAPIC is at a fixed address, so no reason to search ACPI tables for it.
Whilst that may be true in practice for current computers, I don't think it's a given. It's probably safer to future proof by specifically finding the address.
FunnyGuy9796 wrote:I kind of just skipped implementing an exception handler mainly because I was being lazy :/
I'm afraid that's false laziness. It is so easy to implement trivial exception handlers (e.g. just "jmp ." which then allows you to investigate the machine state in your debugger), and the consequences of not doing so can be so baffling, that it should be the first thing that you implement.
rdos wrote:I think the IOAPIC is at a fixed address, so no reason to search ACPI tables for it.
Whilst that may be true in practice for current computers, I don't think it's a given. It's probably safer to future proof by specifically finding the address.
I think the chance of a buggy BIOS providing the wrong address actually is higher than the chance this will ever be changed. It's part of Intel's & AMD's chipsets, and not the motherboard build.
Ok, after some debugging I found that the reason the triple fault occurred was because the MADT could not be found. I am unsure as to why that is the case but it is at least a step in the right direction. Does anyone have any idea why the MADT could not be found for the APIC?
You know, that doesn't work unless the MADT is the first table found. If the memcmp() returns nonzero, you will immediately return from the function. Without a value, so the caller will have no defined value telling them the MADT was not found. Also, if you do manage to find the MADT there, you overwrite "ptr2", so now the outer loop will no longer work. Might I suggest adding a few structures to make that mess more readable?
Thank you for the advice. I added the return instruction because without it the loop is infinite and therefore triggers a fault. I am really only using this function to locate the IOAPIC so exiting once it is found isn't really an issue in this situation. I did fix the rewriting of the variable. However, I am still stuck trying to figure out how to find the IOAPIC because, as I said, the loop seems to trigger a fault which makes me think I am searching for the MADT incorrectly or something along those lines.
rdos wrote:I think the IOAPIC is at a fixed address, so no reason to search ACPI tables for it.
Whilst that may be true in practice for current computers, I don't think it's a given. It's probably safer to future proof by specifically finding the address.
I think the chance of a buggy BIOS providing the wrong address actually is higher than the chance this will ever be changed. It's part of Intel's & AMD's chipsets, and not the motherboard build.
If you don’t search, how do know there is only one?