UNSW   Faculty of Engineering myCSEPRINT VERSIONSITE MAP  
cse | School of Computer Science and Engineering (CRICOS Provider No. 00098G)
    #About CSE     #Undergraduate Study     #Postgraduate Study     #Timetables & Courses     #Research & Publications     #People & Work Units     #Help & Resources     #News & Events     #High School Portal

Last updated 01.08.00

COMP9242 Advanced Operating Systems

COMP9242 Assignments: Milestone 0
Due: Week 3


This is a simple exercise designed to get you started on L4. It contains very detailed instructions, together with the existing source code and the L4 manual you should have no problem doing it.

To do:

  1. Make yourself a copy of ~cs9242/public_html/src/pager/
  2. Build and run the example.
  3. The example contains a print server ttyout_server which is used by the client task to write to the serial port. The client does this by calling the interface functions in ttyout.

    The function printfs only handles strings of length less than 64 bytes (i.e. what can be transferred in a ``short'' (register-only) L4 message). The function printf which can send messages of up to 4kb is not implemented. You are to implement that function (including the corresponding changes to ttyout_server).

Recommended procedure:

  1. Read (and understand) the code in ttyout_server and ttyout.
  2. Design a message descriptor data structure to use for this case.
    Hint: use a ``string'' rather than ``dwords'' to pass the out-of-registers part of the message. If you design this properly, you do not need to copy the long message, but can send it directly from where it is stored (by correctly setting up pointers in the message descriptor).
  3. Implement these changes in ttyout.c. You code should use long IPC only if the actual message is 64 bytes or longer. At this state, things should still run without changes to the other code.
  4. Change submain.c to call printf rather than printfs, but so far still passing only short messages. Your program should still work.
  5. Change some printf call in submain.c to pass a string of more than 64 bytes. The IPC send operation in printf or the receive operation in ttyout_server should fail and return a value of 0xe0 (``Cut message''). (In fact, both operations will return the error code, but if you use an assert to check for successful completion it is undefined which assertion will fail.)
    This is to be expected, as ttyout_server is not yet expecting long messages.
  6. Change the code in ttyout_server to accept long messages. You will have to supply a message descriptor of the same format, and with similar contents, as in printf. Once you have this, the send operation in printf should, once again, work successfully (returning zero). The result word should (on a long message) return a value of 0x100, indicating one string was passed.
    Note: L4 does not tell you how long the received string is. Make sure the message sent by printf includes a terminating null character (i.e. you'll need to send one byte more than the string length).
  7. Modify ttyout_server further so that when receiving a long message, it sends it on to the serial line driver in <=64 byte packages.
    Note: the serial line driver only accepts short messages (see manual).
You only have very limited debugging tools at this stage, essentially your interface to the serial line is it. Hence be careful when modifying this code, it's your lifeline!

You can use kprintf for writing short messages to the serial port when normal printing no longer works, but kprintf can only be called from within the main task (e.g. ttyout_server), but not from a client task (e.g. printf or submain). The latter can continue using printsf for debugging, as long as the code in ttyout_server continues to work for short messages.


Submission details:

Due: Week 3
Name (for give): m0
Deliverables:ttyout.c, ttyout_server.c

Demonstration and submission as specified.


COMP9242, School of Computer Science and Engineering, University of New South Wales

This page is maintained by gernot@cse.unsw.edu.au. Last modified: Tuesday, 01-Aug-2000 21:53:33 EST

Top Of Page

 ###
Site maintained by webmistress@cse.unsw.edu.au
Please read the UNSW Copyright & Disclaimer Statement

 Last modified: Tuesday, 01-Aug-2000 21:53:33 EST