Skip to content
Permalink
efd94ef55a
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
57 lines (43 sloc) 2.74 KB
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.
----
THIS VERSION OF xv6 IS MODIFIED FOR A CLASS BY ELLIOTTCABLE; ALL COPYRIGHTS ARE RETAINED BY THEIR
ORIGINAL OWNERS.
### Running
This xv6 is developed alongside a `Vagrantfile` for [Vagrant][], allowing you to construct and
configure an environment to compile, emulate, and debug xv6 with a single command.
Having installed Vagrant on your system according to the instructions for your platform, the
following will clone my xv6 work, download and configure an Ubuntu virtual-machine to act as
emulation host, and give you a command-line on said emulation-host:
git clone https://github.com/ELLIOTTCABLE/xv6.git
curl -O https://raw.githubusercontent.com/ELLIOTTCABLE/Homework/master/CS450/Vagrantfile
vagrant up # (This may take a while!)
vagrant ssh
Once inside the host, the xv6 sources will be at `/vagrant/xv6`; from there, you can follow the
normal xv6 instructions. For instance, to run with a command-line console,
cd /vagrant/xv6
make && make qemu-nox
[Vagrant]: <https://vagrantup.com>
### Modification documentation
Currently, this fork of xv6 includes two trivial new system calls: `traps()` (syscall 22) and
`ticks()` (syscall 23).
#### `traps()`
When invoked from a userland program, this will cause the kernel to begin a count of every trap-
interrupt that is handled by the O.S. while your process is running. The first invocation thereof
will return `0`, indicating that counting has started for any following traps-to-O.S. Subsequent
invocations will return the count of traps thus far.
At the termination of any program for which counting is enabled, a line will be printed to the
console, detailing the PID of the process, and the final number of traps counted.
#### `ticks()`
Similarly to the above, this will enable printing of the existence-duration of the calling program,
in terms of O.S. timer-interrupt ticks, at program's exit. It does not, however, expose real-time
tick information to the caller; and thus, it has no return value, and subsequent invocations have no
further effect.
### Tests
Unfortunately, automated testing of a kernel being emulated by `qemu` turned out to be something of
a challenge; so the (admittedly trivial) tests for this new functionality are simply provided as a
set of simplistic programs demonstrating invocation of these new syscalls, and an associated set of
tracefiles, showing examples of the sort of output each of those programs will display (although the
precise counts therein will vary on each invocation, for obvious reasons.)
See `zz_*.c`, and for each, the corresponding `zz_*.trace`.