robert-w-gries / rxinu

Rust implementation of Xinu educational operating system
Apache License 2.0
33 stars 4 forks source link

Restore interrupts to previous status instead of enabling global interrupts #47

Closed robert-w-gries closed 6 years ago

robert-w-gries commented 6 years ago

disable_then_restore

Previously, the disable_interrupts_then function would globally disable interrupts, run some code, then it would globally enable interrupts. This worked well for the initial use case of disabling interrupts before initializing the PIC.

However, we ran into an issue where nested disable_interrupts_then calls would enable interrupts globally in places where we didn't expect it. The behavior I actually wanted was as follows:

  1. Disable interrupts globally
  2. Run critical section of kernel
  3. Restore interrupts to previous state before step 1

Minor Changes

There were some minor changes involving compiler warnings and travis. Also, it was determined that using drop(&process.kstack) would actually leak data, so we switch back to process.kstack = None in our Scheduler.kill() method.