Int 0x80 from user mode code
Int 0x80 from user mode code
Hi all,
I wrote my ISR for int 0x80 in KERNEL and hooked the ISR into the IDT using the interrupt gate desc.I also have one TSS and its descriptor just to hold SS0 & ESP0 info.After all these when I use 'int 0x80' from user mode code my ISR is not getting invoked
Am i missing anything here ???
Thanks in advance,
sampath S
I wrote my ISR for int 0x80 in KERNEL and hooked the ISR into the IDT using the interrupt gate desc.I also have one TSS and its descriptor just to hold SS0 & ESP0 info.After all these when I use 'int 0x80' from user mode code my ISR is not getting invoked
Am i missing anything here ???
Thanks in advance,
sampath S
Hi,
If your GPF handler is not being invoked, it seems to me that you have either a bad kernel-mode stack, bad paging, or incorrectly loaded segment registers.
One thing I have found useful in this situation is Bochs. In the Bochs source file, try setting the line which is similar to:
and extend this line so it reads:
When you get the triple fault and the CPU resets, Bochs will halt, displaying current register information. Often, it also displays a helpful comment above this, such as 'SS RPL != DPL', or something similar.
HTH,
Adam
If your GPF handler is not being invoked, it seems to me that you have either a bad kernel-mode stack, bad paging, or incorrectly loaded segment registers.
One thing I have found useful in this situation is Bochs. In the Bochs source file, try setting the line which is similar to:
Code: Select all
cpu: count=1, ips=2000000
Code: Select all
cpu: count=1, ips=2000000, reset_on_triple_fault=0
HTH,
Adam
The problem is almost certainly that either:
1. Your IDT isn't available for some reason. If you have paging enabled, have you used a physical or virtual address in your LIDT instruction? Do you get the same behaviour when you enable interrupts?
2. Your IDT is incorrectly formatted. Check the structure you're using is correct. Is the present bit set?
3. The address of your ISR in the IDT is wrong. Have you used physical addresses rather than virtual? Is CS wrong?
4. Your ISR is unavailable. Is it inside the limits of your code segment? Are its pages available and marked as present? If it's in a different code segment, is its descriptor marked as present?
5. Your ISR does something that immediately causes an unhandled exception.
1. Your IDT isn't available for some reason. If you have paging enabled, have you used a physical or virtual address in your LIDT instruction? Do you get the same behaviour when you enable interrupts?
2. Your IDT is incorrectly formatted. Check the structure you're using is correct. Is the present bit set?
3. The address of your ISR in the IDT is wrong. Have you used physical addresses rather than virtual? Is CS wrong?
4. Your ISR is unavailable. Is it inside the limits of your code segment? Are its pages available and marked as present? If it's in a different code segment, is its descriptor marked as present?
5. Your ISR does something that immediately causes an unhandled exception.
*My IDT & ISRs are working fine when I am in KERNEL MODE.I use physical address in LIDT.
Yes! when I enable interrupts in user mode I get same behaviour.
*All the present bits are set to one.
*My ISR does nothing except SAVE_ALL & RESTORE_ALL register functions.
*My CallGate from user mode to kernel mode is working fine.
But still by int 0x80 is not working....
Yes! when I enable interrupts in user mode I get same behaviour.
*All the present bits are set to one.
*My ISR does nothing except SAVE_ALL & RESTORE_ALL register functions.
*My CallGate from user mode to kernel mode is working fine.
But still by int 0x80 is not working....
You should use virtual address ...I use physical address in LIDT
Well, you say that lot's of your user space code works, even call gates to kernel mode. So I guess you're able to print something to the screen from usermode ? You could print the values of your idt entry and check whether they are correct ( even if you need to adjust the flags of that page you should do that )