
October 13 1995, Draft 1
349
Chapter 7 Software Debugging
The function returns 0 if the message was accepted for sending and –1 if the
message system is currently too busy. Variable
msg_sbuf_p
is maintained by MSG
to point to the message buffer currently being sent. When this variable becomes 0, the
message system is ready to send another message. The message buffer pointer passed
to
msg_send()
is copied into
msg_sbuf_p
the contents of the buffer are not copied.
Thus the user must be careful not to modify the buffer data until the message has been
completely sent.
Messages are received by asking the message system to poll the message driver
hardware until a message is available. Function
msg_wait_for()
is provided for this
task. Alternatively, the message system can interrupt the operating system or the De-
bugCore when a message is received from the TIP host processor. Received mes-
sages are normally located at address
msg_rbuf
. There is no danger of the receive
buffer being over written by a new in–coming message, as the MonTIP always ex-
pects to receive a message before it will reply with a new message to the target.
7.3.7 MSG Operation
The MSG module may require the support of communications port specific
driver modules, most notably the SER module. This module contains the code neces-
sary to talk to serial communication UARTs which support target and MonTIP con-
nection. The MSG contains a number of shared memory communication drivers for
IBM PC–AT plug–in cards, such as, the PCEB, EB29K, YARC and others.
Messages all have the same format, a 32–bit message number then a 32–bit
length field, followed by any message related data. When the MSG determines that a
new message has been received, and its message number is greater than 64, the oper-
ating system is interrupted (if interrupts are enabled), and execution continues at the
address given in the vector table for entry number V_OS_MSG (76). In OS–boot this
is address
os_V_msg
. This means that the operating system does not have to poll the
message interface for service request completion. Polling is required when the mes-
sage system can continue to operate with interrupts turned off. The message system
can be used to support HIF services (see the later OS–boot section).
Received messages with identification numbers less than 64 are intended for the
DebugCore. The MSG causes the DebugCore to be interrupted via vector table entry
V_DBG_MSG (75). This causes execution to continue at address
dbg_V_msg
.
When execution begins at this address, the processor state appears as if a hardware
interrupt has just occurred while executing User mode code or an operating system
service. The
virtual interrupt
mechanism is used to support this technique and is de-
scribed below.
7.3.8 MSG Virtual Interrupt Mechanism
Consider what happens when a UART receives a character and an interrupt is
generated: