KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In kernel 2.6.11.5, divide zero exception handler is set up as: set_trap_gate(0,÷_error); According to "Understanding The Linux Kernel", Intel trap gate cannot be accessed by a User Mode process. But it's quite possible that a user mode process also generate a divide_error . So why Linux implement it in this way? [Edit] I think that the question is still open, since set_trap_gate() sets DPL value of IDT entry to 0, which means only CPL=0 (read kernel) code can execute it, so it's unclear to me how this handler may be called from the user mode: #include<stdio.h> int main(void) { int a = 0; int b = 1; b = b/a; return b; } which was compiled with gcc div0.c . And the output of ./a.out is: Floating point exception (core dumped) So it doesn't look like this was handled by the division by 0 trap code.
Tags (comma-separated)
Save Edits
Cancel