Sign inSign up

cs1550/xv6

By cs1550

•Updated almost 5 years ago

xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix Version 6 (v6).

Image
0

10K+

cs1550/xv6 repository overview

⁠Install Docker

Download and install docker for your OS. Refer to the following link:

https://docs.docker.com/get-docker/⁠

⁠Basic Commands

To download the xv6 image

docker pull cs1550/xv6:latest

For more information: https://www.docker.com/sites/default/files/d8/2019-09/docker-cheat-sheet.pdf⁠

⁠Usage

  1. Run the container inside a bash

docker run --rm -it -v {absolutepath_to_xv6}:/home/ubuntu/xv6 cs1550/xv6

  1. Or, run xv6, make qemu-nox

docker run --rm -it -v {absolutepath_to_xv6}:/home/ubuntu/xv6 cs1550/xv6 make qemu-nox

Debug

Here is a way to run gdb on Xv6:

  1. In the first terminal, run cs1550/xv6 and start Xv6 with the following command: make qemu-nox-gdb
  2. Open a second terminal, use the command to print the list of running container, docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2aa06ec5b33c        cs1550/xv6          "/bin/bash"         24 seconds ago      Up 23 seconds                           silly_gagarin
  1. Login to the cs1550/xv6 container using the following command in the second terminal. docker exec -it <container_id> /bin/bash
docker exec -it 2aa06ec5b33c /bin/bash
  1. Run cd xv6 and then run gdb on the second terminal using the command: gdb -iex "set auto-load safe-path ."
  2. You are now ready to start debugging your code. Feel free to use your GDB skills. For example, you can place a breakpoint at a given line in the Xv6 source code as follows: (gdb) b proc.c:215
  3. Then continue running the kernel using the command (gdb) c. This will start the debugging session.
  4. To debug a user program (e.g., getcount), you can add the symbol table inside the user program to the GDB session as follows (note the underscore in front of the program name) (gdb) add-symbol-file _getcount 0
  5. You would then be able to add breakpoints in the user program: (gdb) b getcount.c:7
  6. Using the next command in the GDB prompt (n) you can trace inside kernel code and out to the user code.
  7. Here is a nice page about gdb commands⁠.

For sudo access, the default password is ubuntu.

⁠About xv6

xv6 is a re-implementation of Dennis Ritchie's and Ken Thompson's Unix Version 6 (v6). xv6 loosely follows the structure and style of v6, but is implemented for a modern x86-based multiprocessor using ANSI C.

ACKNOWLEDGMENTS

xv6 is inspired by John Lions's Commentary on UNIX 6th Edition (Peer to Peer Communications; ISBN: 1-57398-013-7; 1st edition (June 14, 2000)). See also https://pdos.csail.mit.edu/6.828/⁠, which provides pointers to on-line resources for v6.

xv6 borrows code from the following sources: JOS (asm.h, elf.h, mmu.h, bootasm.S, ide.c, console.c, and others) Plan 9 (entryother.S, mp.h, mp.c, lapic.c) FreeBSD (ioapic.c) NetBSD (console.c)

The following people have made contributions: Russ Cox (context switching, locking), Cliff Frey (MP), Xiao Yu (MP), Nickolai Zeldovich, and Austin Clements.

We are also grateful for the bug reports and patches contributed by Silas Boyd-Wickizer, Anton Burtsev, 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.

The code in the files that constitute xv6 is Copyright 2006-2018 Frans Kaashoek, Robert Morris, and Russ Cox.

More info: https://github.com/mit-pdos/xv6-public⁠

Tag summary

Content type

Image

Digest

Size

397.6 MB

Last updated

almost 5 years ago

docker pull cs1550/xv6