Finished implementation for pending interrupts.
This commit is contained in:
parent
66c2ae5d38
commit
cad4096910
|
@ -60,10 +60,10 @@
|
||||||
(interrupt-in-set? int *pending-interrupts*))
|
(interrupt-in-set? int *pending-interrupts*))
|
||||||
|
|
||||||
(define (make-interrupt-pending int)
|
(define (make-interrupt-pending int)
|
||||||
(insert-interrupt int *pending-interrupts*))
|
(set! *pending-interrupts* (insert-interrupt int *pending-interrupts*)))
|
||||||
|
|
||||||
(define (remove-pending-interrupt int)
|
(define (remove-pending-interrupt int)
|
||||||
(remove-interrupt int *pending-interrupts*))
|
(set! *pending-interrupts* (remove-interrupt int *pending-interrupts*)))
|
||||||
|
|
||||||
;;; I'm trying to be consistent about the ! suffix -- I don't use it
|
;;; I'm trying to be consistent about the ! suffix -- I don't use it
|
||||||
;;; when frobbing process state. This is not a great rule; perhaps I
|
;;; when frobbing process state. This is not a great rule; perhaps I
|
||||||
|
@ -71,13 +71,17 @@
|
||||||
;;;
|
;;;
|
||||||
;;; I think you should...
|
;;; I think you should...
|
||||||
(define (set-enabled-interrupts new-enabled-interrupts)
|
(define (set-enabled-interrupts new-enabled-interrupts)
|
||||||
(do ((int 0 (+ int 1)))
|
(let ((old-enabled-interrupts *enabled-interrupts*))
|
||||||
((= int number-of-interrupts) new-enabled-interrupts)
|
;;; set it here so the handlers see the correct value
|
||||||
(let ((old-state (interrupt-enabled? int *enabled-interrupts*))
|
(set! *enabled-interrupts* new-enabled-interrupts)
|
||||||
(new-state (interrupt-enabled? int new-enabled-interrupts)))
|
(do ((int 0 (+ int 1)))
|
||||||
(if (and (not old-state) new-state (interrupt-pending? int))
|
((= int number-of-interrupts) new-enabled-interrupts)
|
||||||
(call-interrupt-handler int))))
|
(let ((old-state (interrupt-enabled? int old-enabled-interrupts))
|
||||||
(set! *enabled-interrupts* new-enabled-interrupts))
|
(new-state (interrupt-enabled? int new-enabled-interrupts)))
|
||||||
|
(if (and (not old-state) new-state (interrupt-pending? int))
|
||||||
|
(begin
|
||||||
|
(remove-pending-interrupt int)
|
||||||
|
(call-interrupt-handler int)))))))
|
||||||
|
|
||||||
(define-simple-syntax (with-enabled-interrupts interrupt-set body ...)
|
(define-simple-syntax (with-enabled-interrupts interrupt-set body ...)
|
||||||
(begin
|
(begin
|
||||||
|
@ -200,7 +204,8 @@
|
||||||
last full-interrupt-set))
|
last full-interrupt-set))
|
||||||
(interrupt ((structure-ref sigevents sigevent-type) event)))
|
(interrupt ((structure-ref sigevents sigevent-type) event)))
|
||||||
(if (interrupt-enabled? interrupt (enabled-interrupts))
|
(if (interrupt-enabled? interrupt (enabled-interrupts))
|
||||||
(call-interrupt-handler interrupt))
|
(call-interrupt-handler interrupt)
|
||||||
|
(make-interrupt-pending interrupt))
|
||||||
(lp event))))
|
(lp event))))
|
||||||
|
|
||||||
;;; I am ashamed to say the 33 below is completely bogus.
|
;;; I am ashamed to say the 33 below is completely bogus.
|
||||||
|
|
Loading…
Reference in New Issue