diff --git a/Makefile b/Makefile index 96f1c14..a85add2 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ $K/kernel: $(OBJS) $K/kernel.ld $U/initcode $(OBJDUMP) -t $K/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $K/kernel.sym $U/initcode: $U/initcode.S - $(CC) $(CFLAGS) -nostdinc -I. -Ikernel -c $U/initcode.S -o $U/initcode.o + $(CC) $(CFLAGS) -march=rv64g -nostdinc -I. -Ikernel -c $U/initcode.S -o $U/initcode.o $(LD) $(LDFLAGS) -N -e start -Ttext 0 -o $U/initcode.out $U/initcode.o $(OBJCOPY) -S -O binary $U/initcode.out $U/initcode $(OBJDUMP) -S $U/initcode.o > $U/initcode.asm diff --git a/README b/README index 87a3833..06035bb 100644 --- a/README +++ b/README @@ -15,24 +15,26 @@ Clements. We are also grateful for the bug reports and patches contributed by Silas Boyd-Wickizer, Anton Burtsev, Dan Cross, Cody Cutler, Mike CAT, -Tej Chajed, eyalz800, Nelson Elhage, Saar Ettinger, Alice Ferrazzi, -Nathaniel Filardo, Peter Froehlich, Yakir Goaron,Shivam Handa, Bryan -Henry, Jim Huang, Alexander Kapshuk, Anders Kaseorg, kehao95, Wolfgang -Keller, Eddie Kohler, Austin Liew, Imbar Marinescu, Yandong Mao, Matan -Shabtay, Hitoshi Mitake, Carmi Merimovich, Mark Morrissey, mtasm, Joel -Nider, Greg Price, Ayan Shafqat, Eldar Sehayek, Yongming Shen, Cam -Tenny, tyfkda, Rafael Ubal, Warren Toomey, Stephen Tu, Pablo Ventura, -Xi Wang, Keiichi Watanabe, Nicolas Wolovick, wxdao, Grant Wu, Jindong -Zhang, Icenowy Zheng, and Zou Chang Wei. +Tej Chajed, Asami Doi, eyalz800, , Nelson Elhage, Saar Ettinger, Alice +Ferrazzi, Nathaniel Filardo, Peter Froehlich, Yakir Goaron,Shivam +Handa, Bryan Henry, jaichenhengjie, Jim Huang, Alexander Kapshuk, +Anders Kaseorg, kehao95, Wolfgang Keller, Jonathan Kimmitt, Eddie +Kohler, Austin Liew, Imbar Marinescu, Yandong Mao, Matan Shabtay, +Hitoshi Mitake, Carmi Merimovich, Mark Morrissey, mtasm, Joel Nider, +Greg Price, Ayan Shafqat, Eldar Sehayek, Yongming Shen, Fumiya +Shigemitsu, Takahiro, Cam Tenny, tyfkda, Rafael Ubal, Warren Toomey, +Stephen Tu, Pablo Ventura, Xi Wang, Keiichi Watanabe, Nicolas +Wolovick, wxdao, Grant Wu, Jindong Zhang, Icenowy Zheng, and Zou Chang +Wei. The code in the files that constitute xv6 is -Copyright 2006-2019 Frans Kaashoek, Robert Morris, and Russ Cox. +Copyright 2006-2020 Frans Kaashoek, Robert Morris, and Russ Cox. ERROR REPORTS Please send errors and suggestions to Frans Kaashoek and Robert Morris (kaashoek,rtm@mit.edu). The main purpose of xv6 is as a teaching -operating system for MIT's 6.828, so we are more interested in +operating system for MIT's 6.S081, so we are more interested in simplifications and clarifications than new features. BUILDING AND RUNNING XV6 diff --git a/doc/riscv-privileged-20190608-1.pdf b/doc/riscv-privileged-20190608-1.pdf new file mode 100644 index 0000000..2303a01 Binary files /dev/null and b/doc/riscv-privileged-20190608-1.pdf differ diff --git a/doc/riscv-privileged-v1.10.pdf b/doc/riscv-privileged-v1.10.pdf deleted file mode 100644 index 6942fe7..0000000 Binary files a/doc/riscv-privileged-v1.10.pdf and /dev/null differ diff --git a/doc/riscv-spec-20191213.pdf b/doc/riscv-spec-20191213.pdf new file mode 100644 index 0000000..533c1cb Binary files /dev/null and b/doc/riscv-spec-20191213.pdf differ diff --git a/doc/riscv-spec-v2.2.pdf b/doc/riscv-spec-v2.2.pdf deleted file mode 100644 index e4a4634..0000000 Binary files a/doc/riscv-spec-v2.2.pdf and /dev/null differ diff --git a/kernel/entry.S b/kernel/entry.S index ef5a56a..62fe1f2 100644 --- a/kernel/entry.S +++ b/kernel/entry.S @@ -1,7 +1,7 @@ # qemu -kernel starts at 0x1000. the instructions # there seem to be provided by qemu, as if it # were a ROM. the code at 0x1000 jumps to - # 0x8000000, the _start function here, + # 0x80000000, the _start function here, # in machine mode. each CPU starts here. .section .data .globl stack0 diff --git a/kernel/proc.c b/kernel/proc.c index cf7f260..417e30a 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -183,13 +183,13 @@ proc_freepagetable(pagetable_t pagetable, uint64 sz) // a user program that calls exec("/init") // od -t xC initcode uchar initcode[] = { - 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x02, - 0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x05, 0x02, - 0x9d, 0x48, 0x73, 0x00, 0x00, 0x00, 0x89, 0x48, - 0x73, 0x00, 0x00, 0x00, 0xef, 0xf0, 0xbf, 0xff, - 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x00, 0x00, 0x01, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 + 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02, + 0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x35, 0x02, + 0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00, + 0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00, + 0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x69, 0x6e, 0x69, + 0x74, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; // Set up first user process. diff --git a/kernel/ramdisk.c b/kernel/ramdisk.c index 9901294..eb60ee7 100644 --- a/kernel/ramdisk.c +++ b/kernel/ramdisk.c @@ -1,5 +1,5 @@ // -// ramdisk that uses the disk image loaded by qemu -rdinit fs.img +// ramdisk that uses the disk image loaded by qemu -initrd fs.img // #include "types.h" diff --git a/kernel/virtio_disk.c b/kernel/virtio_disk.c index 3cff024..06e0645 100644 --- a/kernel/virtio_disk.c +++ b/kernel/virtio_disk.c @@ -264,6 +264,7 @@ virtio_disk_intr() disk.used_idx = (disk.used_idx + 1) % NUM; } + *R(VIRTIO_MMIO_INTERRUPT_ACK) = *R(VIRTIO_MMIO_INTERRUPT_STATUS) & 0x3; release(&disk.vdisk_lock); } diff --git a/kernel/vm.c b/kernel/vm.c index d45210a..b48a022 100644 --- a/kernel/vm.c +++ b/kernel/vm.c @@ -65,9 +65,9 @@ kvminithart() // A 64-bit virtual address is split into five fields: // 39..63 -- must be zero. // 30..38 -- 9 bits of level-2 index. -// 21..39 -- 9 bits of level-1 index. +// 21..29 -- 9 bits of level-1 index. // 12..20 -- 9 bits of level-0 index. -// 0..12 -- 12 bits of byte offset within the page. +// 0..11 -- 12 bits of byte offset within the page. pte_t * walk(pagetable_t pagetable, uint64 va, int alloc) {