On Fri, 04 Sep 2015 04:49:43 -0400, James Harris <
james.h...@gmail.com> wrote:
> "Rod Pemberton" <b...@fasdfrewar.cdm> wrote in message
> news:op.x4ewifxjyfako5@localhost...
>> On Thu, 03 Sep 2015 06:50:36 -0400, James Harris
>> <
james.h...@gmail.com> wrote:
>>> Anyone heard of interrupt 15? I hadn't.
>>> [...]
>>> Any of you catching CPU interrupt 0x15?
>>> [...]
>>> Have you ever seen it trigger?
>>
>> No. I wasn't looking for it. You'd need to intall a full
>> set of interrupts for all vectors, not just those your OS
>> needs, in order to trap it and/or any other spurious
>> interrupts. I doubt that most people would do that unless
>> they needed to trace all interrupts or confirm interrupts.
>
> There is a difference between merely trapping interrupts and doing
> something specific to handle them. ISTM better for an OS to *trap* all
> 256 so as to avoid the kind of problem that Tanenbaum was talking about.
> Any vectors that do not have handlers can then at least be noted so that
> something can tell later that a mysterious interrupt vector was invoked.
> At least they won't go marching off trying to execute data as code in
> uncharted memory...!
That's fine during development, but is it acceptable once the OS
has been released to users? ...
Well, wolfgang said he doesn't trap that many, only 0 up to 0x1F,
which are in-use or reserved for the processor. I'm sure he's
also watching the interrupts for the high IRQs too ... I'd guess
that he reprogrammed the PIC to relocate low IRQs, so he's watching
another eight interrupts for the low IRQs too ... :-)
I only wrote code to attempt to recover from IRQs, NMIs, traps,
and faults, but I don't do anything currently for NMI, faults,
or traps except watch for them. I.e., IRQs only do something.
I don't watch for any traps, aborts, or reserved interrupts.
AIR, it wasn't possible to safely recover from some of these ...
depending how one defines "recover" and "safely".
IRQ 0 to 7 (Int 0x08 to 0x0F)
IRQ 8 to 15 (Int 0x70 to 0x77)
NMI (Int 0x02)
faults (Int 0x00,0x01,0x05 to 0x08,0xA to 0xE,0x10 to 0x13)
traps none
aborts none
reserved none
other nothing
Obviously, with 'to' meaning 'through' inclusive here...
Also, my faults, traps, aborts, NMI, etc overlap with the low IRQs
since I don't relocate the BIOS default PIC vectors, although I do
reprogram the PIC to the BIOS defaults. So, your low IRQs will most
likely will be on a different set of interrupts since most OSes have
reprogrammed the PICs to relocate the low IRQs above 0x1F somewhere.
Instead of reprogramming them, I implemented code to distinquish them.
Since my OS was intended to work with DOS code which I have no control
over, I chose to preserve this flawed situation, i.e., shared interrupts.
> That is better than just assuming that a certain vector will never be
> used, as Tanenbaum's problem illustrates.
For a development version of the OS, you might consider watching
everything, at least until you're reasonably sure everything is correct.
For a release version of the OS, I'd probably watch low IRQs, high IRQs,
0x00 through 0x1F, and any OS API interrupts. What more do you need for
the OS to function? There really isn't much you can do if an unexpected
interrupt is generated which causes a serious problem. You'd need to
know about or experience the issue to write code that would fix it.
If fault tolerance is an issue, you'd ignore any and all spurious or
unexpected interrupts and continue executing. I.e., no crash, no halt,
no reboot, no stopping, recover. So, you'd set them to a "dummy" iret
routine so code execution doesn't go "off-into-the-weeds".
If security is an issue, you'd watch all of them, report them to the
user, log them, and set all of them to call a routine to handle the
unexpected issue. Security assumes the worst and takes the most
extreme measure to ensure security isn't breached. I.e., if an
unexpected interrupt was generated, you'd do a forced reboot. You
might even reset the unused vectors periodically in case malware
changes them, e.g., every 1000th timer interrupt.
If user annoyance by the OS is an issue, which is a personal pet
peeve of mine ..., you won't tell the user about them.
So, your goals here matter. AISI, they affect your design. You need
to decide on fault tolerance or security or some combination or not
an issue. AIUI, fault tolerance and security would be difficult to
co-exist.
> I do a lot of programming too, and for pleasure, it has to be said,
> but to me it's hard work. He seems to do it easily and just for fun.
It's both.
Sometimes, the best solution is not to force things, but to let them
sit and age until the solution presents itself, mysteriously and
out-of-the-blue. You can't do that in a corporate environment or
with a deadline.
> [link]
>
> "This program is a simulator (i.e., an interpreter) for the IBM PC.
> It has been tested on a VAX\(en11/750 running 4.1BSD, but since it
> is entirely in C, it should run on almost any 32\(enmachine with a
> C compiler and a reasonable UNIX system."
>
It probably has bit-rotted, but otherwise might be a way to
execute BIOS or other 16-bit code from a 32-bit/64-bit OS.
AIR, one of the BSDs tried to get PCC up and running again,
because of the license, but it was simply too rotted to be
worth the time or effort.