diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-03-02 17:55:31 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-03-02 17:55:31 +0100 |
commit | b68881abc4c50bbc8ee9e81b4e18b0ea011b83b7 (patch) | |
tree | 56af7d51db555183d62c3c50c614c8775efc6aa7 /src/kernel/dev/pciide.c | |
parent | f610cb7baa26b2803fce8b6e4604e8639c71d1d3 (diff) | |
download | kogata-b68881abc4c50bbc8ee9e81b4e18b0ea011b83b7.tar.gz kogata-b68881abc4c50bbc8ee9e81b4e18b0ea011b83b7.zip |
Setup critical section management for parts that must not be interrupted.
Diffstat (limited to 'src/kernel/dev/pciide.c')
-rw-r--r-- | src/kernel/dev/pciide.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/kernel/dev/pciide.c b/src/kernel/dev/pciide.c index 429432f..927e9da 100644 --- a/src/kernel/dev/pciide.c +++ b/src/kernel/dev/pciide.c @@ -167,7 +167,7 @@ void irq14_handler(registers_t *regs) { if (wait_irq14) { thread_t *t = wait_irq14; wait_irq14 = 0; - resume_thread(t, true); // may not return depending on conditions + resume_thread(t); } } @@ -175,7 +175,7 @@ void irq15_handler(registers_t *regs) { if (wait_irq15) { thread_t *t = wait_irq15; wait_irq15 = 0; - resume_thread(t, true); + resume_thread(t); } } @@ -183,7 +183,7 @@ void pciirq_handler(int pci_id) { if (wait_pciirq) { thread_t *t = wait_pciirq; wait_pciirq = 0; - resume_thread(t, true); + resume_thread(t); } } @@ -202,7 +202,8 @@ static void ide_prewait_irq(ide_controller_t *c, int channel) { } static void ide_wait_irq(ide_controller_t *c, int channel) { - asm volatile("cli"); + int st = enter_critical(CL_NOINT); + int irq = c->channels[channel].irq; if (irq == 14) { if (wait_irq14) pause(); @@ -214,7 +215,8 @@ static void ide_wait_irq(ide_controller_t *c, int channel) { if (wait_pciirq) pause(); mutex_unlock(&on_pciirq); } - asm volatile("sti"); + + exit_critical(st); } // ===================================== // |