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.
hakware wrote:Oh, and yeah -- no timer interrupt enabled. I'll set that up when I set up multithreading
Just to make sure, do you actually disable (or mask the IRQ) the PIT? Because by default it'll be giving you interrupts at some default rate and causing GPF it there's no IDT entry for whatever IRQ0 is mapped to.
edit: oh, and make sure you have a valid handler for IRQ7 and IRQ15 as well. At least for IRQ7. You could get so called spurious interrupts, and if there's no valid IDT entry, you can GPF from those as well. I'm not sure if those can actually get through even when IRQ7/IRQ15 are masked...
Easiest thing to do is to simply have a valid handler for each and every IRQ line. If you don't need said handler, just have it EOI the interrupt (so PIC doesn't get stuck with it).
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Hmm. All the IRQs are masked except for 0 and 1, but it's definitely the keyboard interrupt that's killing it. Does the keyboard interrupt do any other interrupts after you EOI it or something? I'll try setting up all the interrupts, but i can leave it running for days and it doesn't GPF until I press a key.
"It is time to return real programming to users and even beginning users, to whom it has been denied since 1984."
- Theodore Holm Nelson
Bochs probably gives the best debugging options and logs of all possible environments you could run your code in. You should definitely use it for debugging.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
I have located your problem, the keyboard handler isn't being set (bochs reports an null descriptor). I'm not quite sure how D handles passing stuctures to function. But C, makes a copy of the variable (i.e if it's a pointer, it only copies the pointer rather than the memory it points to).
Microsoft: "let everyone run after us. We'll just INNOV~1"
Well certainly now it's calling the function, even doing the dirty work (the key goes through, is buffed, and gets printed, though it's actually the wrong key O.O). However, it GPFs after that (which I'm working on fixing -- I'm hoping that making it dynamic will help .
"It is time to return real programming to users and even beginning users, to whom it has been denied since 1984."
- Theodore Holm Nelson
I'd like to remind you of Brendan's suggestion to get the faulting EIP and error code and look them up in your sources, as well as using Bochs' debugger to isolate the exact cause.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Hm. I'm not entirely sure how to do the first one, and the second one requires me to have bochs (which historically hasn't wanted to compile on this system, and most binary packages don't work on here). I could try compiling it again, but from what I understand, bochs isn't complete enough to run most oses anyway. Qemu works for me generally, but I end up grepping through endless lines of asm output to find what went wrong (not to mention, my GPF output is in the IDT, and that makes tons of calls as well, further complicating the matter). My best bet is probably to figure out what is killing it using my kernel_assert(), though that won't do much if the problem is, say, after the iret. and before when it resumes into the main code.
"It is time to return real programming to users and even beginning users, to whom it has been denied since 1984."
- Theodore Holm Nelson
This would normally be done when you return from the function, but as you are effectively bypassing the normall method of returning (by calling an 'iret') , you need to put this kind of thing in manually. A simpler method would be to use an asm stub.
hakware wrote:Hm. I'm not entirely sure how to do the first one, and the second one requires me to have bochs (which historically hasn't wanted to compile on this system, and most binary packages don't work on here).
What kind of development host do you use if binaries don't work and Bochs doesn't compile?
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.