Re: Confusion about undefined behaviour



On Jul 20, 4:15 pm, Stephen Sprunk <step...@xxxxxxxxxx> wrote:
I'm not familiar enough with the Linux kernel to know offhand why it's
defined...  It might be that traps are disabled, or the Interrupt
Descriptor Table* is mapped there, or something else entirely.  The
point is that you won't get a segfault like you (and the compiler) would
 expect in user code (also defined by the implementation).

(* The IDT must live at physical addresses 0-1023 on x86, which is a
large part of why buggy DOS programs crashed the computer so frequently:
writing through a null pointer would corrupt the IDT, so the next time
that interrupt fired, the CPU would wander off and start executing
something that probably wasn't code, trap to the corrupted IDT again, etc..)


On x86, only in real mode is there an IDT in a fixed location. Which
certainly does not apply to the Linux kernel in the usual
circumstances. In any protected mode, there’s a CPU register which
points to the IDT (with complications – the being x86, of course - and
with a completely different table format than in real mode).
.



Relevant Pages

  • Re: Confusion about undefined behaviour
    ... It might be that traps are disabled, or the Interrupt ... writing through a null pointer would corrupt the IDT, ... user code and the CPU fudges any reads from unmapped virtual addresses. ...
    (comp.lang.c)
  • Re: traps and interrupts
    ... Traps go along with signal handlers. ... the software interrupt code is run instead of exiting ... MailScanner thanks transtec Computers for their support. ...
    (freebsd-questions)
  • Re: Adding a new interrupt handler to the IDT
    ... I have a kernel module which will handle the interrupt - I just need to hook this code into the interrupt handler mechanism. ... I cannot find any documentation on how to create an entry in the IDT or to identify the linkage protocol. ...
    (comp.os.linux.development.system)
  • Re: Adding a new interrupt handler to the IDT
    ... I have a kernel module which will handle the interrupt - I just need to hook this code into the interrupt handler mechanism. ... I cannot find any documentation on how to create an entry in the IDT or to identify the linkage protocol. ... This would be equivalent to creating a handler for the INT instruction. ... tauno voipio iki fi ...
    (comp.os.linux.development.system)
  • Re: Adding a new interrupt handler to the IDT
    ... I have a kernel module which will handle the interrupt - I just need to hook this code into the interrupt handler mechanism. ... I cannot find any documentation on how to create an entry in the IDT or to identify the linkage protocol. ...
    (comp.os.linux.development.system)