prettyprint
and imshow
. Try running them, neither program takes any parameters.
prettyprint
a correct solution would display multi-colored text. Read prettyprint.c
to see how it is intended to work.
Here, ioctl()
(read “I/O control”) is a classic Unix system call that was added to xv6 for this assignment. The purpose of ioctl, is to support various configuration settings to I/O devices. In the Unix model, I/O devices are represented by device files, notably console
and display
in this assignment.
Hence, your job is to extend the functionality of the existing ioctl system call, to support the expected behavior of the prettyprint
program. Remember the color configured by each call to ioctl, and make sure this color is used to print subsequent characters on the appropriate file descriptor. There is also a separate ioctl to change the "global" color, used when displaying input and cprintf output. Note that other output (say from cprintf, console input, or stderr), should not be affected by any color change to stdout, and vice versa.
Below is the expected output:
struct file
. To output colored text, see the "white on black" comment in cgaputc(). Now to get the configured color out on the screen, it's just a question of providing the color as an argument to cgaputc, and so on.
imshow
, the by-now-familiar cover image should show up on the screen, change color, and disappear (return to text mode). For full points, make sure the original console text remains after the program finishes. (hint: switching video modes clears the corresponding buffer).
While console
supports both reading and writing, display
needs to support only writes. Look at how the console driver is implemented to figure out how to implement a display driver. Note that due to the virtual memory mapping, the virtual address 0xA0000 does not hold the video buffer - instead, you'll find it at KERNBASE+0xA0000.
Create a flie display.c to hold the display driver code, except for "hooks" elsewhere. You'll need to implement any driver initialization, writes to the display, and ioctls to change mode and modify palette colors. To change mode and palette colors, use the helper functions provided in vga.h
hint: the display
device file is created for you upon startup, in init.c. For sys_ioctl and sys_write, try mirroring how the console device is implemented.
hw3
in your turn-in repository. Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |