Question
We are going to work on a small OS kernel called xv6, which is an instructional OS consisting of a stripped-down version of Unix. To
We are going to work on a small OS kernel called xv6, which is an instructional OS consisting of a stripped-down version of Unix. To get ready to work within xv6, please start reading the xv6 book as well as the other xv6 resources. You'll use two sets of tools in this class: an x86 emulator, QEMU, for running your kernel; and a compiler toolchain, including assembler, linker, C compiler, and debugger, for compiling and testing your kernel.
Your task is to add a system call to xv6. It will help to start by reading syscall.c (the kernel side of the system call table), user.h (the user-level header for the system calls), and usys.S (the user-level system call definitions). You may add additional files to xv6 to implement this call.
Exercise 1. Create a system call int sys_wolfie(void *buf, uint size), which copies an ASCII art image to a user-supplied buffer, provided that the buffer is large enough. You are welcome to use an ASCII art generator, or draw your own by hand. If the buffer is too small, or not valid, return a negative value. If the call succeeds, return the number of bytes copied.
You may find it helpful to review how other system calls are implemented and compiled into the kernel, such as read.
Exercise 2. You will also write a user-level application, called wolfietest.c that gets the image from the kernel, and prints it to the console. You will have to modify the Makefile to add your user application in the compile task.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started