/xv6-public

xv6 for education purpose

Primary LanguageC

Info:

Office Hours: Thur: 1:00 - 3:00 pm.

Room: WCH 110.

xv6 tutorial

resources

  • [class website] CW
  • [lab website] LW
  • [xv6 BOOK] XB Important! Please Read!!!
  • [xv6 source code reference] XS
  • [Official xv6] OX
  • [GDB commands] GC
  • [Lab 0: PC booting] LPC
    1. [Intro x86, stack] IS -- nice video to introduce x86 architecture, assembly, and stack
    2. [quick learn x86 assembly instructions] QLAI
    3. Appendix A -- PC hardware
    4. Appendix B -- The boot loader
  • Lab 0.5 syscalls & scheduler (Don't need to turn in anything)
    1. implement a syscall int count(void) that counts number of syscalls.

      a. This syscall will return number of syscalls you called, from the begining of process started until to the calling 'count()'.

      b. First, you need to create a syscall. (related files: defs.h, syscall.h, syscall.c, sysfile.c sysproc.c, user.h, usys.S). If you don't know how to create one, find a syscall such as open(), and see how it created.

      c. Then, you need to implement it. You will change some code in proc.h and proc.c. You can either implement it in sysfile.c or sysproc.c.

      d. Finally, you can create a user file and test your syscall count you just created. If you want to create your own user file, then you should add it in Makefile. You are also able to change the code in usertests.c and add 'count()' some place in main().

    2. explain what policy of scheduler uses in xv6.

    3. Read the book chapter 1.


login sledge

open your terminal, type:

$ ssh your_cs_account@sledge.cs.ucr.edu 
$ password:*

Example

$ ssh sjin010@sledge.cs.ucr.edu

Tutorials

  • [set up git version control] SUG
  • [run xv6 & using gdb] XV6T 9 min

In the tutorial, instead of typing gdb, you should type:

$ gdb q -iex "set auto-load safe-path /home/csgrads/sjin010/xv6-public/"

change the directory

/home/csgrads/sjin010/xv6-public/

to your working directory. Find your working path, type

$pwd

in the terminal.

nice discussion of xv6

  • [xv6 syscalls] SYSC --- more detail tutorial. (eg: how to create a user file, how syscall works.).
  • [xv6 fork(), wait(), exec()] FWE --- play around with syscalls.
  • [xv6 scheduler] XS --- nice explanation of scheduler part.

Tips

How to exit xv6.

open another terminal, find the process PID of running QEMU

$ ps aux | less | grep uname

uname is your cs account. eg: sjin010

Then kill that process

$ kill -9 PID

Best way to get xv6 source code

$ git clone https://github.com/guilleiguaran/xv6.git