CA1253970A - Virtual single machine with message-like hardware interrupts and processor exceptions - Google Patents

Virtual single machine with message-like hardware interrupts and processor exceptions

Info

Publication number
CA1253970A
CA1253970A CA000507772A CA507772A CA1253970A CA 1253970 A CA1253970 A CA 1253970A CA 000507772 A CA000507772 A CA 000507772A CA 507772 A CA507772 A CA 507772A CA 1253970 A CA1253970 A CA 1253970A
Authority
CA
Canada
Prior art keywords
mov
msg
interrupt
message
processes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired
Application number
CA000507772A
Other languages
French (fr)
Inventor
Andrew I. Kun
Frank C. Kolnick
Bruce M. Mansfield
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Computer X Inc
Original Assignee
Computer X Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Computer X Inc filed Critical Computer X Inc
Application granted granted Critical
Publication of CA1253970A publication Critical patent/CA1253970A/en
Expired legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • G06F15/173Interprocessor communication using an interconnection network, e.g. matrix, shuffle, pyramid, star, snowflake
    • G06F15/17337Direct connection machines, e.g. completely connected computers, point to point communication networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F2003/0697Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers device management, e.g. handlers, drivers, I/O schedulers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems

Abstract

VIRTUAL SINGLE MACHINE WITH MESSAGE-LIKE
HARDWARE INTERRUPTS AND PROCESSOR EXCEPTIONS
ABSTRACT
A multi-processor, multi-tasking virtual machine comprises processes, messages, and contexts. Processes communicate only through messages. Contexts are groups of related processes.
The virtual machine makes all hardware devices appear to be processes, in that the occurrence of an event on a device causes a message to be generated and sent to another process for handling. The receiving process performs all operations required to handle the event.
Thus a variety of hardware devices can be connected and disconnected from the system without interrupting its operation and without necessitating extensive software revisions.

Description

~5397~

VIRTUAL SINGLE MACHINE WITH MESSAGE-LIKE
HARDWARE INTERRUPTS AND PROCESSOR EXCEPTIONS

TECENIC~L FIELD

This invention relates generally to digital data processing, and, in particular, to an operating system which handles external hardware interrupts and processor exceptions as if they were messages received from respective processes.

BACKGROUND OF THE INVENTION

The present invention is implemented in a distributed data processing system - that is, two or more data processing systems which are capable of functioning independently 6ut which are so coupled as to send and receive messages to and from one another.
A Local Area Network CLAN2 is an example of a distributed data processing system. A typical LAN comprises a number of autonomous data processing l'cells", each comprising at least a processor and memory.
Each cell is capable of conducting data processing operations independently. In additlon, each cell is coupled ~by appropriate means such as a t~*sted ~re pair, coaxial cable, fiber optical cable, etc.
~ to a network of other cells whic~ may ~e, for example, a loop, star, tree, etc., depending upon the design constderations.
As mentioned a~o~e, the present in~ention finds utility in such a distri~utet data processing 6ystem, since there is a significant need in such a system for a relatively great degree of hardware independence. Typical distr~buted data processing sytems comprise a 3Q large ~ariety of diverse processors, ne~ories, operator interfaces, printers, and otber peripherals, Tbus there is an urgent need to pro~ide an operating system for suc~ a distributed data processing system, which operating system will easily accommodate different types of hardware devices without the necessity of writing and/or rewriting large portions of such operating system each time a device is addet or removed from the system, ~;' . ~.
" q~
;~ `''~
. ~
.

~2539t70 A ~process~, as used within the present invention, is defined as a self-contained package of data and executable procedures which operate on that data, comparable to a "task" in other known systems.
Within the present invention a process can be thought of as comparable to a subroutine in terms of size, complexity, and the way it is used.
The difference between processes and subroutines is that processes can be created and destroyed dynamically and can execute concurrently with their creator and other "subroutines".
Within a process, as used in the present invention, the data is totally private and cannot be accessed from the outside, i.e., by other processes. Processes can therefore by used to implement "objects", "modules", or other higher-level data abstractions. Each process executes sequentially. Concurrency is achieved through multiple processes, possibly executing on multiple processors.
Every process in the distributed data processing system of the present invention has a unique identifier (PID) by which it can be referenced. The PID is assigned by the system when the process is created, and it is used by the system to physically locate the process.
Every process also has a non-unique, symbolic "name", which is a variable-length string of characters. In general, the name of a process is known system-wide. To restrict the scope of names, the present invention utilizes the concept of a "context".
A "context" is simply a collection of related processes whose names are not known outside of the context. Contexts partition the name space into smaller, more manageable subsystems. They also "hide"
names, ensuring that processes contained in them do not unintentionally conflict with those in other contexts.
A process in one context cannot explicitly communicate with, and does not know about, processes inside other contexts. All interaction across context boundaries must be through a "context process", thus providing a degree of security. The context process often acts as a switchboard for incoming messages, rerouting them to the appropriate sub-processes in its context.
A context process behaves like any other process and additionally has the property that any processes which it creates are known only to itself and to each other. Creation of the process constitutes ~25~397~:) definition of a new context with the same name as the process.
Any process can create context processes. Each new context thus defined is completely contained inside the context in which it was created and therefore is shielded from outside reference. This "nesting" allows the name space to be structured hierarchically to any desired depth.
Conceptually, the highest level in the hierarchy is the system itself, which encompasses all contexts. Nesting is used in top-down design to break a system into components or "layers", where each layer is more detailed than the preceding one. This is analogous to breaking a task down into subroutines, and in fact many applications which are single tasks on known systems may translate to multiple processes in nested contexts.
A "message" is a buffer containing data which tells a process what to do and/or supplies it with information it needs to carry out its operation. Each message buffer can have a different length (up to 64 kilobytes). By convention, the first field in the message buffer defines the type of message (e.g., "read", "print", "status", "event", etc.).
Messages are queued from one process to another by name or PID.
Queuing avoids potential synchronization problems and is used instead of semaphores, monitors, etc. The sender of a message is free to continue after the message is sent. When the receiver attempts to get a message, it will be suspended until one arrives if none are already waiting in its queue. Optionally, the sender can specify that it wants to wait for a reply and is suspended until that specific message arrives. Messages from any other source are not dequeued until after that happens.
Within the present invention, messages are the only way for two processes to exchange data. There is no concept of a "global variablen. Shared memory areas are not allowed, other than through processes which essentially "manage" each area by means of messages.
Messages are also the only form of dynamic memory that the system handles. A request to allocate memory therefore returns a block of memory which can be used locally by the process but can also be transmitted to another process.

~25;~970 Messages provide the mechanism by which hardware transparency is achieved. A process located anywhere in the system may send a message to any other process anywhere else in the system (even on another processor) if it knows the process name. This means that processes can be dynamically distributed across the system at any time to gain optimal throughput without changing the processes which reference them.
Resolution of destinations is done by searching the process name space.
The context nesting level determines the "scope of reference"
when sending messages between processes by name. From a given process, a message may be sent to all processes at its own level (i.e., in the same context) and (optionally) to any arbitrary higher level. The contexts are searched from the current context upward until a match is found. All processes with the given name at that level are then sent a copy of the message. A process may also send a message to itself or to its parent (the context process) without knowing either name explicitly, permitting multiple instances of a process to exist in different contexts, with different names.
Sending messages by PID obviates the need for a name search and ignores context boundaries. This is the most efficient method of communicating.
There is a significant need to be able to provide within a data processing operating system the ability to easily handle a wide variety of external device interrupts, processor exceptions, etc. While it is known to provide the capability of servicing hardware interrupts in a data processing system, it is presently not known in such a system to regard all external devices as processes, and to regard the interrupts, exceptions, and traps which they generate as if they were messages originating from their respective processes.

BRIEF SUMMARY OF INVENTION

Accordingly, it is an ob~ect of the present invention to provide a data processing system having an improved operating system.
It is also an ob~ect of the present invention to provide an 35 improved data processing system having an operating system which easily ~: .
~ -~25397~

handles hardware interrupts and exceptions originating from a variety of different hardware devices.
It is another object of the present invention to provide an improved data processing system having an operating system which regards hardware interrupts and exceptions as messages originating from processes.
These and other objects are achieved in accordance with a preferred embodiment of the invention by providing a method of handling interrupts in a data processing system comprising a processor, a memory store, and at least one process resident in the memory store, the-method comprising the steps of generating a interrupt message upon the occurrence of an event within the system; transmitting the message to the process; and using the process to control all operations required to be performed to service the interrupt message.
BRIEF DESCRIPTION OF THE DRA~IINGS

The invention is pointed out with particularity in the appended claims. However, other features of the invention will become more apparent and the invention will be best understood by referring to the following detailed description in conjunction with the accompanying ; drawings in which:
FIG. 1 shows a representational illustration of a single network, distributed data processing system incorporating the improved data management system of the present invention.
FIG. 2 shows a block diagram illustrating a multiple-network, distributed data processing system incorporating the improved data management system of the present invention.
FIG. 3 shows an architectural model of a data processing system incorporating the present invention.
FIG. 4 shows the relationship between software contexts and processes as they relate to the present invention.
FIG. 5 shows the relationship between external events and processes.
FIG. 6 shows a flow diagram illustrating how an interrupt event is handled by the data processing system of the present invention.

.~
~' :~`

1253g70 OVERVIEW OF COMPUTER SYSTEM

With reference to FIG. 1, a distributed computer configuration is shown comprising multiple cells 2-7 (nodes) loosely coupled by a local area network ~LAN) l. The number of cells which may be connected to the network is arbitrary and depends upon the user application. Each cell comprises at least a processor and memory, as will be discussed in greater detail with reference to FIG. 2 below. In addition, each cell may also include other units, such as a printer 8, operator display module (ODM) 9, mass memory module 13, and other I/O device 10.
With reference now to FIG. 2, a multiple-network distributed computer configuration is shown. A first local area network LAN
comprises several cells 2,4,and 7. LAN 1 is coupled to a second local area network LAN 2 by means of an Intelligent Communications Module (ICM) 50. The Intelligent Communications Nodule provides a link between the LAN and other networks and/or remote processors (such as programmable controllers).
LAN 2 may comprise several cells (not shown) and may operate under the same LAN protocol as that of the present invention, or it may operate under any of several commercially available protocols, such as Ethernet; MAP, the Manufacturing Automation Protocol of General Motors Corp.; Systems Network Architecture (SNA) of International Business Machines, Inc.; SECS-II; etc. Each ICM 50 is programmable for carrying out one of the above-mentioned specific protocols. In addition, the basic processing module of the cell itself can be used as an intelligent peripheral controller (IPC) for specialized devices.
LAN 1 is additionally coupled to a third local area network LAN 3 via ICM 52. A process controller 55 is also coupled to LAN 1 via ICN
54.
; 30 A representative cell N (7, FIG. 2) comprises a processor 24 which, in a preferred embodiment, is a Motorola 68010 processor~ Each cell further includes a read only memory (ROM) 28 and a random access ~ memory (RAM) 26. In addition, each cell includes a Network Interface ,~ Nodule (NIM) 21, which connects the cell to the LAN, and a Bus Interface 29, which couples the cell to additional devices within a cell. While a minimal cell is capable of supporting two peripheral . .

~253~q~

devices, such as an Operator Display Module (ODM) 41 and an I/O Module 44, additional devices (including additional processors, such as processor 27) can be provided within a cell . Other additional devices may comprise, for example, a printer 42, and a mass-storage module 43 which supports a hard disk and a back-up device (floppy disk or streaming tape drive).
The Operator Display Module 41 provides a keyboard and screen to enable an operator to input information and receive visual information.
While a single cell may comprise all of the above units, in the typical user application individual cells will normally be dedicated to specialized functions. For example, one or more mass storage cells may be set up to function as data base servers. There may also be several operator consoles and at least one cell for generating hard-copy printed output. Either these same cells, or separate dedicated cells, may execute particular application programs.
The system is particularly designed to provide an integrated solution for factory automation, data acquisition, and other real-time applications. As such, it includes a full complement of services, such as a graphical output, windows, menus, icons, dynamic displays, electronic mail, event recording, and file management. Software development features include compilers, a window-oriented editor, a debugger, and performance-monitoring tools.

Local Area Network The local area network, as depicted in either FIG.l or FIG. 2, ties the entire system together and makes possible the distributed virtual machine model described below. The LAN provides high throughput, guarantaed response, reliability, and low entry cost. The LAN is also autonomous, in the sense that all system and applications software is unaware of its existence. For example, any Network Interface Nodule (e~g. NIN 21, FIG. 2) could be replaced without rewriting any software other than that which directly drives it.
The LAN interconnection medium may be twisted-pair or coaxial cable. Two channels (logically, two distinct networks) may be provided for reliability and for increased throughput.

.

397~;) The LAN architecture is a logical ring, in which an electronic "token" is constantly passed from cell to cell at high speed. The current holder of the token may use it to send a "frame" of data or may pass it on to the next cell in the ring. The NIM only needs to know the logical address and status of its immediately succeeding neighbor.
The NIM's responsibility is limited to detecting the failure of that neighbor or the inclusion of a new neighbor. In general, adjustment to failed or newly added cells is automatic.
The network interface maps directly into the processor's memory.
Data exchange occurs through a dual-ported buffer pool which contains a linked list of pending "frames". Logical messages, which vary in length, are broken into fixed-size frames for transmission and are re-assembled by the receiving NIM. Frames are sequence-numbered for this purpose. If a frame is not acknowledged within a short period of time, it is retransmitted a number of times before being treated as a failure.
As described above with reference to FIG. 2, the LAN may be connected to other LAN's operating under the same LAN protocol via so-called "bridgeways", or it may be connected to other types of LAN's via "gateways".

Software Model The computer operating system of the present invention operates ; 25 upon processes, messages, and contexts, as such terms are defined herein. Thus this operating system offers the programmer a hardware abstraction, rather than a data or control abstraction.
Processes are referenced without regard to their physical location via a small set of message-passing primitives. As mentioned earlier, every process has both a unique syseem-generated identif~er and a not necessarily unique name assigned by the programmer. The ~ identifier provides quick direct access, while the name has a limited `~ scope and provides symbolic, indirect access.
With reference to FIG. 3, an architectural model of the present invention is shown. The bottom, or hardware, layer 63 comprises a number of processors 71-76, as described above. The processors 71-76 ~::

, ,.~ .....

~25~7~

may exist physically within one or more cells. The top, or software, layer 60 illustrates a number of processes P1-PlO which send messages ml-m6 to each other. The middle layer 61, labelled "virtual machine", isolates the hardware from the software, and it allows programs to be written as if they were going to be exec~ted on a single processor.
Conversely, programs can be distributed across multiple processors without having been explicitly designed for that purpose.
An important purpose of the virtual machine concept herein-disclosed is to provide the applications programmer with a simple, consistent model in which to design his system. This model, as mentioned above, is reduced to several elemental concepts: processes, messages, and contexts. As a consequence of this elemental model, hardware peculiarities are made transparent to the user, and changes in hardware configurations have no direct effect on the software.
The Virtual Machine As discussed earlier, a "process" is a self-contained package of data and executable procedures which operate on that data. The data is totally private and cannot be accessed by other processes, There is no concept of shared memory within the present invention. Execution of a process is strictly sequential. Multiple processes execute concurrently and must be scheduled by the operating system. The processes can be re-entrant, in which case only one copy of the code is loaded even if multiple instances are active.
Every process has a unique "process identifier number" (PID) by which it can be referenced. The PID is assigned by the system when the process is created and remains in effect until the process terminates.
The PID assignment contains a randomizing factor which guarantees that the PID will not be re-used in the near future. The contents of the PID are irrelevant to the programmer but are used by the virtual machine to physically locate the process. A PID may be thought of as a "pointer" to a process.
Every process also has a "name" which is a variable-length string of characters assigned by the programmer. A name need not be unique, :

' :

~253970 and this ambiguity may be used to add new services transparently and to aid in fault-tolerance.
FIG. 4 illustrates that the system-wide name space is partitioned into distinct subsets by means of "contexts" identified by reference numerals 90-92. A context is simply a collection of related processes whose names are not known outside of the context. Context 90, for example, contains processes A, a, a, _, c, _, and e. Context 91 contains processes B, a, _, c, and f. And context 92 contains processes C, a, c, , and x.
One particular process in each context, called the "context process", is known both within the context and within the immediately enclosing one (referred to as its "parent context~). In the example illustrated in FIG. 4, processes A-C are context processes for contexts 90-92, respectively. The parent context of context 91 is context 90, lS and the parent context of context 92 is context 91. Conceptually, the context process is located on the boundary of the context and acts as a gate into it.
Processes inside context 92 can reference any processes inside contexts 90 and 91 by name. However, processes in context 91 can only access processes in context 92 by going through the context process C.
Processes in context 90 can only access processes in context 92 by going through context processes B and C.
The function of the context process is to filter incoming messages and either reject them or reroute them to other processes in its context. Contexts may be nested, allowing a hierarchy of abstractions to be constructed. A context must reside completely on one cell. The entire system is treated as an all-encompassing context which is always present and which is the highest level in the hierarchy. In essence, contexts define localiæed protection domains and greatly reduce the chances of unintentional naming conflicts.
If appropriate, a process inside one context can be "connected"
to one inside another context by exchanging PID's, oncs contact has ,:
been established through one or the other of the context processes.
Most process servers within the present invention function that way.
Initial access is by name. Once the desired function (such as a window .~

, ,, ..

~' ~

S397~

or file) is "opened", the user process and the service communicate directly via PID's.
A "~essage" is a variable-length buffer (limited only by the processor's physical memory size) which carries information between processes. A header, inaccessible to the programmer, contains the destination name and the sender's PID. By convention, the first field in a ~essage is a null-terminated string which defines the type of message (e g., "read", "status", etc.) Messages are queued to the receiving process when they are sent. Queuing ensures serial access and is used in preference to semaphores, monitors, etc.
As mentioned above, messages provide the mechanism by which hardware transparency is achieved. A process located anywhere in the virtual machine can send a message to any other process if it knows its name. Transparency applies with some restrictions across bridgeways (i.e., the interfaces between LAN's operating under identical network protocols) and, in general, not at all across gateways (i.e., the interfaces between LAN's operating under different network protocols) due to performance degradation. However, they could so operate, depending upon the required level of performance.
External Interrupts as Messages Now with specific reference to FIG. 5, several features relating to the present invention will be discussed. FIG. 5 illustrates the relationship of external events to processes. As mentioned above, the virtual machine makes devices look like processes.
In FIG. 5, the exterior box 60 represents a portion of the entire data processing system, containing the virtual machine 61 and two typical processes 104 and 106. The arrows represent queued message transmissions, and they are overlaid with boxes 103, 105, and 107 representing typical messages.
For example, assume a user's process 106 issues a READ request for a particular device via its "external event service process"
(EESP~, functioning as the device manager (i.e., EESP 104). The external device generates a series of events which are noticed by the virtual machine which consequently queues "event" messages to the EE5P

.

104. Eventually, an "end of line" event is generated. ~These messages are queued along with other messages, from user processes, to the EESP
104.) As a result, a message containing a data record 1~5 is queued to the user's process 106.
Thus, the EESP performs all haFdware-specific functions related to the event, such as setting control registers, moving data 105 to a user process 106, transmitting "Read" messages from the user process 106, etc., and then "releasing'l the interrupt.
When an interrupt occurs ~n an external device lal, the virtual ~achine kernel 61 also queues an Interrupt message 103 to EESP lQ4.
For efficienc~ the message is pre-allocated once and circulates between the EESP 104 and the kernel. T~e message contains ~ust enough information to indicate the occurrence of the event.
To ~ecome an EES~, a process issues a "connect" primitive specifying the appropriate device register(s~. It must execute a "disconnect" before it exits, Device-independence is achieved by maklng the message protocol ~et~een EESP~s and applications processes the same ~herever possible. In this manner a wide variety of different types of hardware devices can ae accommodated without having to make
2~ extensive soft~are se~isions.
, Inter-Process Communication ,~
- All inter-process communication is via messages. Consequently, most of the vistual machine primitives are concerned with processing messages. The virtual machine kernel primitives are the following:

ALLoc _ requests allocation of a (message) buffer of a given size, FR~ - requests deallocation of a given message buffer.

PUT ~ send a message to a given destination (by na~e or PID).

35 GET ~ wait for and dequeue the next incoming message, optionally from a specific process C~Y PID).
.~
.
~: '```

~25397a FORWARD - pass a received message through to another process.

CALL - send a message, then wait for and dequeue the reply.

REPLY - send a message to the originator of a given message.

ANY_MSC - returns "true" if the receive queue is not empty, else returns "false"; optionally, checks if any messages from a specific PID are queued.
CONNECT - indicates willingness to accept a particular class of external events.

DISCONNECT - indicates stop accepting external events.
RELEASE - used by EESP's only to indicate completion of processing of a particular externsl event message.

To further describe the function of the kernel primitives, ALLOC
handles all memory allocations. It returns a pointer to a buffer which can be used for local storage within the process or which can be sent to another process (via PUT, etc.). ALLOC never "fails", but rather waits until enough memory is freed to satisfy the request.
The PUT primitive queues a message to another process. The sending process resumes execution as soon as the message is queued.
FORWARD is used to quickly reroute a message bue maintain information about the original sender (whereas PUT always makes the sending process the originator of the message).
REPLY sends a message to the originator of a previously received message, rather than by name or PID.
CALL essentially implements remote subroutine invocations, causing the caller to suspend until the receiver executes a REPLY.
Subsequently, the replied message is dequeued out of sequence, immediately upon arrival, and the caller resumes execution.
The emphasis is on concurrency, so that as many processes as possible are executed in parallel. Hence neither PUT nor FORUARD waits :

:`

i253970 for the message to be delivered. Conversely, GET suspends a process until a message arrives and dequeues it in one operation. The A~_MSG
primitive is provided so that a process may determine whether there is anything of interest in the queue before committing itself to a GET.
The CONNECT, DISCONNECT, and RELEASE primitives are specifically used to handle external interrupts.
When a message is sent by name, the destination process must be found in the name space. The search path is determined by the nesting of the contexts in which the sending process resides. From a given process, a message can be sent to all processes in its own context or (optionally) to those in any higher context. Refer to FIG. 6. The contexts are searched from the current one upward until a match is found or until the system context is reached. All processes with the same name in that context are then queued a copy of the message.
A process may also send a message to itself or to its context process without knowing either name explicitly.
The concept of a "logical ring" (analogous to a LAN) allows a message to be sent to the NEXT process in the system with a given name.
The message goes to exactly one process in the sender's context, if such a process exists. Otherwise the parent context is searched.
The ~irtual machine guarantees that each NEXT transmission will reach .a different process and that eventually a transmission will be sent to the logically '`first" process (the one that sent the original message) in the ring, completing the loop. In other words, all processes with the same name at the same level can communicate with each other without knowing how many there are or where they are located. The logical ring is essential for distributing services such as a data base. The ordering of processes in the ring is not predictable.
Sending messages directly by PID obviates the need for a name search and ignores context boundaries. This is known as the DIRECT
mode of transmission and is the most efficient.
If a process sends a message in the LOCAL transmission mode, it sends it only to a process having the given name in the sender's o~
context.
;

~Z~39~0 In summary, including the DIRECT transmission mode, there are five transmission modes which can be used with the PUT, FORWARD, and CALL primitives:

5 ALL - to all processes with the given name in the first context which contains that name, starting with the sender's context and searching upwards through all parent contexts.

10 LOCAL - to all processes with the given name in the sender's context only.

NEXT - to the next process with the given name in the same context as the sender, if any; otherwise it searches upwards through all parent contexts until the name is found.

LEVEL - sends to "self" (the sending process) or to "context"
(the context process corresponding to the sender's context); "self" cannot be used with CALL primitive.

DIRECT - sent by PID.

Messages are usually transmitted by queueing a pointer to the buffer containing the message. A message is only copied when there are multiple destinations or when the destination is on another cell.

Operat;iDg System ~; 30 The operating system of the present invention consists of a kernel, which implements the primitives described above, plus a set of processes which provide process creation and termination, time management (set time, set alarm, etc.) and which perform cell start-up and configuration~ Drivers for devices are also implemented as processes (EESP's3, as described above. This allows both system ~`~ services and device drivers to be added or replaced easily. The , ~
....... .
:; .
;

~L2S3~7~

- l6 operating system also supports swapping and paging, although both are invisible to applications software.
Unlike known distributed computer systems, that of the present invention does not use a distinct "name server" process to resolve names. Name searching is confined to the kernel, which has the advantage of being much faster.
A minimal bootstrap program resides permanently (in ROM) on every cell, e.g. ROM 28 in cell N of FIG. 2. The bootstrap program executes automatically when a cell is powered up and begins by performing basic on-board diagnostics. It then attempts to find and start an initial system code module which comprises the entire kernel, and EESP's for the clock, disk (if required), and NIM (if required). The module is sought on the first disk drive on the cell, if any. If there isn't a disk, and the cell is on the LAN, a message will be sent out requesting the module. Failing that, the required software must be resident in ROM. System services for the clock and for process creation, an initialization program, and a minimal file system, are also built into the module. The initialization program sets up all of the kernel's internal tables and then calls predefined entry points in each of the preloaded services (file management, etc.). The net result is that EESP's for the attached devlces are scheduled to run, and the cell is available.
In general, there exists a template file describing the initial software and hardware for each cell in the system. The template defines a set of initial processes (usually one per service) which are scheduled immediately after the cell start-up. These processes then start up their respective subsystems. A cell configuration service on each cell sends configuration messages to each subsystem when it is being initialized, informing it of the devices it owns. Thereafter, similar messages are sent whenever a new device is added to the cell or a device fails or is removed from the cell.
Thus there is no well-defined meaning for "system up" or "system down" - as long as any cell is active, the system as a whole may be considered to be "upn. Cells can be shut down or started up dynamically without affecting other cells on the network. The same principle applies, in a limited sense, to peripherals. Devices which i253~370 can identify themselves with regard to type, model number, etc. can be added or removed without operator intervention. The operating system cannot maintain a global status of the system, nor does it attempt to centraliæe control of the entire system.

DETAP.li~D DESCRIPTION OF THE INVENTION

FIG. 6 shows a flow diagram illustrating how an interrupt event is handled by the data processing system of the present invention and will be discussed shortly.
Interrupt events may be either generated outside the virtual machine (e.g., by an operator keystroke) or inside the virtual machine (e.g., by a software trap or processor exception).
The virtual machine makes devices look like processes, in that the occurrence of an event on a device causes a message to be generated and sent to another process. The message contains just enough information to inform the receiving process of the event. The receiving process is expected to perform all hardware-specific operations related to the event, such as setting control registers, extracting data from buffers, etc. In other words, it performs the functions of a typical device "driver" or "handler".
Such processes, as mentioned above, are called External Event Service Processes or EESP's, from the virtual machine's point of view.
To become an EESP, a process issues a CONNECT primitive to connect itself to the device; it must issue a DISCONNECT primitive before it exits. The event message is pre-allocated by the EESP during its initialization and is freed only after a DISCONNECT. The message circulates between the virtual machine and the EESP.
To the user, an EESP is usually accessed as a "device manager", which not only handles external events but also accepts requests to control and communicate with the device. If the device is quite complex, the manager will be a context, and the EESP will be a process in that context. The device manager filters external events and presents a uniform, device-independent interface to applications software.

~' -- 12S397~) OPERATION OF PREFERRI~D E~BODIMEIIT

With reference now to FIG. 6, the msnner in which messages originating from hardware interrupts and exceptions are handled by the processor will be described~
Upon the occurrence of ~n Event 300, Interrupts are disabled and the processor state is saved (box 302). Next, in box 304 the event level is obtained using the GET primitive.
In decision box 306, if any EESP is already connected to .his level, an error message is generated in box 308. If no EESP is already connected to this level, the procedure continues to box 310, where the interrupt mask of the EESP is set to hardware priority.
In decision box 312, if no process was executing, then the "interrupted_PID" field in the notification message is set to zero ~box 314), the notification message is delivered to the EESP (box 316), and the EESP is scheduled to run (box 318). If a process was executing (decision box 312), then set the "interrupted_PID" field in the '~ notification message to the PID of the interrupted process (box 320).
- In decision box 322, if this EESP was executing, then deliver the notification message to the EESP (box 324), and restore the processor status (box 326). If this EESP was not executing, then save the state of the.interrupted process (box 328).
In decision box 330, if this EESP is in the GET state, then deliver the notification message to the EESP (box 334), and schedule the EESP to run (box 336). Otherwise, queue the notification message to the EESP (box 332), and schedule the EESP to run (box 336).
~' DESCRIPTION OF P~ L{STINGS

Program Listings A-F contain a "C`' language implementation of the concepts relating to message transmission among processes in a data processing system incorporating the present invention. Program Listings C-E, in particular, describe the implementation of the innovative features of the present invention as set forth and described ` 35 abovo.

~25397C) In Program Listing C, lines 113-116, the data structure CT
(Connection Table) is defined. Data structure CT is declared in Program Listing F, line 37. This table has an entry for every external event recognized by the system (including hardware interrupts, processor exceptions, software traps, etc.). Each entry contains a pointer to the PCB (Process Control Block) of the EESP (External Event Service Process) that issued a CONNECT kernel primitive for that event level, and a pointer to the external event occurrence notification message.
In Program Listing D, lines 29-49 describe the implementation of the CONNECT kernel primitive, whereby a process declares its readiness to accept external event occurrence notification messages, i.e., to become an EESP. It is here that the appropriate entry in the Connection Table is initialized with the PCB pointer and the notification message pointer.
In Program Listing D, lines 52-60 describe the implementation of the DISCONNECT kernel primitive, whereby a process ceases to receive notification messages for that event level. The appropriate entry in the Connection Table is cleared.
In Program Listing D, lines 62-68 describe the implementation of the RELEASE kernel primitive. This is used by an EESP to notify the kernel that the processing of the current external event is complete, and the process is ready to receive another event notification.
In Program Listing E, lines 471-552 describe the actual context switching and external event notification mechanism. This code, presented here in Motorola MC68010 assembly language, represents the implementation for the Motorola MC68010 microprocessor.
It will be apparent to those skilled in the art that the herein disclosed invention may be modified in numerous ways and may assume many embodiments other thsn the preferred form specifically set out and described above. Accordingly, it is intended by the appended claims to cover all modifications of the invention which fall within the true spirit and scope of the invention.
What is claimed is:

:

;' PROGRU~M LISTING A

~DULE ~AME : XMX
11 SUBSYSTEM NAHE : kernel 12 DATE & TIME OF CREATJ~ : X~X v~ur~
13 DAT~ L TI~ OF CO~PILATIDN : XDX XTX
14 VERSIOU : -~X.V~lX
PR~GRAHMER : Andre~ ~un 16 DESCRIPTIDN : Pr~cess management module (p create & exit) t7 PARAMETERS PASSED

1~ */
21 ~include local/cx.h 22 #include locsl/os~vers.h 23 ~include ~ocal/os/kerntypes.h 2B void cx p create tpcb) 29 register PCB ~pcb;
3~ {
31 - extern short hasht~;
32 extern void insert_fifo();
33 extern void tonim_cxct);

register PCB *p;
3~ l~rg i;

3a~ i = hash(pcb ~p name);
39 if (~p = *(pcb-~parent-~phtli)) !=NUL!) 4D.- - ~hile (p-~next hash != UULL) 41. p = p->next_hash;
42 p ~next hash = pcb;
4~ ' 44; else ~pcb->parent~>pht+i) = p;b;
46 if ~pcb~>parent~>parent) 47 tonim cxc(pcb->p name TRU );
48~ if tpcb ~k-code != (char)SUSPENDED) 49- - insert fitotpcb);

~2 54 void cx exit ~peb) register PCB ~pcb;
{

;
', ~ ~ ' ' .

- .

:

i253970 extern short hash(~;
extern void tonim_cxc~);
57 extern void extract rtrq();
5 register PC3 *p;
register long i;

62 if (pcb->k cDde == (char)~OCODE) ~* ssill running ~/
63 exrract rtrq(pcb);
64 if ~Ipcb->parent->parent) tonim_cxc(pcb->p name FALSE);
66 i = hash~pcb->p_name);
67 jf ~(p = *(pcb->parent->pht+i)) == pcb) ~8 ~(pcb->parent->pht+i) = pcb->next hash;
69 else C
~hiLe ~p->next_hash l= pcb) 71 p = p->next hash;
72 p-~next hash =.pcb->next hash;
73 }
74 pcb->pid = 0L;

79 void pht init() ~0 81 extern long root[~;
82 extern PCB-*phtt];
83 regis~er shor; i;
o4 roottO~ = 0; ~ root s parent ~/
86 roottl~ = (long) pht; /~ root pht */
87. for (i=0; i PHTSlZ~; i++) 88 pht[i] = NULL;
89 }

93 void extract rtrq(pcb) 94 register PCB ~pcb;
95 {
96 extern PCB *rd~nxtt] ~rdylstt~;
97 register PCB ~p;

99 if ~tp = rdynxt[pcb->c pri~ == pcb) C
1oa if (I(rdynxt~pcb->c_pri~ = pcb >~ink)) 101 rdylstLpcb->c pri~ = NULL;
~02. }
103 else {
104 ~hile (p&&tp->link!=pcb)) 105 p = p^~link;
106 if (!p) 107 if (!(p->~ink = pcb->link)) :0~ rdyls~tpcD->c pri] = p;

110 }
1 ~

:i25397~

PROGR~lM LISTING B

1D # MODULE ~AME : XM%
11 X SUBSYSTEM ~AME : kernel 12 X DATE & TIME OF CREATIDN : ~E~ ~U%
13 X DATE & TlHE OF COMPILATION : ~D% X,X
14 X VERSION : ~hR~.XL%
15 # PROGRA~HER : Andre~ Kun 16 # DESCRIPTION : This file CDntains the implementation of the five 17 # inter-process c~mmunication support 18 X functi~n: 'putf~r' 19 #
20 X PARAMETER$ PASSED : As per Kerne~ Inte,face Guide rev.6 21 X PARAMETERS RETURNED : As per Kernel Interface Guide re~.6 22 X ~/

24 X XincLude "local~cx.h"
X Xinclude "local/os/vers.h'~
26 X Xinclude "lDcal/os/kerntypes.h"

28 X extern PCB *runnins;
29 X extern short hasht);
X extern void tonim xmit();
31 X extern P~B *makepcb~);
o2 X extern int strcmpt);
33 X extern void queue msgt);
34 X extern void msg err();
3~ X extern MSG ~my allocmemt);
36 X extern bool cx freememt);
~7 X extern char ~memcpyt);
38 X extern void insert fifot);
39 X eXtern boDl munlinkt);
X
41 X extern long root~;
42 X extern long startinS;
43 X eXtern long this cell;

4~ set MAXPRI,63 46 X MSG offsets 47 set MNXT,O
48 set MPRV;4 49 set MFL~,8 set MMOD, ~1 ` set MPID,10 ~2 set MO~N,14 X o~ner P~.
53 set MSIZ,18 ~4 set MPRI,22 set MMID,~3 56 X --'SP msg offsets i25~970 57 set E~SG,24 58 set ELEV,32 59 set EPlD,36 - 60 # PCB offsets 61 set LNK,12 ~ link point~-62 set P~D,44 ~ PCB pid.
63 set PRI,48 # priDrity 64 set KCD,49 ~ primitive code set FLG,51 ~ PCB f~ags 66 set SP~,56 ~ current stsck pointer 67 set D0%,60 X register D~dO
68 set Dl-X,64 ~ register ~d1 69 set D2%,68 ~ regis;er ~d2 set D3%,72 # register ~c~
71 set D4-~,76 # register ~d4 72 set D5X,80 ~ register Xc~
73 set D6,o,84 - X register X~6 74 set D ro~88 # register ~a7 set AOX,92 ~ register XaO
76 set A1~,96 ~ register Xa1 77 set A2~,100 ~ register D~a2 7B set A3-X.,104 X register ~a3 79 set A4-~,108 X register X.a4 - set A5X,112 # register XLa5 81 set A6%,116 ~ register ~a6 82 set PC%,120 X register /o?C
83 set SRX,124 ~ register Ysr ~ 84 set EXC,144 ~ execution time - 85 set ACT,148 X Last ac;ivati~n 86 ~ Error levels 87 set x primitive,257 ~ bad kernel primitive 88 set x xmitmode,258 ~ bad transmission mode 89 set x pointer,25,D ~ pDinter to an Ddd address set x Levelr260 ~ bad interrupt level 91 set x interrupt,261 ~ fatal interrup.
92 set x fakemsg,262 ~ message isn t r real message ~3 set x stolenmss,2~3 ~ message is~ ; o~ned by requester 94 set x freedmss,264 ~ message has been freed ,5 set x alloce~ms~,265 ~ message ~as al!oced, no~ gotten g6 set x smaLlmss,266 ~ message is tor. small for cDnnect ~` ,7 98 text 9 glorJal putfor 100 set S~1, 16 1D1 ~ set T~1, 30 102 set FX1, 34 lQ3 set M,.1,0x3cOD
104 putfor:
105 ~ bool putfor tmode, dest, msg~
~ 106 ~ long mode;
- lD7 ~ DESTINAT~ON dest;
lD8 ~ register MSG ~msS;
109 ~ {
~` 11D ., extern short hasht);
extern void tonim xmit();
112 ~ extern PCB ~makepcb(~;
~''~ - ` ), ~

~25397a~

113 X extern int strcm~
114 ~ extern ~oid queue msg();
115 X extern void msg err();
116 X extern ~SG ~my al IDCmem~);
117 # extern bool cx freemem~);
118 # extern char ~memcpy()' 119 X extern void ins~rt fifot);
120 # extern boo~ munlink();
121 #
122 # extern lDng rDot~];
1Z3 # extern long st~rtins;
124 # ex~ern long this cell;
125 X register PCB ~p, ~;
126 # register MSG ~m;
1Z7 # register PCB ~r = runnins;
128 # short i;
129 X int found;
130 # int fromnim;
131 #
132 set RUNNIN~,-4+SX1 1~3 set IX,-61S%1 1;4 set FDUND%,-1~+SX1 135 set FRDMNI~%,-14+SX1 136 set ACCEPTED%,FDUND~+1 138 link Xfp,~-34 13, movm.l &Ox3cOO,SX1t%fp) 140 tst.l 8(%fp) 141 blt.b L-~bacmode 147 cm~.l BtXfp)t&4 143 bLe.b LX41 ~ if (!starting & (miss->o~ner !=r)) 144 LXbadmode:
14~ mov.l &x xmitmode,-(Xsp) 146 br LXrepfix 147 LX41:
148 mov.l 16t%fp),%a2 149 mov.l running,RUNNINGtXfpj 15D mov.l &O,-XdO ~ frDmnim = msg-~fLaRs & ;RDMNIM;
151 mov.b MFL~ a2),XdO
152 and.l &8,-~dO
1~3 moY.l ~dO,FRDMNIMX('fp) ;4 mov.b MFLG(-~a2),'~d0 ~ accepted = mss->flags &
ACCEPTED;
1~5 and.b &Ox80,-~dO
156 mov.b ~dO,ACCEPTED%(Xfp) 157 ar~.b ~Ox7~,MFLGtXa2) ~msg-~flags &= -(FRDMNlM¦A_r_PTED¦
LRIN~) 158 mDv.l 8tXfp~,XdO ~ s~itch tmode) t 159 cmp.l %dO,&4 160 bhi L%DEFA~LT
161 add.~ %dD,%dO
162 mo~ 10t~Dc,%dO.~),XdO
16~ jmp 6(%p-,XdO.~) 164 swDeR ~5 16; L,.14:
166 short LXDIR-GT-L~14, 167 short L%LDCAL-L%149 ~68 short LXALL-L%~49 125397~

169 short L~NEXT-L~14 170 snor. L~LEYEL-L~1~9 17t t~2 t73 ~ -case DJRECT:
174 # if (ms~-~fla~s & ERR~R) C
17~ X if (p = makepcb(dest.pid)) {
t76 ~ if ((msg-~f~ags ~ CALLED) ~& (p->k code==tchar)~ALL~) {
t,7 ~ p-?k code ~= SUSPENDED;
t78 ~ p-~dO = 0L;
t79 # insert fifo(p);
180 ~ }
18t X msg err(p->parent,msg);
182 ~ }
183 # else 184 # msg err(root,msg);
1~5 ~ }
186 ~ e!se if t~((char ~)(&dest.pid)) != ((char)thls cell)) {
187 ~ if Dthis cell) {
188 # munlink(mss,r);
189 # tonim xmit(msg,mode,dest);
190 ~ }
19t X else C
192 X msg err~r,msg);
1~3 ~ if (msg-~ls~s & CALLED) 194 ~ return(FALSE);
195 # }
196 X }
197 X else C
198 ~ if tp = makepcb(dest.pid)) 159 ~ aueue msg(msg,p);
- -20D ~ else if t!fromnim) C
201 X msg_err(r->parent,msg);
202' X if (ms~-~fla~s ~ CALLED) 2Q3 ~ return(FA!S_);
204 X }
205 ~- else {
206 X msg-~flags j= ERROR;
207 ~ - munLink(msg,r);
208 ~ lonim xmit(mss,DIREGT,dest);

21D ~ ~
211 ~ break;
212 L,DIRECT:
'213 mo~.l 12tXfp),tXsp) 214 ~ jsr . makep-b 215 mov.l Xa0,~a3 216 btst &4,MFLG(Xa2) 217 beq.b LX45 218 mov.l 'a3,'Xd0 219 beq.b LX46 ;220 btst &6,MFLG(Xa2) 221- beq.b t X47 ;222 cm~.b KCDtXa3),&4 '223 bne.b LX47 224 and.b ~-128,KCDtX23) - ~J

125397~

,25 mo~ ~ ~a3,~SD) 226 jsr insert_fifo 2Z7 L~47:
~28 mo~ a2,t-~sp) 229 mov.l (~23),-~Xsp) 230 jsr msg err Z31 br L~
Z32 L~46:
233 mo~.l Xa2,tXsp) 234 mov.l ~root,-tXsp) Z35 jsr m~g err 236 br L~O1 237 L'~45:
238 mov.b 12(X~p),~dO # if ~((char ~)t~dest.pid))!=((char) this cell) 239 cmp.b Xd0,this cell~3 240 bec.b LX50 241 tst.b this cell~3 242 beq LZ51 243 br LX1,2x 2L4 LY~D
245 mov.l Xa3,Xd0 246 beq.b L-~55 247 mov.l X33,~-~sp) 24~ br L~3 249 LX5~: -250 tst.l FROMNlMXtXfp) 251 bne.b L,57 252 moY.l Xa2,(Xsp) 2~3 mov.l RUNNlNGtXfp),XaO
254 moY.l tXaO),-~Xsp) 255 Ln~14:
256 -jsr ms~ err 257 ad~.l &4,-~sp 258 btst &6,MFLGtXa2) 259 beq L%Retlrue 260 Dr L'~DEFAULT
261 LY37:
262 bset &4,MFLG(Xa2) 263 mov.l RUNNIN~tXfp),(-Xsp) 264 mov.l Za2,-t-XOsp) 265 ~sr munlink 266 add.l K ,Xsp 267 mov.l ~2~Xfp),tXsp) 268 - pea O
269 mo~.l XOa2,-(Xsp) 27D ~ br L-~2 273 ~ case LC~AL:
274 ~ found = FALS_;
2r~ ~ i = hash(oes;.proc name~;
276 ~ q = (r->ph.)? r: r ~paren ;
277 ~ p = ~(q-~pht+i);
27 ~ for (; !found && p!=NULL; p=p->next hash) 279 ~ if ~!strcmD(~ >p name,oest.proc name)&&(p!=r)) {
2L0 ~ found = TRU_;

.

12539qO

2~1 r 2. ~ for (; r =~ULL; p=p-~next hPsh) 28~ ~ if t!strcmD(p ~p name,OeSt.DroC name)~&(p!=r)) {
2B4 X m = my al~Dcmem(msg->size~sizeof(MSG));
285 ~ memcpy(m,mss,msg->size~sizeo, t MSG ) );
286 ~ m-~next = m-~prev = UULL;
287 # queue msg(~,p);
2B8 # }
289 # if (q->parent && !f~und) {
290 ~ msg err(r,msg);
2~1 X if ~msg->flsys ~ CALLED) 292 # return(FALS~);
2~3 ~ ~
294 # eLse if t!q-~parent) {
2~5 X if (!fromnim) { /* not frDm NIM ~/
296 # if (found ~& this cel~) {
2~7 # m = my allDcmem(mss->size+sizeDftMSG));
298 # mem-py(m,msg,mss->size+sizeof (MSG));
2r~9 # m->next = m->prev = NULL;
300 # m->flays l= ACCEPTED;
3D1 X tDnim xmit(m,mode,dest);
302 # }
303 X else if ~this cell) C
304 ~ munlink(mss,r);
305 ~ IDnim_xmit(msg,mDde,dest);
306 X }
307 ~ else if t!fDund) {
308 # mss err(r,msg);
3D9 X if (mss >flags & CALLED) 310 # return(FA!SE);
311 X }
312 ~ ~
313 X else if (!accepted) { J* frDm NIM., not - accepted */
314 X if (found) {
31~ X m = my allocmem(msg-~si2e+s k eDft~.S~));
316 ~ mem_py(m,mss,msg-~si2e+sizeDf t~Su));
317 X m->next = m-~prev = NU!L;
318 X m >flsgs ¦= ACCEPTED I FROMNI~.;
31, X - ~ tDnim xmittm,mode,dest);
320 ~ }
321 X else C
o22 X if (fromnim) 323 X msg-~flags ¦= FROMNI~.;
324 ~ munlink~msg,r);
32~ X tonim xmittmsg,mode,des~);

327 X ` }
;28 X else if (!found) J~ frDm NIM, accepted, not ~`~ found ~/
329 X cx freemem(mso~1);
33~ ~ ~
o31 X break;
332 LXLO-AL:
33 clr.b FOUND%~7.fD) `~ 334 mov.l 12t~fp),tXsp~
isr hash - 336- mD~o~ Xd0,IXtVfp) ' :

~25397~1 337 mov.l ~U~'lh'~fp),~
338 tst.~ 4t~a4) 339 bne.b LX62 3~0 mov.L ~a4),~a4 341 L-~62:
342 mov.~ IXtXfp),~dO
3~3 Lsl.~ ~2,XdO
3~4 mov.l 4(~4),~a1 345 mov.~ a1,XdO.u),-~a3 346 br.b LX65 347 L~4:
348 mov.l 12tXfp),~aO
;49 ~ea 28(~a3),-~a1 350 Z'1:
351 mov.b (%aO)+,XdO
352 cmp.o 'ZOdO,(Xa1)+
353 bne.b L~/~66 354 tst.b '~dO
355 bne.b Z%1 356 cmp;L Xa3,RUNHIN~tXfp) 357 beq.b L-~66 358 mov.l &1,~dO
359 mov.b XdO,FOUND%~%fp) 360 mov.l Xa3,(Xsp) 361 mov.l ~a2,-(-Z~p) 362 jsr oueue msg 3~3 add.L 84,%sp 364 mov.L 8('a3),Xa3 365 br L-~64 366 L-h66:
367 mov.l 8(~a3),Z2;
36B L-~65:
369 mov.L Xa3,-hdO
a70 bne.b L-~%4 371 br L-h64 372 ~ -~73 374 X case AL!:
375 ~ i = hashtdest.pro_ name);
376 X q = ~r->Dh;~? r: r->parent;
377 X for (found = FALS_; !found~&~; q = q->parent) C
~78 X p = ~(q->phtli); -a7 X for t; !found ~& p!=NU!!; p=p >next hash) 380 X if (!strcmD(p->p name,dest.pro: name)&&tp!=r)~ {
381 * found = TRUE;
3~2 X queue msg(ms8,p);
383 ~X }
3B4 X for (; p!=NULL; p=p >next hash) 385 X if (!s~rcmp(p->p name,oest.pro- name)&~tp!=r)) {
3B6 X m = my aLlocmem(mss-~st2e+sizeof(MSG));
387 ~ mem-py(m,mss,ms5->si2e~si2eof (~Su));
38B X m->next = m->prev = NULL;
389 X queue_msg(m,p~;
390 ~ }
3~1 ~ }
392 ~ if t!q) {

~ .

~2s3g7~

393 ~ if (found ~& this ce~l) {
3~4 # m = m~_al~ocmem(msg->size~sizeof(~SG));
3~5 # memcpy(m,msg,mss-~si~e+si~eof (~Su));
396 ~ m-~next = m-~Drev = ~ULL;
397 # m->fla~s ¦= A~CEPTED;
398 ~ tonim xmit(m,mooe,dest);

4DO ~ eLse if (this ce~
4D1 X munLink(msg,r~;
402 # tonim xmit(msg,mode,dest);
403 #
4D4 # eLse if (!found) {
405 X ms~ err(r,msg);
406 ~ if (msg-~flags & CALLED) 407 # return(FALSE);

409 ~ ' 410 X eLse if (!accepted) {
411 # if (found) {
412 # m = my allocmem(msg->si_e+si~eof(MSG));
413 ~ memcpy(m,msg,msg-~sizetsizeof (MS~));
414 X m->next = m-?prev = NULL;
415 X m->fLa~s ¦= ACCEPTD ~ FRu^MNI~;
416 X tonim_xmit(m,mooe,oest);
417 X }
418 X else {
419 ~ if (fromnim) 420 ~ msg-~fLa~s ¦= FR^uMNI~;
421 X munLink(msg,r);
422 ~ tonim_xmit(msg,mode,des,);
423 X }
424 ., }
425- ~ eLse if (!found) 426 X cx_freemem~msg+1);
427 ~ }
428 ~ break;
429 LXALL:
430 mov.L î2tXfp),t~sp) 431 jsr hash 432 mov.~ XdO,IXtXfp) 433 mov.L RUNNINGtXfp),%a4 4;4 tst.L 4t a4) 435 bne.b LX90 436 mov.L tXa4),Xa4 4~7 ~L-~9Q:
438 - clr.b FOUND%tXfp) 439 br LY.93 D L~12:
441 - mo~ IXtXfp~,%dO
442 lsl.~ &2,XdO
443 mov.L 4tXa4),Xa1 444 mov.L Ot%a1,XdO.~ a3 44~ bc.b LX96 446 L~5:
4~7 mov.l 12tX~p),XaO
448 Lea 28tX23),Va1 '' ~

i253970 ~,49 '~2:
450 n~v.b (, aO~+,XdO
451 cmo.b ~dO,t~a1)+
~52 bne.b LX97 453 tst.b XdO
454 bne.b '-~2 455 cno.l 'iOa3,RUNNINGtXfp) 456 beq.b L~97 457 mov.l &1,~d0 458 To~.b ZdO,FWND%t%fp) 459 mov.l Xa3~t 460 mov.l ~a2,-t-~sp 461 jsr aueue msg 4S2 add.L &4,Xsp 463 mov.l Bt~a3),-'a3 464 br L%95 465 L%97:
466 mov.l 8t~a3),%a3 467 LX96: ~
468 mov.l Xa3,XdO
469 bne.b L-'-,5 470 br L%95 4~
4~2 473 X cBse NEXT:
474 X i- = hash(dest.proc name);
4r~ '' found = FALS--;
476 ~ if (!strcmD(dest.pro~ name,r-~p name)) {
477 " for (q=r,p=q-~next hash; !found; p=p-~next hash) {
47B 1r if (!p) C
479 # if (!this cell ¦¦ r->parent-~paren;) 480 ~ p = ~(r->parent-~pht+i);
481 ~ else {
482- ~ msg-~fLags ¦= LRIN-:;
483 # break;
4B4 ~ }
485 ~ }
486 " if t!strcm?(p >p name,dest.proc name)) {
487 '' found = TRU_;
488 ~r queue msgtmss,p~;
489 X break;
490 " }
491 . }
492 ~ q = r >parent ~paren~; -4~3 " }
4~4 ~ else 4,; ~ q = r ~parent;
496 " for t; !found~&c;; q = q-~Darent) {
497 ~ for (p ~ ~tq ~pht+i); p~=NUL'; p=p >nex- hash) 49B ~ if (!strcmD(p->p name,aes~.pro~ name)) 499 ,. found = TRUE;
500 T~ queue-nss(msg~?);
501 " break;
502 '' }
~03 '' }
if (!q) {

.
3~

~253~71~

5D5 X m = my allocmem(msq->si2e-sizeof(MSG));
506 # memcpv(m,mss,mss->si2e~si~eof ~SG ";
5C7 ~ m->next = m-~prev = UU~,;
508 # m-~f~srs l= A-rEPTED I FR3MNI~;
509 # tonim_~mit(m,mcae,dest);
510 ~ }
511 ~ else if (!four~ && this cell) C
512 ~ if (fromnim) 513 # msg-~lags ¦= FRO~HI~;
514 # mun'ink(ms~,r);
515 ~ tonim xmit(msg,mode,dest);
516 # }
517 ~ else if (!four~) {
518 # msg err(r,msg);
519 # if (mss-~flags & CALLED) 520 # return(FALS');
521 #
522 #
523 ~ bre`ak;

525 L%NEXT:
526 mov.L 12tXfp),(Xsp) 527 jsr hash 528 mov.w XdO,IXtXfp) 529 clr.b FOUND~t%tp) 53D mov.l RuNNlNGtxfp)rxao 531 lea 28(XaO),Xa1 532 mov.l 12("fp),%aO
~33 ZX3:
534 mDv.b ('aO)~,%dO
535 cmp.b XdO,(Xal>~
536 bne L~117 537 ts .b XdO
538 bne.b Z-,'3 539 mDv.l RUNNlNGtXfp),Xa4 540 mov.l 8tXa4),X23 541 br.b LXl20 542 L~23:
543 mov.~ IX(%fp),%dO
544 lsL.w &2,DhdD
545 m~Y.l RUNNIN~tXfp),-Xa1 546 mov.l tXal),%a1 547 mDv.l 4t-'al),Xa1 548 mov.l OtXal,-~dO.~),X23 549 L~121:
550 ~ mo~ 2tXfp),XsO
551 lea 28tX23),Xal 552 ~'~4:
'53 mo~.b tXaO~,XdO
554 - cmr.b XdO,t~al) 555 bne L~î25 556 IS, . b XdO
557 bne.b 'X4 558 - mov.l &1,%dO
~;9 mov.b ~dO,FOU~XtXfp~
560 ` moY.l '~23,tXsp) ~2s3g70 561 n~v. ~ 4c,2, - (~s 562 jsr oueue msg 563 add. l ~ sp 564 br . b L,0119 565 L~D125:
566 mov. l 8(,~a3),~a3 5b7 L~D12Q:
568 tst.b FouNDxt%fp) 569 bne . b L~ol l 9 570 mov. l X23,XdO
571 bne.b L,.121 5~2 tst.b ~his ceLlt3 573 beq.b L~D123 574 mov.l RUNNlNG~-'fp),XaO
575 mo~. l (YaO) ,XaO
576 tst. l ('JOaO) 577 bne LX123 57~ or.b &OxO4,MFLG~,'Oa2) 579 br: b L;o%6 580 LX119:
581 mov. l RUN~lN~Zfp~,XaO
582 mov. L ~XaO) "XaO
583 br . b L-'%6 584 L,.117:
585 mov.l RUNNlNG~Xfp),'aO
586 L,o%6:
587 mov. l (XaD) ,Xa4 58~ br.b L;'126 5~9 LtoYo8:
590 mov.~/ I%~%fp),XdO
591 Lsl.~ &2,XdO
592 - mov.l 4t%a4), 'al 593 mov.l O~xa1,YdO.~) ,-'e3 594 br . b LX132 59~ L~7:
596 mDv. l 12~%fD) ,-,~aD
597 lea 28~Xa3) ,Xal 598 2Ys:
599 mov.b (-'aO~ ~O
600 cm?.b XdO, (Xa1)+
6~1 bne.b LX133 602 ts . . b XdO
60; bne . b Z-'5 604 mov.l &1,-~dD
6Q5 mov. b XdO, FWN5Xt%Tp) 606 mov.l . ~R3,(~Sp) 607 mov.l ~a2,-tXsp) 608 jsr aueue msg 609 add. l ~4,%sp 610 b,.b. L~131 611 LX1 ,3:
612 moY. l 8~-Xa3) ,-'a3 613 L,. ~2:
61.t mov. l 'a3,XdO
615 ~ne.b !-'~7 616 L,.131:
3~

-`` i25397~

617 m~ a~ a~
618LX126:
619 tst.b FOJNDX(Xfp) 620 bne.b LX12~
621 mov.l ~a4,-~dO
622 bne.b L 8 623LX1 2a:
624 mov.l %a4,%dO
625 bne LX2etTrue 626 tst.b FOU~D%(Xfp) 627 beq.b L~135 628 tst.l FROMNlMX(Xfp) 629 ~ne L%fixnim 630LX135:
631 tst.b FOUNDXtxfp) 632 bne LX137 603 ` br LX104 63j 636 X case LEVEL:
6;7 ~ if (dest.pro~ name[O]==~s') 638 ~ queue msg(msg,r);
639 ~ else if (dest.proc namerO~=='c') 640 ~ if (r >parent) 641 ~ queue_msg(msg,r->parent);
642 X else 643 # return(FALS-);
644 ~ eLse {
64~ ~ reperrtX XMITMOD~);
646 X return(FALS~);
647 X }
64~ ~ break;
64~ L%LEVEL: `
650 moY.l t2tYfp~,XaD
651 cmD.b ~XaO),&115 652 bne.b LX142 6~; mov.l RUNNING(Y~fp),tXsp) 654 br.b L-~3 655L~142:
656 c~?.b tYaO),~99 6~7 bne.b LX144 65~ mov.l RUNUINGtXfp),YaO
659 t~t.l ~XaO) 660 - beq.b LX145 661 mov.l tXaO),~Xsp~
662 ~ L~5:
663 ~ mov.l ` Xa2,-tXsp) 664 jsr queue msg 66~ Lh~1:
666 add.l &4,Xsp 667 mov.l &1,XdO
66B br L-~26 ~9L~144: -670 mov.l &x xmitmode~-txsp) 671 LXre?fix:
672 bsr re~err 3 ~

.~

~25397~

6?3 L~145:
674 mov.l &O,~dO ~ return(FA!S');
6~ L-2 6:
676 movm.l S~1(Xfp),&0~3cOO
677 unlk Xfp 67~ rts 67~ LVO~10 680 mov.l 12(Xfp),-~aO
681 lea 28(Xa3),Xa1 682 ~6:
683 mov.b (~aO)~,~dO
684 cmp.b ~dO,(Xa1>+
685 bne.b L;:70 686 tst.b ~dO
687 bne.b Z%b 688 cmp.l G/23,RUNNING(Y.fp) 689 beq.b L~X70 690 m~v.l ~.SI'(~a2),XdO
691 add.l ~ &24,-~dO
692 mov.l J~O,tXsp) 6~3 jsr my_all~emem 694 m~v.l XaO,'a5 695 mov.l (~sp),XdO
696 ad~ 3,'~dO
697 Isr.I &2,XdO
698 mov.l Xa2,~a1 699 br.b Q%1 700 P,.1:
7D1 s~ap XdO
702 C,.1:
703 mov.l (xdl>+~tzao?+
704 dara XdO,C%1 705 s~ap %dO
706 - dbra ~"dO,P;.1 707 sub.l XaO,~aD
7D8 mDv.l 'aO,MPRVt-,'25) 709 m3v.l XaO,(X25) 710 mov.l ~a3,tJsp) 711 mDv.l %a5,-(~sp) 712 - jsr oueue msg 713 ad~.l &4,~sp 714 L~70:
715 mov.l 8~X23),-~23 716 L/~:
7i7 moY.l bE3,%dO
718 bne.b L'~10
7~9 ts;.l t~a4) ~20 beq.b U71 721 tst.b FOUND%tY~fp) 7_2 beq LYo51 23 LX7'l:
~24 ts.. l t~a4) 725 bne L,~etTrue ,2b ts.. l rRDMNIM,'~:'fp) 727 beq L~
728 tst.b A~ PT_D%~-'.,p) 3~/

~Z5397~

729 bne.b L'~83 730 tst.b FOUN~Z(Xfp) 73t bne L'fixnim 732 bset ~3,~FLG(~a2) # if (fromnim) mss-~flags ¦= FR0MNI~;
733 mov.l RU~ING(Xfp),(Xsp) 734 moY.l '~a2,-txsp 735 jsr mu~link 736 Bdd . 1 ~4 "~Sp 737 mov.l t2(Xfp),(Xsp) 738 mo~ (Zfp) ~ sp) 739 mo~ a2,-(Xsp) 740 jsr tonim xmit X 1 741 add.l &8,~sp 742 mov.-l &1,-~d0 743 br L-~26 7~4 L~
745 L-~83:
746 tst.b FOU~DX(%fp) 7~7 - bne LXRet~rue 748 Les.L 24t-/~2),Xa0 749 mov.l ~a0,(Xsp) r,o jsr cx freemem 751 br LhRet~rue 752 LX~3:
753 tst.b FOUND%(Xfp) ro4 bne.b LX92 755 mov.l ~a4,-~d0 756 bne LX%12 757 LY.92:
758 mov.l Xa4,~d0 r~9 bne LXRet~rue 760 tst.l FROMNIM%tXfp) 761 bne.b L%103 762 L-~'11:
763 tst.b F W ND%tXfp) 764 bec.b L-X7b 765 tst.b this cell 3 766 bne.b L~X.9 767 br.b LX78 768 LX1D4:
76g L-~76:
77D tst.b this cell 3 771 bne LX112x 772 L%137:
773 LXqB:
774 ~ tst.b FOUNDX~Xfp) m bne LXRet~rue 776 L~51:
m mov.l V~a2,tXsp) 778 mov.l RUNNINGt%fp),-tZsp) 779 br L~%14 78D LX103:
781 tst.b ACCEPT_D%t'fp) 782 bne L~111 783 ts;.b FOUHDX~Xfp) 784 beq b L~lt2 ~ 3J-.

i2S3~7(3 Z85 br L%fixnim 78b L~%9:
787 mov.~ MSIZ('~a2),-~dO
788 add.l ~2~ dO
7~9 mov.~ XdO,(~sp) 790 isr my allocmem 791 mov.~ ~aO,~a5 792 m~v.l t%sp),'~dO
7g3 add.l 3,~dO
794 lsr.l L2,'~dO
7~5 m~v.I ~a2,~a1 796 br.b ~2 797 P-~2:
798 s~ap XdO
7~9 ~2:
800 mov.l (~a1)~,(X30)+
80~ dbrs %dO,~X2 802 swap XdO
803 dbra ~dO,P-~2 804 sub.l XaO,XaO
805 mov.l XaO,MPRV(-~25) 806 mov.L XaO,(Xa5) 807 bset &7,MFLGtXs5) 808 mov.l 12(%fp),(Xsp) 809 mov.l 8tXfp),-(Xsp) 810 mov.l Xa5,-(Xsp) 811 br b L~2 812 L~112:
813 tst.l FROMNIMX(Xfp) ~ if tfromnim) msg->fla3s ¦= FROMNl~;
814 Dec.b LX112x 815 bset ~3,MFLG(Xa2) 816 L%112x:
817 mov.l RUNNlNG(Zfp),(%sp) 818 ~ mo~.l Xa2,-(Zsp) 819 jsr munlink 820 sdd.l &4~%sp &21 mov.l 12(%fp),(Zsp) 822 mov.l 8(Xfp)~-(LZosp) 823 - mov.l ~a2,-tXsp) 824 L~~2:
825 isr tonim xmit ~ 2 B26 add.l &8,%sp 827 LXRetTrue:
828 mov.l &1,'~dO
829 br L~26 830 L~X15:
P31 mov.l 12~Xfp),XaO
8;2 lea 28tX23),Xa1 833 Z~7:
834 mo~.b (-~aO>~ dO
835 cmp.b ~dO,tXa1) 836 bne.b LX101 837 tst.b ~dO
P38 bne.b 2X7 839 cmP.l ~23,RUNNIN~;Xfp) 840 beq.b L~101 3~

12S397~

841 mov.l ~SI2t'~a2),-~dO
8~2 ad~.l &24,~d0 8~3 mov.l ~dO,(~sp) 8L4 j sr my a l lo~mem 845 mov.l XaO,Xa5 846 mov.L ~Xsp),-~dO
8~7 ~dd.l &3,Xd0 848 Lsr.L &2,'~d0 849 mov.l Xa2,Xa1 E50 br.b ax3 e51 P~3:
e52 s~ap XdO
e53 0',3:
854 mov.l tXa1~+,tXaO)+
855 dDra '~dO,~3 856 s~ap ~dO
857 dbra '~dO,P,.3 858 sub.l XaO,XaO
B5D mo~.l XaO,MPRV(Xs5) 860 ~ov.l ~aO,t%25) a61 mov.l Xa3,tXsp) 862 mov.l ~a5,-(Xsp) 863 jsr ~ueue msg 864 sdd.l K ,Xsp 865LX101:
866 mov.L 8tYa3),Xa3 8~7 LY.95:
868 mov.l ~a3,%dO
869 bne.b L~15 87t) mov.l tXa4),Xa4 871 br LX3 a72 873 L%fixnim:
874 mDv.l ~S~ZtXa2),-~dO
8-'5 sdd.l &24,%dO
876 mov.l %dO,tXsp~
877 jsr m~ allocmem &78 - mov.l XaO,X25 87 mov.l t~sp),%dO
880 - sdd.l ~3,XJO
881 lsr.l ~2,-~dO
-~ 882 mov.l ~a2,Y~1 883 br.b QXfx 884 P~fx:
- a - 885 suap %dO
886 QXfx:
887 ~ mov.l ~Xa1)+,tXaO)~
8~8 dDra XdO,C~Tx x~ 889 s~ap ~dO
890 dbra XdO,PXfx ; 891 sub.l XaO,%aO
~2~ a92 mDv.l XaO,MPRVtX25) 8D3 mov.l XaO,tXs5) 894- or.b ~Ox88,MFLGtXa5) ~ m ~flaqs 1= AO--?TrD ¦ FROMNIM;
- 85 mov.l l2(XTP)~tXSP) 896 mov.l 8t'fp),-tXsp) ,. :

~: -3 ~-.,~ .

.
':
~ .

lZ53970 897 mo~. l X25, - txSD) 898 isr t~nirr xmit 89~ ad~ 8"~sp 900 mov. l ~ dO
901 br L'~26 ~253970 PROGRAM LISTING C

1 ~*
2 ~ File name: kerntypes.h 3 *
4 ~ Author: Andreu Kun 6 ~ Description: This file contains gioba~ definitions of the Kerne~
7 ~ constants and data structure types
9 */
11 #ifndef EVHI
~2 13 #define PROC void 15 ffdefine SUSPENDED 0x80 16 #define E SP 0x40 18 #define INTMASK 0x0700 enum kcalLs CNOCODE,PUT,FORUARD,GET,CALL,REPLY,EXIT,CONUECT,DISCO~NECT, 21 ALLOCMEM,FREEMEM,P CREATE,RELEASE,SUSPEND,RESTART,ANY_MSG} ;

23 enum sysers CNIMALLOC,NIMFREE,NIMMODE,NIMREQ} ;
t* bit positions of the flags ~/

27 #define ACCEPTED 0xB0 28 #define CALLED 0x40 29 #define REPLIED 0x20 30 #define ERROR 0x10 31 #define FROMNIM 0x08 32 #define LRING 0x04 34 typedef struct msg C
struct msg *next, *prev;
36 unsigned char fLags;
37 unsigned char mode;
38 long pid;
}9 struct pcb *owner - unsigned long sizé;
41 unsigned char priority;
42- unsigned char mid;
43 } MSG;

Process Control Block: what is specific for each process */

48 #defi~ne PHTSI2E 64 50 typedef struct pcb t 51. struct pcb ~parent; t* pointer to the paren; process *~
52 . - struct pcb **pht; t* ptr to hash table, if NULL: not ctx ~/
53 struct pcb ~next hash; t* ptr to next sibling (with same hash index~ *
54 struct ocb *link; /* ptr to the ready to~run-oueue ~/
MSG ~m first, *m last; t~ pointers to enoueued twaiting) messages ~/
56 . MSC *m~ ptr to queue of messages being processed */

q ;~

~253970 -2l-57 char p namelMAX~AM]; J* process instance name 58 long pid; /* process instance id *
59 cnar c pri; /~ process priority char k_code J~ process state: usecl by the scheduler ~J
61 unsigned char mid; J~ message id. currently being Call-Replied ~J
62 unsigned char flags; /* t.b.d. *
63 int ~stack; J~ stack start address (virtual) */
64 long ~c stck; /* current stack pointer ~/
long dO X* 68000 registers ~J
66 long dl;
67 long d2;
68 long d3;
o69 long d4;
long d5;
71 long d6;
72 long d7;
73 long aO;
74 long al;
long a2;
76 long a3;
77 long a4;
78 long a5;
79 long a6;
long ps;
81 short sr;
82 short crtcount; /* ~ of chiId processes being precreated */
83 struct ptmdef ~ptmptr; t* template definition pointer */
84 struct crtrap ~susptrap; /* susp d precr-r Darent trap NULL if none -1 if not immediate parent trapper. */
86 struct trtrap *termtrap; /~ termination trap ~J
87 long time snap;
88 long exec time; /* total process execution time ~/
89 lons act time; /* process activation time ~/
~if PERFMûH
- 91 long time snap;
92 int gets;
93 int puts;
- 94 int calls;
int for~ards;
96 int replies;
97 int allocs;
- 98 int frees;
99 boDl termr!;
100 #endif 101 ~ PCB;
1û2 104 #if PERFMON
105 enum EXMOD { TOTAL HASHEDIN DELHASH };
106 #endif : 110 ~define EVLO 2 111 #oefine EVHI 267 .

:~ .
4~
.

125397~) 113 typedef struct ct {
114 PCB ~Dcb;
115 -MSG ~msg;
116 ~ CT;

118 ~* Error types ~/

120 #define X PRIMITIVE 257 ~ bad kernel primitive ~/
121 ~define X XMITMODE 258 /~ bad transmission mode ~/
122 #define X POIUTER 259 /~ DOinter to an odd address ~/
123 #define X LEVEL 260 /~ bad interruDt level */
124 #deflne X INTERRUPT 261 /~ fatal interrupt ~/
125 #define X FAKEMSG 262 /~ message isn't real ~/
126 #define X STOLENMSG 263 /~ message has been stolen ~/
127 #define X FREEDMSG 264 /~ message has been freed 128 #define X ALLOCEDMSG 265 ~ message ~asn't gotten ~/
129 #define X SMALLMSG 266 /~ message isn't EE ~/
131 #end;f ,' -`' ' ' ' ' ' ' ~ - .
~,:

. ~ ~
~ , .
.,, ~: .

- .
~ 41 .. ~ . .

~; .

. . . ..
, i ~ `.
~ ,.
.

~Z53970 PROGRAM LISTING D

~ODULE ~AM~ : eesr.c 11 SUBS~STEM NAME : kerne~
12 DATE & TJME DF CREATI~N ~ 12:53:27 13 DATE & TIM- ~F CCMPIL~ ION : ~5/03f25 16:32:37 14 VrRSI~N : 1.7 PROGRAMMER : Andreu Kun 16 DESCRIPTIDN : External event management module.
17 PARAMETERS PASSED : As per General Services In~er'ace Guibe rev.3 18 PARAMETERS RETURNED: As per General Services Interface Guioe re~.3 1,0 */

22 Xinclude "local/cx.h"
23 ~include "locaL/os/vers.h"
24 ~incLude "LocaL/os/eesp.h"
~incLude "LocaL/os/kerntypes.h~' 27 extern CT conn tabr];

29 booL cx connect (LeveL, msg) 3D int Level 31 MSG ~mSs;

33 extern void event suitcht~;
34 extern PCB ~runnins;
36 i f ( conn tab r leveli.pcb) 37 return(FALSE`~;
3~ i f ~msg) C
39 conn tabtLeveL~.msg = mss-1;
strcp~(msg,"event");
41 (tEE *)msg)-~event Level = level;
42 }
43 else 44 conn tab[Level~.msg = O;
~5 conn tabrlevel~.pCb = rUnnins;
46 if tlevel < 256) 47 *((int *~(level*4)~ = (in') event_suitch;
48 return(TRUE);
49 }
~1 .
52 bool cx disconnect (LeveL) ~3 int Level;
54 {
55 if (conn tabtleveL].pcb != running) 56 return(FA!S.);
. .
:~-I
. ~

1253~17 57 conn ta~rieve~] .D_D = ~'U' L;
58 cona tab[leve~].mss = ~ULL;
59 return(TRU');
}

62 void cx release () 63 {
64 extern PCB ~runnins;
66 running-~sr ~ 'TMASK;
67 running->f~ags &= -E'SP;

71 bo~l cx suspend (pid) 72 long pi~;
73 {
74 extern PCB ~makepcb();
7~
76 register ~B ~p;

78 if ~!(p = makepcb(pid)) ¦¦ (p->k cr,de & SUSPENDED)) 79 return(FA!SE);
8D p->k code t= SUSPENDED;
81 returntTRU_);
~2 bool cx restart (pid) 8~ long pic;

88 extern PCB *makep_bt);
89 extern vDid insert fifot);
91 register PCB *p;

93 if (!(p = makep_b(pid)) ~ p-~k code ~ SUSPENDED)) 94 return(F~LS-);
o p->k code ~= -SUSPeNDEC;
96 if (p-~k cDde = (char)N~_~D_) 97 insert 'ifo(p);
98 return(TRU-);
99 }
lDD

102 void event initt) 103 {
104 ~ extern void event switcht);

106 int i;
107 long ~p;

109 for (i=O~ ons *)tEVL0*4)*~ =EVH!; i~) {
110 /* ~pit = (long) event switch; ~/
111 conn tab[i~.D~b = NUL';
112 conn tabEi].msg = NULL;
113 }
114 }
L~3 PROG~AM LISTING E

1 file "kentry.s"
3 set HAXPRI,63 4 # MSG offsets set M~XT, O
6 set MPRV,4 7 set HFLG,8 8 set UMOD,9 9 set MPlD,10 set Mou~,14 ~ o~ner PCB.
11 set MSIZ,18 12 set MPRI,22 13 se. MMID,23 14 # EESP msg offsets set EMS~,24 16 set ELEV,32 17 set EPID,36 18 X PCB offsets 19 set LNK,12 X link pointer set PID,44 ~ P~B pid.
21 set PRI,4~ X priority 22 set KCD,49 X primiti ve cr~de 23 set FL~,51 v PCB flags 24 set SPX,56 ~ current stsck pointer set DOX,60 * register XdO
26 set D1~,64 X register %d1 27 set D2%,68 X register ~d2 28 set D3Z,72 X register '~3 29 set D4X,76 ~ register Xd4 set D5X,80 X register Xd5 31 set D6X,84 v register Xd6 32 set D r~,8R - ~ register ~d7 33 - set AOX,92 ~ register XaO
34 set AlX,~6 v register Xa1 set A2%,100 - ~ register Xa2 36 set A3X,104 v register ~23 37 set A~,108 v register ~a4 38 set A~X,1~2 v register ~25 39 set A6X,1?6 ~ register Xa6 4D set P~.,120 - ~ register XDC
41 set SRX,~24 ~ register Xsr 42 set EXC,144 ~ execution time 43 set A~T,148 ~ last ac;ivation 44 ~ Error levels ~set x primitive,257 X bsd kernei p-imitive 46 set x xmitmode,258 r bad transmission mode 47 set x pointer,259 ~ pointer to an odd address 48 set x_level,2~0 X bad interrupt level 4~ set x interrupt,261 ~ fatal interru~t 50 ` set x fakemsg,262 ~ message isn't a real messa~e 51 set x stolermsg,2~3 * message isn`t owned by requester 52 set x freecms8,264 X messa~e has been ;reed 3 set x allocecmsg,265 ~ message uas aEloced, noc gotten 54 set -x smallms5,266 ~ message is too small for conne_t v 'ESP levels 56 set rVLQ,2 ., ~ ;. ~ . .

.
~ ' .
:, ::' ~l2S3970 57 set EV~ ,267 59 text 61 globa~ cx initialize 62 ~lobal k entry 63 global t ck 64 global event s~itch 66 cx initia~ize:
67 mov ~ ~0x2700,Xsr 68 mov l ~0x1000,Xsp 69 jsr start up ~ start up~);
mov.~ &0,-~Xsp) ~ schedule(~;
71 jmp LXschedule 73 k entry:
74 mDv.w ~Ox2700,/~r 7~ cLr.~ suspended 76 movm l &OxcOcO,-(Xsp) ~ D~dQ-/~1/~a0-Xa1 77 sub.~ &1,hd0 ~ s~itch (running-~d0) {
78 r~o.~ ~d0,&14 79 bhi L~primerr add.~ ~d0,hd0 81 ~ mov.w 10t~Dc,%d0.~),%d0 82 jm3 6(Xp~,hdD.~) 83 s~beg &15 84 L-~3:
short LXPUT-Lh63 86 shDrs L%FOR~ARD !-~53 ~7 short LhGET-LZD63 88 short LXCALL-L~53 89 short LhREPLY-L~63 short L~EX~T-L/~ -91 short LXCONNECT-L-~63 92 short LXDISCONNECT-LX63 93 short LXALLO_ff_M-LX63 94 short L%FREEMEM-LX63 ,~ short L~D CREAT_-LX~3 96 short LXRELEAS_-L-XD3 97- short L%SUSPEND-LX63 9~ short LXRESTART-LX63 99 short L ANY MSû-L%53 101 LXPUT:
102 mo~.l Xa1,Xd0 tr if (Imsg lQ3 ~ beq LXfa~emsg 104 sub.l heaps~art,Xd0 ~ msg < heapsts .
105 blt LXfakemsg 106 sur,.l ~2~,Xd0 * ((msg 1) - heaps.art) &
107 and.l h unitml,%d0 ~ (h_uni. 1))
10~ bne LX~akemsg r then reperr tX FAKEMSû~;
109 mov.l (MO~N 24~tZa1),-hd0 ~ if ((msg 1)-~o~ner 110 amp.l -Xd0,running ~ != running) 111 bne LXstolenmsg - t~. then reoerr ~X STD!eNMSû~;
112 mDvm.l &0x~0^0,-t-X~p) - 4~' i2s3g7~

113 bsr ~ cx put ~ ~ put(runnins->d~,aC,a1~;
114 add.~ ~12"Csp 115 br L~49 ~ break;

117 LXFDRUARC:
118 mov.l 'a1,-,~dO ~ if (!msg ¦¦
119 beq L%fakemsg 120 sub l heapst~rt,XdO ~ msg < heapstsrt 121 bLt L%fakemsg 122 sub.l ~24,XdO X ((msg - 1) - heapstart) &
123 and.~ h unitm1 "XdO - ~ (h unit - 1)) 124 bne L,'fakemsg X then reperr (x FAKEMSG);
12~ mov.~ tMO-/N - 24)~Xa1),XdO # if ((msg - ~)->o~-ner126 cm~;.l XdO,running ~ != running) 127 bne LXstolenmsg X then reperr (X STOLE~MS~);
128 mov.l tMPlD - 24)(/~1),ZdO # if t!(msg - 1)->pid)129 beq LXallocedmsg i~ then reperr (X ALLOCEDMSG);
130 mDvm.l ~DX40cO,-(/.sp) 131 bsr.~ cx forward ` ~ cx forward(runnin~->d1,aO,a1);
132 add.l ~12,70sp 133 br LX49 ~ break;

135 LXGET:
136 mov.l ZaO"~dO
137 btst &O "XdO
138 bne LXptrerr 139 mov.l Xa1,XdO
140 btst &O,XdO
141 bne L/.ptrerr 142 . movm.l 80x40cO,-tXsp) 143 bst.w cx get X cx get(running-~d1,aO,a1);
144 sdd.l &12,Xsp ~45 br LX49 ~ break;

147 LXCALL:
148 mov.l ha1"XdO - r' if (!msg ¦¦
149 bec~ L%fakemsg 150 sub.l heaps.ar;,ZdO X msg < heapstart ¦¦
151 bLt L'X.fakemsQ
152 - sub.l ~24,XdO 3Ç t(msg ~ heapstart~ L
153 and.l h unitm1,XdO - u th unit - 1)) 154 bne LXfakemsg " tnen reperr tX ~AKEMSu); `
1~5 mDv.l tMOUN - 24)('a1),XdO ,t if ttmsg - t)->owner 156 cmp.l 7d0,running ~ != runnin~) 157 bne LXstDlenmsg ~! then reperr tX S~O!ENMS~;
158 mDv.l Xa2,XdO
` ~ 15g ;btst &O,S~dO
t60 bne L%ptrerr `h~ `161 mDv.l Xa3,XdO
162 btst &O,XdO
163 bne LXptrerr 64 ~n.l &Ox40fO,-(%sp) 165 bsr.w cx call ~ 3~ cx calltrunnins-~dt,aO,a1,a2,a3);
;I ~ 166 add.l &20,Xsp '~ i67 br LX4~r~ '' break;

.:, ~;
.

~; ~ - L( b ;

.
`:

i.25;397(~

16S LXR'PLY:
170 mov.l XaO,~dO Y if (!ms~
17 beq L%fakemsg 172 sub. l hear~tart,'~dO Y msg < hea?start ¦¦
~r~ blt L,'fakemsg ~74 sub.l &2~,XdO Y ((msg - 1) - heapstart) &
175 9nd.1 h unitm1,Xd0 ~ (h unit - 1)) 176 bne LXfskemsg Y then rer rr (X FAKEMSG);
1/;,' mov.l tMOUN - 24)(XaO),XoO ~ if ((msg - 1)-~o~ner 178 cmp.l XdO,running ~ != running) 179 bne L~stoler~sg ~ then re~err (X STO!EN~SG);
18D mov.l '~a1,XdO ~ if (!msg 1~1 beq LXfakemsg 1~2 sub.l hespstart,'~dO ~ msg < heapstart 183 blt L'fakemsg 1B4 sub.L &24,XdO ~ ((msg - 1) - heapstart) 185 and.l h unitm1,XdO # (h unit - 1)) 186 bne LXfakemsg X then reperr ~x FAKE~S~);
187 mov.l (MO~N - 24)(Xa1),~dO X if (~msg - 1)->o~ner 188 cm~.l XdO,running # != running) 189 bne LXstoLenmsg X then reperr (X STOLENMSG);
190 mDv.l (MPID - 24)(XaD),-~dO $ if (!(msg ~ pid~
191 beq LXalloceomsg ~ then réperr (X ALLO;EDMSG);
192 movm.l ~OxODcO,-(Xsp) 1Q3 bsr.w cx reply # cx reply(running-~aO,a1);
- 194 add.l &8,Xsp -1Q5 br LX49 ~ break;

197 L ~ XIT:
198 mov.l XaO,'XdO ~ if t!msg 199 beq L'Xfakemsg 200 sub.l heapstart,XdO ~ msg < heaps,art 201 blt L%fakemsg 202 su~.l &24,~dO ~ t(msg ~ heapstart) &
203 - and.l h_unitm1,'XdO X (h unit - 1)) 204 bne LXfakemsg ~ tnen rerærr (X ;AK-MS~);
20~ mov.l tMO~N - 24)tXaO),-~dO ~' if ((msg ~ owner :206 . cmp.l XdO,running ~ != running) 207 bne LXstolenmsg ~ then reperr tX STOLEH~S~);
2D8 mov.l XaD~-txsp) 209 bsr.w cx_exit ~ cx_exit(running->aO~;
210 add.l &4"Xsp 211 br L-X49 " break;
2l2 213 LXCONN_CT:
2~4 mov.l 'XaO,'XdD ~ if (msg &&
2t5 ~beq L%OO
216 Sub.l heapstart,%dD X (msg < hea?start ¦¦
217 blt L'Xfakemsg 21R sub.l &2~tXoO ~ ((msg 1) - hea~s;art) &
219 - - and.l h_unitm1,XoO ~ th uni~ - 1))) 220 bne L'~akemsg - ~ then rer,err tX FAK-MS~);
~:~ - 221 - mov.l tMSI7 24)t'aO),%dO ~ if t(msg - 1)->si2e ~ si_eof t=-)) 222 cmp.l Xd0,&16 223 blt LXsmallmsg ~ then reDerr tX SMALLMSG);
Z24 mov.L (MO~N - 24~tXaO),-hdO ~ if ((msg 1)->owner != runni~g - - ~

;

~253970 225 cmo.l ~dO,runnin~
226 bne L~stoler~g Y then rerJerr (x STOLE~S~;
227 L'~OO:
228 cma.l ~dl,~EVLO
229 blt L%lvlerr 230 cmD I ~d1,~EV~I
231 b~t LXlvlerr 2j2 movm.l &Ox4080,-(Xsp) 233 bsr.~ cx connect ~ cx connect(running-~d1,aO);
234 add.l ~8,Xsp 23~ br LX49 # break;

Z37 LZDlSC~NECT:
Z3~ cmp.l Xd1,~EVLo 23, blt L~lvlerr 240 cmp.l Xdl,&EVHI
241 bgt L%lvlerr 242 mov l ~d1,-(%sp) 243 bsr.~ cx disconnect X cx disconnect(running-~dl);
244 sdd.l &4,Y.sp 245 br LX4, X break;

247 LXALLOCME~:
24B mov.l ~d1,-(Xsp) 249 bsr.~ cx allocmem X cx alloemem(runnins-~d1);
250 ~dd.l &4,Xsp 251 br LX4~ X break;
2~2 2~3 LXFRtEME~:
254 mov.l 'aO,%dO X if (!msg ¦¦
2~5 beq L,'~akemsg 256 - sub.l heapstart,-~dO X msg c heapstart 2a7 blt LXLakemsg 258 - sub.l ~24,XdO X ((msQ - 1) - heapstart) &
259 and.l' h unitm1,~d0 ~ (h unit 1)~
260 bne' LVfakemsg X then rererr tX FAKE~Su);
261 mov.l tMO~N - 24)(-'aO),XdO ~ if (~msg 1)->owner 2r,2 cm~.l' ~dO,running ~ != running) Z63 bne LXstolenmsg X then reperr ~X STO'~NMSu);
264 mov.l ,aO,-(Xsp) 265 bsr.u cx freemem ~ cx freememtrunnins->3);
266 ` add.l &4,Xsp 267 br L%49 ~ break, 2~9 LXP CREATE:
270 mov.l XaO,XdO X if t!msg l' 2~t beq L%fakemsg 272 sub.l heapstart,XdO X msg ~ heapstart 273 blt L%~akemsg 274 su~.l &24,Xd0 ~` ttmsg - 1) - heapstart) &
27~ and.l h_unitm1,-~d0 ~ (h unit - 1)) 276 bne LXfakemsg X then rerJerr tX FAK~MSu);
277 mov.l tMD~N - 24)t%aO),XdO ~ if ttmsg ~ >ouner 278 ~?-~ -~dO,running ~ != running) 279 bne L%stolermsg ë tnen reperr tX STO!-~MSu), 2BO moY.l XaO,-tXsp) ;: '.
`

~: .

125~97G

281 bsr.w cx p create ~ cx_p create(runnin~-~aO);
2S2 aod.l ~4~%sp 283 br.b L~49 ~ bre~

285 LXRELEAS~:
286 and.~ ~-1793,16tXsp) Y saved sr ~= -INTMASK
287 bsr.~ cx release ~ cx releaset~;
28~ br.b LX49 X break;

290 LXSUSPEND:
Z91 mov.l Xd1,-tXsp) 292 bsr.~ cx suspend ~ cx suspend(running->d1);
293 add.l ~4,Xsp 294 br.b LX49 ~ break;
2~5 296 LXRESTAR~:
- 297 mov.L Xd1,-(Xsp) 298 jsr cx restart ~ cx restart~running >dl);
299 ~dd.l ~4,Xsp 3DO br.b LX49 # break;

3D2 Lf~NY MSG:
303 mov.l fid1,-(%sp) 3D4 jsr cx_any_msg ~ cx any_msg(running->dl);
305 add.l ~4,Xsp - 306 br.b LX49 308 Lf;smallmss:
309 mov.L &x_smallmsg,-tXsp) 310~ br.b LXrepfix 312 LXfakemss: -313 mov.l &x fakemsg,-tXsp) 314 - br.b LXrepfix 316 LXstolenmSs:
317 mov.l &x_stolenmsg,-tfsp) 318 br.b L%repfix 320 LXalLocedmss:
321 mov.l -&x allocedmsg,-tXsp) 322 br.b LXrepfix -~23 324 LZprim~rr:
325 ` mov.l &x_primitive,-tXsp) 326 br.b LX~repfix 328 LXptrerr:
;29 mDV.l &x_pointer,-tXsp) 33~ br.b LXrepfix 332 LXlvlerr:
` 333 mov.L &x level,-tXsp) 334 L%repfix: `
335 ` bsr reperr 3;6 add.l &4~%sp `

`

125397~

307 br.b schedule _38 339 LX4: -340 mov.L D~dO,tXsp) X scheo~e~);

342 schedule:
3~3 # ~ extern PCB ~runnins;
344 X # extern short susDended;
345 mov.l runnins,Xa1 ~ if (running-~fla~s ~ EESP) 346 btst &6,FLGtXa1) 347 beq.b L'~27 348 tst.~ susper~ed ~ if (!suspended 349 beq L'~82 # rte();
350 # ff else 351 mov.l ~O,-tXsp) 352 mov.l ~O,-(Xsp) ~53 bsr save state ~ save_state();
354 ~nd.b &ûxbf,FLG(%al) X running->fLags &= -EESP;
355 snd.~ ~173,SRX(Xa1) ~ running-~sr ~= -INTMASK;
356 # X for (;;) C
3;7 LXschedule:
358 ~ ~ label:
359 bsr get hipri ~ if tget hipri(~>=O
360 tst.~ XdO
361 # X selectt);
362 - bge.b L-X81 363 # X else ~
364 ~ - add.l &1,processor idle ctr ~ processor idle ctr+~;
365 clr.l running # running = C;
366 stop &Dx20ûD X ~ai;t);
367 mDv.u &Ox2700,Xsr 368 br.b LXschedule 37~ L,~7:
371 tst.w suspended - X else if (suspencied) {
372 beq.b LX4;
3~3 mov.l ~o~(o~sp) 374 mov.l &O,-(Xsp) 375 bsr save state # save s;ate();
376 - br.b Lhschedule # goto label;

37~ L-~4~: .
379 bsr.b get hipri X else i; (~et hipri() >
runnins-~c pri 380 ts... w XdO
381 ~ blt.b LXB2.
3B2 mov.l runnin3,XaO
383 cmp.. b XdO,PRl(XaO) 384 blt.b L%82 38; mov.l XdO,~(%sp) X save i tne~ pri~
386 mov.l Xa1,-(Xsp) X save ne~ PCB
387 moY~l XaO,Xa1 ~ so tnat P-B is theres.
388 bsr save s ate ~' save s~atet);
389 mov.l Xa1,-tXsp) - # insert fifo(running);
390 bsr.~ insert fif D
391 ~dd.l &4,XSD
392 moY.l Xa3,Xa1 # ne~ PCB
- ` 3D

. :

393 mov.~ ~a4,-~dO ~ priority.
394 ~ se~ect() 3~5 L~81:
396 ~sl.~ &2,XdO ~ running = extract fifo(~rtrq[i]);
397 ~ea.l rdynxt,~aO # if (!(rtrq[i~.next-rtrq[i~.nex.->link 398 mov.l L~K(Xa1),0(XaO,XdO.~) 3Ç9 bne.b L~83 400 ~ea.~ rdylst,~aO
401 clr.~ O(XaO,~dO.~) X rtrq[i~.Last = OL;
402 L-~8~:
403 mov.L ~a1,running 404 # add.l &l,process s~itch ctr X prDcess s~itch ctr~+;

406 mov.~ SPX(%al),%aO X restore statet);
407 mov.~ ~aO,Xusp 408 mov.l PCX(%al),-(%sp) ~ rest. ~DC
40~ mov.w S~X(Xa1),-(Xsp) ~ rest. Xsr 410 movm.~ DOX(Xa1),&0x7fff ~ dG-d7 1 aO-a6 411 rte 413 X X else 414 ~ - X rte() 415 LX82:
416 movm.l tXsp)~,&DxO303 ~ XdO-~d1/ aO-Xa1 417 rte 421 ~ Finds highest priority process.
422 X returns aO = rdynxtti~, al = PCB = (rdynx;[i]), dO = -1 or priority.
423 ~ note - int s s.b. off .

425 set tl,tMAXPRI+2)*4 427 get_hipri:
428 mov.~ &MAXPRJ+1,%dO
429 lea.l rdynxtl.1,XaO
L3D L-X74:
431 tst.L -tXaO) ~ search prio-ities.
432 dDne XdO,LX74 433 beq.b L,X72 ~ rts 434 L~73:
435 mov.l (,4aO),Xa1 X p-b 436 tst.b KCDtXa1) ~ k code & suspenoed 4~7 bne.b LX71 438 LX72: ~
43g - rts 440 L~71:
441 mcv.l L~KtXa1),tXaO) ~ try nex;.
442 bne.b LX73 443 lea.l rdylst,Xa1 444 lsl.~ &2,XdO
445 clr.l OtXa1,XdO.~) L46 lsr.~ &2,%dO
447 SUD.~ &1,XdO
448 bra.b L-74 "`:
`~: 5 1 - i25397(~

450 X X21 = PCB
451 # save state(tmD1.l, tmD2.l, %dO, ~d1, XaO, Xa1, ;'sr, Xpc) 452 # on exit a2=pc, a3=tmp1, a4=~mD2 454 save state:
455 movm.l 12tXsp),&OxO103 X aO, dl, dO48t12/ O) 456 movm. l &Ox7fff ,D0%t~a1) X aO-a6,d7-dO132t 3/30) 457 movm.l (Xsp)l,&Ox1cOO # a2=pc,a3=tmp1,a4=tmp2 458 add.L &12,Xsp # 14( 3/ O) 459 mov.l (Xsp)+,A1X(Xa1) X 12( 3/ O) 460 mov.~ (%sp)~,SR%(Xa1) # 8( 2/ O) 461 mov.l (%sp)~,PC%t,Xa1) X 12t 3/ O) 462 mov Xusp,%aO # 6( 1/ O) 463 mov.l XaO,SPXt'~a1) # 16( 2/ 2) 464 jmp (Xa2) # go home 8( 2/ O) 466 # 280(37/32) 46B # # void event s~itch(offs) 46, X X short offs, 470 X # {
471 even~ s~itch:
472 # # extern CT conn tabD ;
473 X X register PCB *p;
474 # # register MSG ~m;
475 # # register int offset;
476 # X save scratcht);
477 and.b &Ox7f,0xf19f11 # disable int's 478 movm.l &OxcOcO,-tXsp) X bdO-Xd1~XaO-Za1 479 mov.~- Xsr,~dO
480 mov.~ &Ox2700,Xsr 481 or.b &Ox80,0xf19f11 X enable int's 482 mov.l ~a2,-(Xsp) - 483 mov.w 26tXsp),Xd1 # offset = offs;
484 lsl.w &1,Yd1 X if(p = conn tabloffset~.pcb) {
485 mov.l &conn tab,Xa1 486 ts;.l Otba1,~J1.w) 487 beq LYbadintrpt ` 488 mov.L OtXa1,%d1.w~,Xa2-489 and.~ & 1793,5RZ(Xa2) # p >sr &= -INTMASK;
490 and.~ &1792,XdO
491 or.w %dO,SR%tXa2) # p->sr ¦= status reg & INTMASK;
492 bset &6,FLGt%a2) X p->fLags ~= EESP;
493 mov.l 4tXa1,Xd1.w),Xa1 X m = conn tabloffset~.msQ;
44 tst.l running # if trunn~ng) {
~ 495 beq LZ130 `~ 496 ~mov.l running,XaQ X ttEE ~)tml1))->interrupted pid =
runninQ->pid 497 mov.l PIDtXaO),EPIDtXa1) 498 cmp.L Xa2,XaO X if (p!=running) {
4~, beq.b LX131 500 ` mov.l t4nsp)+,4~dO`
501 movm.l &Ox0060,-~bsp) ~ save state(runnin~;
502 mov.l XdO,Xa2 503 mov.l XaO,%a1 ~ copy p -> ne~ savestate fm ~ 504 bsr.~ save state .;~
~'`~` '` ' ' ' .
:~
: -lZ53970 ~34-5~5 mov.~ (runnin~->f~aas ~ E.S~) 5~6 btst ~c,FL~Xal) 5G7 Deq.b L~133 508 bsr.~ push rtrq ~ push rtrq(running);
509 br.b L~135 ~ e~se 510 L~133:
511 bsr.~ insert_fifo ~ insert fifo(running);
5 1 2 L,'135:
513 add l ~4 Xsp 514 cmp.b KCD(Xa4),~3 # if (p->k code == (char) GET) 515 bne.b Lh137 516 movm.~ ~Gx0018,-(Xsp) ~ de~iver msg(m,p);
517 bsr.~ de~iver msg 518 br.b L~139 519 L,'137:
520 tst.b ~CDtXa4) X else if (p->k code != (cha-) ~O~ODE) 521 bne.b L-~badintrpt 522 ~ # e~se 523 L~140:
524 mov.l Xa~,-(Xsp) X extract rtrq(p);
525 bsr.~ extract rtrq 526 m~v.~ ~a3,-~Xsp) X insert msg(m,p~;
527 bsr.~ insert msg 528 L~13~:
529 add.l &8,%sp 530 mDv.L Xa4~Xa1 ~ running = p;
531 br L%83 X seLe_t();
~32 X ~ }
533 ~ ~ else C
534 L%131:
535 o .~ XdOr2DtXsp) ~ chan~e saved srt);
536 mDvm.l &Ox0060,-(Xsp) ~ inserl_msg(m,p);
~37 csr.~ insert msg 38 add.L &8,Xsp 539 mDv.L tXsp)~,'a2 ~ rest scratch(); -5~D movm.L (Xsp)l,&DxO30} ~ ~dO^'Xd1~XaD-~a1 541 rte 542 L-'.145:
543 - L%130:
544 clr.L EPIDtXa1) ~tt_E ~)tm+1))->interrupte~ p;d=
~ULL;
545 cmp.b ~Dt%a2),~3 ~ if (p->k cDde == (char) GET) C
546 bne.b L,~badintrpt 547 mov.L ,4~2,running ~ running = p;
548 mDvm.l &OxOD60,-tXsp) ~ oeliver msg(m,p);
54~ bsr.~ deliver msg 550 add.L ~36,Xsp ~unsta-k(fct_s.ackltrap_sta-k saved reg 5~1 mov.l runnins~Xal X sele_t();
552 br L~33 5~4 LXbadintrp~:
mov.l &x interrupt,-tXsp) ~56 bsr re~err 557 ad~.l &12,Xs~
558 b LXschedule 5bO tick:
561 rte ?
` ~
., izS397~) PROGRAM LISTING F

9 M0DULE ~AME : glob.c suBsrsTEM ~AM~- : kernel
11 DATE & TIM_ ~F CREATI~N : %~ ~2:54:00 t2 DATE ~ TIM' OF COMPILATI~N : B5/03/25 16:32:40 13 VERSI~N : 1.8 14 PR~GRAMMER : Andre~ Kun DSCRIPTION : This file cont~ins the definition of the globa~
16 variables of the Kernel.

19 PARAMtTERS RETURNED
20 ~/

22 ~include "local/cx.h"
23 ~include "~oca~/os/vers h' 24 ~include "l oc8 l /os/ eesp.h"
25 Xinclude "local/os/kerntypes.h~

27 Long sys tim~ = 0; t* current tim~ from init */
2B long sys timeslice = 4; /* timeslice allocated for a process */
2 long this cell; t* hardware a W ress of the cell ~/
30 long root~2~; t* dummy root context on cell */
31 PC8 *phtrPHTSIZE~; t* cell process hash table- ~/
32 PCB ~rdynxtlMAXPRI+2'; t* ready-to-run queue next S/
33 PCB *rdylstlMAXPRI+2~; t~ ready-to-run queue - iast ~/
a4 PCB *runnins; /* address of the running PCB */
35 char *heapstart; Y* heap start address */
36 char *heapend; /* heap end address ~/
37 CT conn tabtEVHI+1~, t* external event connect table ~/
38 short suspende~; ~* reschedule flag *~

:;~ ` '` ` ` `
;~ ' y

Claims (8)

THE EMBODIMENTS OF THE INVENTION IN WHICH AN EXCLUSIVE
PROPERTY OR PRIVILEGE IS CLAIMED ARE DEFINED AS FOLLOWS:
1. In a message-based data processing system comprising a processor, a memory store comprising a plurality of processes, said processes communicating with each other by means of messages in a given message format, and a device within said system requiring interrupt-servicing a method of handling an interrupt generated by said device, said method comprising the steps of:
(a) generating an interrupt request when said device requires interrupt-servicing;
(b) providing an interrupt-servicing process within said memory store at a first address;
(c) providing an interrupt notification message within said memory store at a second address, said interrupt notification message being in said given message format;
(d) establishing a connection table within said memory store, said connection table comprising an entry containing said interrupt request, said first address, and said second address;
(e) responsive to the generation of said interrupt request, finding said entry in said connection table corresponding to said interrupt request; and (f) using said first and second addresses to send said interrupt notification message to said interrupt-servicing process.
2. The method of handling interrupts recited in claim 1, wherein said device is located within said processor.
3. The method of handling interrupts recited in claim 1, wherein said device is located within said memory store.
4. The method of handling interrupts recited in claim 1;
wherein said system comprises a peripheral unit, and wherein said device is located within said peripheral unit.
5. The method of handling interrupts recited in claim 1, and further comprising the step of:
(g) using said interrupt-servicing process to control all operations required to be performed to service said interrupt request.
6. The method of handling interrupts recited in claim 1, and further comprising the step of:
(g) establishing said entry in said connection table by said interrupt-servicing process generating a connect primitive comprising information identifying said interrupt request, said first address, and said second address and storing said information in said table.
7. The method of handling interrupts recited in claim 6, and further comprising the step of:
(h) deleting said entry in said connection table by said interrupt-servicing process generating a disconnect primitive comprising information identifying said interrupt request, said first address, and said second address and deleting said information from said table.
8. The method of handling interrupts recited in claim 1, and further comprising the step of:
(g) generating a notification message by said interrupt-servicing process when it has completed servicing said interrupt.
CA000507772A 1985-05-06 1986-04-28 Virtual single machine with message-like hardware interrupts and processor exceptions Expired CA1253970A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US730,922 1985-05-06
US06/730,922 US4835685A (en) 1985-05-06 1985-05-06 Virtual single machine with message-like hardware interrupts and processor exceptions

Publications (1)

Publication Number Publication Date
CA1253970A true CA1253970A (en) 1989-05-09

Family

ID=24937349

Family Applications (1)

Application Number Title Priority Date Filing Date
CA000507772A Expired CA1253970A (en) 1985-05-06 1986-04-28 Virtual single machine with message-like hardware interrupts and processor exceptions

Country Status (3)

Country Link
US (1) US4835685A (en)
JP (1) JPS6211956A (en)
CA (1) CA1253970A (en)

Families Citing this family (66)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5243698A (en) * 1982-11-26 1993-09-07 Inmos Limited Microcomputer
JPH0711779B2 (en) * 1986-02-21 1995-02-08 株式会社日立製作所 Processing target instruction pattern display device
US5301322A (en) * 1986-05-23 1994-04-05 Hitachi, Ltd. System for converting job/process identifiers into processor/process identifiers in transferring data between processes in a multiprocessor system
US5060150A (en) * 1987-01-05 1991-10-22 Motorola, Inc. Process creation and termination monitors for use in a distributed message-based operating system
JPS647231A (en) * 1987-06-30 1989-01-11 Toshiba Corp Parallel processing device for object directional system
JPH0776939B2 (en) * 1988-03-16 1995-08-16 富士ゼロックス株式会社 Communication network system
US5155838A (en) * 1988-04-28 1992-10-13 Kabushiki Kaisha Toshiba Computer system with emulation mechanism
US5201049A (en) * 1988-09-29 1993-04-06 International Business Machines Corporation System for executing applications program concurrently/serially on different virtual machines
US4991089A (en) * 1988-09-30 1991-02-05 Ibm Corp. Method for establishing current terminal addresses for system users processing distributed application programs in an SNA LU 6.2 network environment
US5062037A (en) * 1988-10-24 1991-10-29 Ibm Corp. Method to provide concurrent execution of distributed application programs by a host computer and an intelligent work station on an sna network
US5095420A (en) * 1988-11-21 1992-03-10 International Business Machines Method and system for performing virtual address range mapping in a virtual storage data processing system
US5073852A (en) * 1988-12-16 1991-12-17 Cayman Systems, Inc. Network protocol translator including method and apparatus for reducing interprocess communication and data exchange overhead
JPH02208740A (en) * 1989-02-09 1990-08-20 Fujitsu Ltd Virtual computer control system
US5201052A (en) * 1989-02-10 1993-04-06 Fujitsu Limited System for transferring first and second ring information from program status word register and store buffer
US5038319A (en) * 1989-04-24 1991-08-06 Xerox Corporation System for recording and remotely accessing operating data in a reproduction machine
KR920008461B1 (en) * 1989-05-15 1992-09-30 인터내셔널 비지네스 머신즈 코포레이션 Process interrupting system and its method
JPH0373037A (en) * 1989-05-26 1991-03-28 Hitachi Ltd Data base fault recovering method
JPH0341522A (en) * 1989-07-10 1991-02-22 Fujitsu Ltd Message missing detecting and processing system
US5226160A (en) * 1989-07-18 1993-07-06 Visage Method of and system for interactive video-audio-computer open architecture operation
EP0408812B1 (en) * 1989-07-21 2000-03-01 Hewlett-Packard Company Distributed object based systems
US5404501A (en) * 1989-08-31 1995-04-04 Motorola, Inc. Fault-tolerant method of communicating between processes in a multi processor system by keeping track of the current node location of messages
DE69024753T2 (en) * 1989-10-31 1996-05-30 Hewlett Packard Co Portable, resource-sharing file server that uses common routines
US5392426A (en) * 1989-12-15 1995-02-21 Nynex Corporation, Inc. Method and apparatus for use in program operation, control and control block management and storage
US5197138A (en) * 1989-12-26 1993-03-23 Digital Equipment Corporation Reporting delayed coprocessor exceptions to code threads having caused the exceptions by saving and restoring exception state during code thread switching
EP0460192A1 (en) * 1989-12-26 1991-12-11 Eastman Kodak Company Image processing apparatus having disk storage resembling ram memory
JPH0727505B2 (en) * 1990-02-12 1995-03-29 インターナショナル・ビジネス・マシーンズ・コーポレイション Interface method and interface system
JPH0786839B2 (en) * 1990-02-13 1995-09-20 インターナショナル・ビジネス・マシーンズ・コーポレイション Multitask data processing system
FR2662831B1 (en) * 1990-05-29 1992-08-07 Cit Alcatel METHOD FOR MANAGING A DATABASE NETWORK.
AU639802B2 (en) * 1990-08-14 1993-08-05 Oracle International Corporation Methods and apparatus for providing dynamic invocation of applications in a distributed heterogeneous environment
JPH0776951B2 (en) * 1990-10-30 1995-08-16 インターナショナル・ビジネス・マシーンズ・コーポレイション Computer system, address space sharing system with multiple I / O adapters, and communication management method between multiple I / O devices and computer processors
US5305455A (en) * 1990-12-21 1994-04-19 International Business Machines Corp. Per thread exception management for multitasking multithreaded operating system
JP3496222B2 (en) * 1991-06-25 2004-02-09 富士ゼロックス株式会社 Collaborative work apparatus and method
US5355484A (en) * 1991-08-12 1994-10-11 International Business Machines Corporation Dynamically established event monitors in event management services of a computer system
US5237684A (en) * 1991-08-12 1993-08-17 International Business Machines Corporation Customized and versatile event monitor within event management services of a computer system
US5305454A (en) * 1991-08-12 1994-04-19 International Business Machines Corporation Notification of event handlers in broadcast or propagation mode by event management services in a computer system
US5625821A (en) * 1991-08-12 1997-04-29 International Business Machines Corporation Asynchronous or synchronous operation of event signaller by event management services in a computer system
JPH0831041B2 (en) * 1991-09-06 1996-03-27 インターナショナル・ビジネス・マシーンズ・コーポレイション Program condition processing method and computer system
US5357630A (en) * 1991-10-21 1994-10-18 Motorola, Inc. Name resolution method for a distributed data base management system
US5715474A (en) * 1992-04-30 1998-02-03 Motorola, Inc. Simultaneous control of radio frequency modem in a multi-tasking system using a single session manager program with separate command queue for each application program
US6047122A (en) * 1992-05-07 2000-04-04 Tm Patents, L.P. System for method for performing a context switch operation in a massively parallel computer system
US5625845A (en) * 1992-10-13 1997-04-29 International Business Machines Corporation System for facilitating continuous, real-time, unidirectional, and asynchronous intertask and end-device communication in a multimedia data processing system using open architecture data communication modules
JP2516317B2 (en) * 1992-10-13 1996-07-24 インターナショナル・ビジネス・マシーンズ・コーポレイション Data processing system and method for loading digital signal processor.
US6259446B1 (en) 1992-12-23 2001-07-10 Object Technology Licensing Corporation Menu state system
US5530864A (en) * 1992-12-23 1996-06-25 Taligent Command object system for an object-oriented software platform
US5515491A (en) * 1992-12-31 1996-05-07 International Business Machines Corporation Method and system for managing communications within a collaborative data processing system
US5414848A (en) * 1993-04-01 1995-05-09 Intel Corporation Method and apparatus for sharing a common routine stored in a single virtual machine with other virtual machines operating in a preemptive muli-tasking computer system
FR2704334B1 (en) * 1993-04-22 1995-06-02 Bull Sa Tool for developing an operating system.
JP2900767B2 (en) * 1993-09-20 1999-06-02 株式会社日立製作所 Virtual computer running time interval control method for virtual computer system
EP0667574A3 (en) * 1994-02-14 1997-02-12 Ibm Computer system.
US5553239A (en) * 1994-11-10 1996-09-03 At&T Corporation Management facility for server entry and application utilization in a multi-node server configuration
AU4465996A (en) * 1994-12-07 1996-06-26 Next Software, Inc. Method for associating data bearing objects with user interface objects
US5926833A (en) * 1997-03-24 1999-07-20 International Business Machines Corporation Method and system allowing direct data access to a shared data storage subsystem by heterogeneous computing systems
US6078747A (en) * 1998-01-05 2000-06-20 Jewitt; James W. Application program interface to physical devices
US6427177B1 (en) * 1999-10-04 2002-07-30 Ati International Srl Method and apparatus for configuring multiple devices in a computer system
EP1329097A1 (en) * 2000-10-17 2003-07-23 Koninklijke Philips Electronics N.V. Method of controlling an arrangement of hardware components
US6820268B2 (en) 2000-10-30 2004-11-16 Next Computer, Inc. Method for associating data bearing objects with user interface objects
US7191440B2 (en) * 2001-08-15 2007-03-13 Intel Corporation Tracking operating system process and thread execution and virtual machine execution in hardware or in a virtual machine monitor
US7386608B2 (en) * 2002-07-30 2008-06-10 Brocade Communications Systems, Inc. Fibre channel switch that aggregates registered state change notifications
US8320241B2 (en) 2002-07-30 2012-11-27 Brocade Communications System, Inc. Fibre channel network employing registered state change notifications with enhanced payload
US7181744B2 (en) 2002-10-24 2007-02-20 International Business Machines Corporation System and method for transferring data between virtual machines or other computer entities
JP4012517B2 (en) * 2003-04-29 2007-11-21 インターナショナル・ビジネス・マシーンズ・コーポレーション Managing locks in a virtual machine environment
US7130949B2 (en) * 2003-05-12 2006-10-31 International Business Machines Corporation Managing input/output interruptions in non-dedicated interruption hardware environments
US20070168872A1 (en) * 2006-01-19 2007-07-19 Raytheon Company Multi-monitor, multi-JVM java GUI infrastructure with layout via XML
US7653794B2 (en) * 2006-05-08 2010-01-26 Microsoft Corporation Converting physical machines to virtual machines
US9798567B2 (en) 2014-11-25 2017-10-24 The Research Foundation For The State University Of New York Multi-hypervisor virtual machines
US11016798B2 (en) 2018-06-01 2021-05-25 The Research Foundation for the State University Multi-hypervisor virtual machines that run on multiple co-located hypervisors

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2253421A5 (en) * 1973-11-30 1975-06-27 Honeywell Bull Soc Ind
US4325120A (en) * 1978-12-21 1982-04-13 Intel Corporation Data processing system
US4413318A (en) * 1980-11-20 1983-11-01 International Business Machines Corporation Use of nodes to uniquely identify processes
US4475156A (en) * 1982-09-21 1984-10-02 Xerox Corporation Virtual machine control
US4631674A (en) * 1985-02-05 1986-12-23 International Business Machines Corporation Active wait
US4649479A (en) * 1985-02-28 1987-03-10 International Business Machines Corp. Device driver and adapter binding technique

Also Published As

Publication number Publication date
US4835685A (en) 1989-05-30
JPS6211956A (en) 1987-01-20

Similar Documents

Publication Publication Date Title
CA1253970A (en) Virtual single machine with message-like hardware interrupts and processor exceptions
US5060150A (en) Process creation and termination monitors for use in a distributed message-based operating system
EP0274406B1 (en) Self-configuration of nodes in a distributed message-based operating system
US4694396A (en) Method of inter-process communication in a distributed data processing system
US4754395A (en) Network interface module with minimized data paths
US5047925A (en) Logical ring in a virtual single machine
US4914583A (en) Method of indicating processes resident within a cell of a data processing system
AU2004220640B2 (en) System and method for dymanic ordering in a network processor
US5566321A (en) Method of managing distributed memory within a massively parallel processing system
US5859981A (en) Method for deadlock-free message passing in MIMD systems using routers and buffers
US5226172A (en) Methods for configuring and performing 3-level password searching in a distributed computer system
EP0201063B1 (en) Method of locating processes in a distributed data processing system
US4855899A (en) Multiple I/O bus virtual broadcast of programmed I/O instructions
JPH10307732A (en) Message transmitting method
Dally The J-machine system
EP0201065A2 (en) Virtual single machine with logical ring and with message-like hardware interrupts and processor exceptions
EP0274413B1 (en) Process traps in a distributed message-based system
CA1260152A (en) Logical ring in a virtual single machine
EP0689138A2 (en) Temporary data method and apparatus for a microkernel data processing system
Wills et al. Pica: An ultra-light processor for high-throughput applications
Kepecs et al. SODA: A simplified operating system for distributed applications
EP0201064B1 (en) Computer system with data residency transparency and data access transparency
Maginnis Design considerations for the transformation of MINIX into a distributed operating system
Shoja et al. A control kernel to support Ada intertask communication on a distributed multiprocessor computer system
van Dijk The design of the EMPS multiprocessor executive for distributed computing

Legal Events

Date Code Title Description
MKEX Expiry