From 0dd4253747eef56d0f1539fac7d62234f6af5f51 Mon Sep 17 00:00:00 2001
From: rsc <rsc>
Date: Mon, 17 Jul 2006 05:00:25 +0000
Subject: add ide_lock for sleep

---
 syscall.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'syscall.c')

diff --git a/syscall.c b/syscall.c
index 7bd37b7..58045d4 100644
--- a/syscall.c
+++ b/syscall.c
@@ -228,17 +228,20 @@ sys_block(void)
   char buf[512];
   int i, j;
   void *c;
+  extern struct spinlock ide_lock;
 
   cprintf("%d: call sys_block\n", cpu());
   for (i = 0; i < 100; i++) {
+    acquire(&ide_lock);
     if ((c = ide_start_read(i, buf, 1)) == 0) {
       panic("couldn't start read\n");
     }
     cprintf("call sleep\n");
-    sleep (c, 0);
+    sleep (c, &ide_lock);
     if (ide_finish_read(c)) {
       panic("couldn't do read\n");
     }
+    release(&ide_lock);
     cprintf("sector %d: ", i);
     for (j = 0; j < 2; j++)
       cprintf("%x ", buf[j] & 0xff);
-- 
cgit v1.2.3