diff options
author | kaashoek <kaashoek> | 2006-07-10 13:08:37 +0000 |
---|---|---|
committer | kaashoek <kaashoek> | 2006-07-10 13:08:37 +0000 |
commit | 72ea69fbdfb6db6111cf3e1f5ef540e4a87ec29c (patch) | |
tree | c81f52d3ce2aae08e96072e35402875c5a8e4160 /syscall.c | |
parent | 7837c71b32fc716101a859302e0349061416bd6e (diff) | |
download | xv6-labs-72ea69fbdfb6db6111cf3e1f5ef540e4a87ec29c.tar.gz xv6-labs-72ea69fbdfb6db6111cf3e1f5ef540e4a87ec29c.tar.bz2 xv6-labs-72ea69fbdfb6db6111cf3e1f5ef540e4a87ec29c.zip |
read the disk using interrupts
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -227,14 +227,24 @@ sys_cons_putc() int sys_block(void) { - char buf[1]; + char buf[512]; + int i, j; cprintf("%d: call sys_block\n", cpu()); - ide_init(); - ide_read(0, buf, 1); - // cprintf("sec0.0 %x\n", buf[0] & 0xff); - cprintf ("call sleep\n"); - sleep (0); + for (i = 0; i < 100; i++) { + if (ide_start_read(i, buf, 1)) { + panic("couldn't start read\n"); + } + cprintf("call sleep\n"); + sleep (&disk_channel); + if (ide_read(i, buf, 1)) { + panic("couldn't do read\n"); + } + cprintf("sector %d: ", i); + for (j = 0; j < 2; j++) + cprintf("%x ", buf[j] & 0xff); + cprintf("\n"); + } return 0; } |