Assignment #4 Solution




User Space stuff


Sometimes it is easier and/or better to not have more code inside the kernel space – this may be for easier debugging, access to other libraries, or other specific reasons. Using a part of the system call interface we can cheat a bit and get access to the kernel’s memory space at the user level.


Those Blinking Users


This can be done in any number of user level programming languages, but we recommend you stick with C so that we can better help you. Your user program needs to:


  • Find one of the ethernet devices in your Virtual Machine (perhaps e1000?) and map the appropriate BAR


  • Save the current LEDCTL value and print it for the user to read


  • Turn the LED2 and LED0 LEDs on for 2 seconds


  • Turn all LEDs off for 2 seconds


  • Loop 5 times and turn each LED (LED3, LED2, LED1, LED0) on for 1 second


  • Restore LEDCTL to initial value


  • Read and print the contents of the Good Packets Received statistics register


  • Clean up and exit


Run this program a couple of times while e1000 is loaded in the Virtual Machine to see if you can catch any packets being sent and counted by reading the Good Packets Received register. Also run this with ledmon from Assignments 3 and 4 to verify the LED’s are properly blinking. Remember that you can run this user program while the original driver is still loaded, as long as you don’t do something that conflicts and confuses the driver. You can even do this on some other hardware if there’s an LED to blink.


The Blink is over


Turn in these materials before or at the start of class on ​Wednesday​,​15-May-2019:


  1. Source code to your user program, Makefile, and any scripts used.


  1. Note that you won’t need to unload the existing kernel network driver to run this program. Give a short explain what this might imply.


  1. A typescript of the user program running at least three times (partly to try to catch the packet counter changing)


  1. A note from someone (anyone, but a TA is a good choice) saying they actually saw it work.

error: Content is protected !!