diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/etc/intr.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/etc/intr.x')
-rw-r--r-- | sys/etc/intr.x | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sys/etc/intr.x b/sys/etc/intr.x new file mode 100644 index 00000000..e30d610c --- /dev/null +++ b/sys/etc/intr.x @@ -0,0 +1,54 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <xwhen.h> + +define LEN_SAVE 10 + +# INTR_DISABLE, INTR_ENABLE -- Disable interrupts to protect a critical +# section of code. The interrupt handler is saved on a stack and restored +# when interupts are reenabled. + +procedure intr_disable() + +int sp +int save[LEN_SAVE] +common /zintde/ sp, save + +begin + sp = sp + 1 + if (sp > LEN_SAVE) + call sys_panic (1, "interrupt save stack overflow") + + call zxwhen (X_INT, X_IGNORE, save[sp]) +end + + +# INTR_ENABLE -- Reenable interrupts (restore saved interrupt handler). + +procedure intr_enable() + +int junk +int sp +int save[LEN_SAVE] +common /zintde/ sp, save + +begin + if (sp <= 0) + call sys_panic (1, "interrupt save stack underflow") + + call zxwhen (X_INT, save[sp], junk) + sp = sp - 1 +end + + +# INTR_RESET -- Clear the interrupt handler save stack. + +procedure intr_reset() + +int sp +int save[LEN_SAVE] +common /zintde/ sp, save + +begin + sp = 0 +end |