[an error occurred while processing this directive]
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:
- Make yourself a copy of ~cs9242/public_html/src/pager/
- Build and run the example.
- 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:
- Read (and understand) the code in ttyout_server and
ttyout.
- 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).
- 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.
- Change submain.c to call printf rather than
printfs, but so far still passing only short messages. Your
program should still work.
- 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.
- 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).
- 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 AEST
[an error occurred while processing this directive]
Last modified:
Tuesday, 01-Aug-2000 21:53:33 AEST