Currently, I'm using just rfe, although I have tried actually doing:
addiu $8,$0,0x1801 # Set IntMask[1,2] and IEc.
mtc0 $8,$12
(copied from code in the upper part of iout.s). I get the same results
either way.
I still never get any more interrupts after the first, and the program
eventually goes into an infinite buffer-full loop. How do I turn on
interrupts again correctly?
Incidentally, since the buffer-empty condition appears to be when nextIn ==
nextOut, how do we tell the difference between a full buffer and empty
buffer?
(this isn't my problem, I've stepped through my code; there's only one
interrupt that ever happens.)
Aaron aaf...@uclink4.berkeley.edu
cs61c-sc
> I'm having problems turning on interrupts in my mips2 project (I think).
> My interrupt handler turns off interrupts system-wide (with mtc0 $0,$12),
> then takes care of it's business. My problem is that only one interrupt
> ever seems to happen. I turn off the interrupt-enable bit in the
> transmitter control when the queue is empty as requested, and I assume that
> the print function turns it back on correctly. That leaves my turning on
> of system-wide interrupts as the error.
Nevermind. I solved the problem. It appears manually turning off
interrupts with mtc $0, $12 is a bad thing to do in this case. I'm sure a
TA can provide a detailed explaination why if people are curious. I don't
quite feel qualified to give definitive answers (more studying to do ;)).
Aaron
cs61c-sc
Also, hw solutions are posted and readable in the usual places.
You should, of course, know the answers to the homeworks
since exam questions may be based on them.
--
Richard J. Fateman
fat...@cs.berkeley.edu http://http.cs.berkeley.edu/~fateman/
Yeah...a pretty bad idea. Probably nothing too bad in this case because
there are no timer or hard disk interrupts in SPIM I assume. But if you
did that on a running MIPS machine, it would suddenly appear to stop
running. By turning off all interrupts, you would probably turn off the
timer interrupt, which would basically stop the software heart of the
machine.
In general you only want to mask the interrupt you are dealing with.
In this case, the transmitter interrupt.
BTW there are interrupts which are unmaskable to prevent things like
that from happening. Depending on the architecture, the timer may be
one of them. I understand that on DOS machines (x86) there is a
"reboot" interrupt which is used primarily on laptops to implement
instant-resume. That interrupt is said to be unmaskable. But like
all things on x86, it doesn't really work the way it's advertised.
Gene
--
"... I've seen Sun monitors on fire off the side of the multimedia lab.
I've seen NTU lights glitter in the dark near the Mail Gate.
All these things will be lost in time, like the root partition last
week. Time to die...". - Peter Gutmann in alt.sysadmin.recovery
The "Vulcan Death Pinch" aka the "Three Finger Salute" aka
"Cntl-alt-delete" is the unmaskable reset interrupt on PC
hardware. Most other hardware has some equivelent (L1-A aka Stop-A on
Suns, the reset button on the HPs). What it means is that this
interuupt can NOT be turned off, and it really can't. However, the OS
or (under an unreal operating system like Win95, anything) could bind
whatever interrupt handler is desired to this interrupt, including (if
the OS gets corrupt or is just plain flat annoynig) do nothing. On
some PC unixes, you can bind this interrupt to invoke a desired
program (eg, shutdown -halt -now).
This is why Cntl-alt-del is the login key sequence and the
like for Windows NT: Whatever code is executed is in the interrupt
handler and therefore part of the operating system. So in order to
make a fake login screen for NT (to say grab passwords), you would
need to corrupt the operating system. Unlike on the HPs etc where you
could make a program to fake the login screen to grab people's
passwords.
--
Nicholas C. Weaver Ash C++ durbatuluk, ash C++ gimbatul,
nwe...@cs.berkeley.edu ash C++ thrakatuluk agh burzum-ishi krimpatul!
http://www.cs.berkeley.edu/~nweaver/ -Tolkien on C++
It is a tale, told by an idiot, full of sound and fury, .signifying nothing.
In article <725g7n$q35$1...@agate.berkeley.edu>,
Nicholas C. Weaver <nwe...@hiss.CS.Berkeley.EDU> wrote:
> The "Vulcan Death Pinch" aka the "Three Finger Salute" aka
>"Cntl-alt-delete" is the unmaskable reset interrupt on PC
>hardware. Most other hardware has some equivelent (L1-A aka Stop-A on
>Suns, the reset button on the HPs). What it means is that this
>interuupt can NOT be turned off, and it really can't. However, the OS
>or (under an unreal operating system like Win95, anything) could bind
>whatever interrupt handler is desired to this interrupt, including (if
>the OS gets corrupt or is just plain flat annoynig) do nothing. On
>some PC unixes, you can bind this interrupt to invoke a desired
>program (eg, shutdown -halt -now).
This is not quite correct. 'Ctrl-Alt-Delete' actually sends keyboard
interrupts to the CPU, not the non-maskable interrupt; they certainly
can be turned off. The three keypresses for Ctrl, Alt, and Delete are
actually processed separately by the operating system, the same as any
other keypresses; when the third one occurs, it executes code to shut
down your machine.
I'm not sure what (if anything) generates an NMI in your standard PC.
Some machines that I used to use had it wired to a button on the front
of the box; our custom kernel used an NMI handler that would print out a
stack trace -- this was very useful when the kernel crashed or got into
an infinite loop with interrupts disabled. Pressing Ctrl-Alt-Delete
would have been useless, even if our keyboard handler did something
useful with this key combination (I can't recall if it did), since the
keyboard interrupt would be disabled.
> This is why Cntl-alt-del is the login key sequence and the
>like for Windows NT: Whatever code is executed is in the interrupt
>handler and therefore part of the operating system. So in order to
>make a fake login screen for NT (to say grab passwords), you would
>need to corrupt the operating system. Unlike on the HPs etc where you
>could make a program to fake the login screen to grab people's
>passwords.
Ctrl-Alt-Delete is used as a Secure Attention Key (SAK) under NT, and it
is actually a function of the operating system and not the hardware.
All keypresses are handled through the keyboard interrupt; however,
unlike other key combinations, an application is not allowed to remap
the SAK to do anything else. The semantics of a SAK guarantee that it
will invoke special code in the O/S. NT could have chosen to use any
key combination as the SAK, although choosing something like 'Shift-L'
would probably decrease usability.
The SAK semantics are definitely underused in most operating systems.
Other than NT, I've seen exactly one other setup (under Linux) that used
the SAK functionality to make sure that 'Ctrl-Alt-Backspace' on a
console would give you a login prompt. All other shared machines that
I've used require a reboot to guarantee a secure login prompt.
- Nikita
We used control-slash for a similar purpose on the (locally hacked) PDP-11
Unix system at the Lincoln-Sudbury Regional High School circa 1980.
(Well, it was control-slash on the VT100 keyboard, but I think it actually
sent control-underscore.) Control-slash K would kill all processes on
that terminal, giving you a fresh login prompt; control-slash T would show
who's logged in; etc. And we stole the idea from ITS, the PDP-10 operating
system at the MIT AI Lab, which used a key labelled "backnext" (don't ask)
for similar purposes.
We weren't worried so much about login spoofing as about recovering from
wedged processes, but we got login security (if people used it) as a
bonus. (And of course at AI security was the last thing on their minds,
since ITS didn't have passwords at all back then.)
I have never done this, but as far as I can recall, control-alt-del
actually stores some magic number in some magic address to cause a
soft reboot. Dunno if that's true, that's just what I remember.
Anyway, I meant to refer to a "power off" interrupt which is issued
for the benefit of instant-resume features. I'm curious as to whether
that is maskable. I assume it's not supposed to be maskable, but I
suspect it is anyway, since if it's not, it would mean re-entrance.
Please correct me.