Merge branch 'riscv' of g.csail.mit.edu:xv6-dev into riscv

This commit is contained in:
Robert Morris 2020-08-13 08:05:13 -04:00
commit e1a2cd59fa
11 changed files with 26 additions and 23 deletions

View file

@ -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 $(OBJDUMP) -t $K/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $K/kernel.sym
$U/initcode: $U/initcode.S $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 $(LD) $(LDFLAGS) -N -e start -Ttext 0 -o $U/initcode.out $U/initcode.o
$(OBJCOPY) -S -O binary $U/initcode.out $U/initcode $(OBJCOPY) -S -O binary $U/initcode.out $U/initcode
$(OBJDUMP) -S $U/initcode.o > $U/initcode.asm $(OBJDUMP) -S $U/initcode.o > $U/initcode.asm

24
README
View file

@ -15,24 +15,26 @@ Clements.
We are also grateful for the bug reports and patches contributed by We are also grateful for the bug reports and patches contributed by
Silas Boyd-Wickizer, Anton Burtsev, Dan Cross, Cody Cutler, Mike CAT, Silas Boyd-Wickizer, Anton Burtsev, Dan Cross, Cody Cutler, Mike CAT,
Tej Chajed, eyalz800, Nelson Elhage, Saar Ettinger, Alice Ferrazzi, Tej Chajed, Asami Doi, eyalz800, , Nelson Elhage, Saar Ettinger, Alice
Nathaniel Filardo, Peter Froehlich, Yakir Goaron,Shivam Handa, Bryan Ferrazzi, Nathaniel Filardo, Peter Froehlich, Yakir Goaron,Shivam
Henry, Jim Huang, Alexander Kapshuk, Anders Kaseorg, kehao95, Wolfgang Handa, Bryan Henry, jaichenhengjie, Jim Huang, Alexander Kapshuk,
Keller, Eddie Kohler, Austin Liew, Imbar Marinescu, Yandong Mao, Matan Anders Kaseorg, kehao95, Wolfgang Keller, Jonathan Kimmitt, Eddie
Shabtay, Hitoshi Mitake, Carmi Merimovich, Mark Morrissey, mtasm, Joel Kohler, Austin Liew, Imbar Marinescu, Yandong Mao, Matan Shabtay,
Nider, Greg Price, Ayan Shafqat, Eldar Sehayek, Yongming Shen, Cam Hitoshi Mitake, Carmi Merimovich, Mark Morrissey, mtasm, Joel Nider,
Tenny, tyfkda, Rafael Ubal, Warren Toomey, Stephen Tu, Pablo Ventura, Greg Price, Ayan Shafqat, Eldar Sehayek, Yongming Shen, Fumiya
Xi Wang, Keiichi Watanabe, Nicolas Wolovick, wxdao, Grant Wu, Jindong Shigemitsu, Takahiro, Cam Tenny, tyfkda, Rafael Ubal, Warren Toomey,
Zhang, Icenowy Zheng, and Zou Chang Wei. 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 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 ERROR REPORTS
Please send errors and suggestions to Frans Kaashoek and Robert Morris Please send errors and suggestions to Frans Kaashoek and Robert Morris
(kaashoek,rtm@mit.edu). The main purpose of xv6 is as a teaching (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. simplifications and clarifications than new features.
BUILDING AND RUNNING XV6 BUILDING AND RUNNING XV6

Binary file not shown.

Binary file not shown.

BIN
doc/riscv-spec-20191213.pdf Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,7 @@
# qemu -kernel starts at 0x1000. the instructions # qemu -kernel starts at 0x1000. the instructions
# there seem to be provided by qemu, as if it # there seem to be provided by qemu, as if it
# were a ROM. the code at 0x1000 jumps to # 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. # in machine mode. each CPU starts here.
.section .data .section .data
.globl stack0 .globl stack0

View file

@ -183,13 +183,13 @@ proc_freepagetable(pagetable_t pagetable, uint64 sz)
// a user program that calls exec("/init") // a user program that calls exec("/init")
// od -t xC initcode // od -t xC initcode
uchar initcode[] = { uchar initcode[] = {
0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x02, 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02,
0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x05, 0x02, 0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x35, 0x02,
0x9d, 0x48, 0x73, 0x00, 0x00, 0x00, 0x89, 0x48, 0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00,
0x73, 0x00, 0x00, 0x00, 0xef, 0xf0, 0xbf, 0xff, 0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00,
0x2f, 0x69, 0x6e, 0x69, 0x74, 0x00, 0x00, 0x01, 0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x69, 0x6e, 0x69,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00
}; };
// Set up first user process. // Set up first user process.

View file

@ -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" #include "types.h"

View file

@ -264,6 +264,7 @@ virtio_disk_intr()
disk.used_idx = (disk.used_idx + 1) % NUM; disk.used_idx = (disk.used_idx + 1) % NUM;
} }
*R(VIRTIO_MMIO_INTERRUPT_ACK) = *R(VIRTIO_MMIO_INTERRUPT_STATUS) & 0x3;
release(&disk.vdisk_lock); release(&disk.vdisk_lock);
} }

View file

@ -65,9 +65,9 @@ kvminithart()
// A 64-bit virtual address is split into five fields: // A 64-bit virtual address is split into five fields:
// 39..63 -- must be zero. // 39..63 -- must be zero.
// 30..38 -- 9 bits of level-2 index. // 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. // 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 * pte_t *
walk(pagetable_t pagetable, uint64 va, int alloc) walk(pagetable_t pagetable, uint64 va, int alloc)
{ {