Page 6 of 6
Re: Issues with interrupts
Posted: Tue Aug 09, 2022 10:33 pm
by Techflash
Octocontrabass wrote:Okay... and what are the contents of the stack when you hit that breakpoint for the first time?
This seems... a little small:
Code: Select all
Stack address size 8
| STACK 0xffffffffffffff10 [0xffffffff:0xffe04162] (<unknown>)
| STACK 0xffffffffffffff18 [0x00000000:0x0000001e] (<unknown>)
| STACK 0xffffffffffffff20 [0xffffffff:0xfffffff8] (<unknown>)
| STACK 0xffffffffffffff28 [0xffffffff:0xffe0390e] (<unknown>)
| STACK 0xffffffffffffff30 [0xffffffff:0xffe038d0] (<unknown>)
| STACK 0xffffffffffffff38 [0x00000000:0x00008e00] (<unknown>)
| STACK 0xffffffffffffff40 [0xffffffff:0xfffffff8] (<unknown>)
| STACK 0xffffffffffffff48 [0x00000000:0x0000001e] (<unknown>)
| STACK 0xffffffffffffff50 [0x0000ffff:0xffffffe0] (<unknown>)
| STACK 0xffffffffffffff58 [0x00000000:0x00000008] (<unknown>)
| STACK 0xffffffffffffff60 [0x00000000:0x00000000] (<unknown>)
| STACK 0xffffffffffffff68 [0x00000000:0x009a9a9a] (<unknown>)
| STACK 0xffffffffffffff70 [0x00000000:0x001f0414] (<unknown>)
| STACK 0xffffffffffffff78 [0x00000000:0x00000010] (<unknown>)
| STACK 0xffffffffffffff80 [0xffffffff:0xffe0480d] (<unknown>)
| STACK 0xffffffffffffff88 [0x00000000:0x00000000] (<unknown>)
Re: Issues with interrupts
Posted: Tue Aug 09, 2022 10:53 pm
by Octocontrabass
It's small in the sense that you didn't print enough of the stack to see the entire registers struct.
Which I might not actually need, because that incomplete copy of the stack helped me spot
a POP without a matching PUSH. Shouldn't this instruction be "mov $0x10, %eax"?
Re: Issues with interrupts
Posted: Tue Aug 09, 2022 10:56 pm
by Techflash
Octocontrabass wrote:It's small in the sense that you didn't print enough of the stack to see the entire registers struct.
Which I might not actually need, because that incomplete copy of the stack helped me spot
a POP without a matching PUSH. Shouldn't this instruction be "mov $0x10, %eax"?
Indeed it should. That instruction was from a few iterations of the code ago. Testing now.
UPDATE: It now no longer crashes, but I also don't know if it's working or not, since none of the interrupt handlers give any sort of feedback....
UPDATE 2: After making the handler panic on an unknown interrupt, it seems like I'm consistently getting suprious 0x5F interrupts, even on Bochs, eliminating any potential of hardware issues... Which is odd, considering that
this probably not valid interrupt sheet lists 5F as "reserved":
Re: Issues with interrupts
Posted: Wed Aug 10, 2022 10:18 am
by Octocontrabass
There's no way I could tell what's going on without seeing either your code or the rest of the contents of the registers struct.
Although I did spot this mistake. (It's not causing any issues right now because the stack is already aligned due to the number of things you push, but that should be RSP instead of R12.)
Re: Issues with interrupts
Posted: Wed Aug 10, 2022 4:27 pm
by Techflash
Octocontrabass wrote:There's no way I could tell what's going on without seeing either your code or the rest of the contents of the registers struct.
Although I did spot this mistake. (It's not causing any issues right now because the stack is already aligned due to the number of things you push, but that should be RSP instead of R12.)
Ah. That's what I get for having GitHub copilot installed. Well that's fixed now. And I also realized one of the potential causes literally 5 minutes after I went to bed yesterday: My handler doesn't actually yet fix the interrupt number by adding the 127 back to it that was used previously for proper alignment.
UPDATE: After some tinkering I think I got the real interrupt number (still doesn't make sense though, as from what I can find it seems to be a DOS specific interrupt??.....), 0x20.
UPDATE 2: I still simply can't figure out what that interrupt is supposed to be. I'm going to comment out the code that panic's for an unknown interrupt and just simply run the generic handler that should handle the majority of interrupts.
UPDATE 3: After removing that piece of code. It seems like it just goes to a black screen and jumps to some junk code (somehow doesn't crash although it is an inf loop) pushing the current code now. Although: I currently can't test it, I'm at school. But I do have a link back to the PC with the code. So I can make any edits now. But I won't be able to test them for at least a few more hours.
Also something: I'm not entirely sure that the regs stuct is coming through perfectly unscathed. Some of the values seem rather busted (e.g. the RDI register should at the time of the panic contain the address of the "message" variable (so it should start with some 0xF's), however it seems rather random.)