Home

SUN User`s Guide

image

Contents

1. ThisTick emt ticks 11 DECEMBER 1981 SUNUSERS GUIDE 11 DECEMBER 1981 THE SUN GRAPHICS SYSTEM 3l 4 The SUN Graphics System The SUN graphics system is a high resolution bit mapped frame buffer on one Multibus board The general organization of the graphics board is illustrated in Figure 4 1 There is only a small amount of hardware assistance to perform the simple high bandwidth operations called RasterOps This results in a simple yet flexible graphics device with high enough performance for sophisticated user interfaces Bit Manipulation X Y Addressing Hardware Graphical Object Cache Next Address Generation Graphical Object Selection Software Function Selection Host RasterOP Frame DS Video Processor Hardware Buffer Monitor RasterOP unit performs read modify write cycle Destination in frame buffer Source operands can come from frame buffer or host computer Figure 4 1 The SUN Graphics Doard 4 1 Graphics on the SUN workstation As shown in Figure 4 2 the nominal viewable area of the screen is 1024 pixels high and 800 pixels wide in portrait mode similar to the Alto display Other configurations like the Xerox Large Format Display are also possible with appropriate changes to PROMs on the graphics board The Large Format Display is 808 pixels high and 1024 pixels wide This display is compatible with the display used in the Xerox Star 8000 and Dolph
2. 27 The CV ConVert command will display both hex and decimal Vales of its argument Preceding the argument with amp or nothing denotes decimal with hex The printout observes these two conventions Thus m 45 5 2D 45 You may evaluate a sum of two numbers us using as infix pus as in CV 45 3 30 amp 48 This does not work for ni for three elements at once do it in stages 5 6 Symbol Tables m Symbols are generated and loaded automatically along with the program They reside in the region from 6BA to FFF To print out the symbol table type SY see the section earlier on dealing with symbols from MACSbug Loading a new program destroys the old symbols that s the best we can do with MACSbug sorry Sometime an option vill be installed you to 7507 d files without symbols to prevent this problern Resetting MACSbug also appears to make the symbol table go away This is much less destructive than reading in another symbol table however All that needs to be done to restore the invisible symbol table is to set the word at 576 remember this as 24 squared even though 576 is really hex to the first empty word of the table which can be found by printing out the table itself The starting address of the table will be found in 576 and in 572 since this is the pointer to the first free table entry when MACSbug thinks the table is empty this pointer coincides with that pointing to the beginning o
3. Alto telnet host Pup user telnet also based on the chat program Simulates a simple screen terminal on which vi almost works Also available as a boot file Alto talk host The talk program gives you multiple windows stacked vertically and you can run emacs or vi in them so it is currently the default for Unix telnet servers You can create a window of 52 lines and then specify term bigtalk to Unix to get a big screen Alto dmchat host Another terminal program using Pup telnet protocol based an the Chat program This one gives you one big datamedia window which works well with Sail If you are using dmchat tell Unix you are a dm2599 You must have the fixed width font snail 0 al on your disk for this to work or an entry on your user cm Sai dial diablo 11 DECEMBER 1981 46 U7 U7 SUN USERS GUIDE CERAS LOTS 2 2060 Durand 1 ISL T 23033 2060 2 Alto CIT b 1080 2060 Via Crespi f 13 Alto IR Alto MJH 2 Jordan SUN Alto B CSD 4 Dolphin Psych SUN Pine G M H l F all temp R R Proposed Gatevvay CIS Alto Tip R Campus Drive G R Dolphin R Repeater Stanford Ethernet 8 Gateway Proposed Extensions SUMEX 2020 Alto Figure 6 1 Topology of SUNet Simple 1200 baud serial line to Diablo Loses characters routinely Use only when all else fails whic
4. In versions of SunMon that support ethernet bootstrapping the console also uses the Multibus Ethernet interface In any case all I O is done using busy waits and the code runs at the highest interrupt priority Therefore if a user program is interrupted with the Break key on the console terminal or with some other exception the monitor will run correctly unless its global data area has been damaged Also if the user program is then continued it should be unaffected by the interruption save for the possible loss of some I O 5 i 3 1 2 Absolute Rules From the preceeding section it should be fairly obvious that one major rule is necessary to prevent a monitor crash do not trash the refresh routine or monitor globals In general thc first two pages of memory are reserved for the monitor and should never be written by user programs however user code may want to change exception vectors occasionally t is legal to change any exception vector except the Level 7 11 DECEMBER 1981 USING THE SUN PROCESSOR FF 17 Autovector at x7C used for refresh timing and any User Interrupt Vector between 0x100 and 0x3FF inclusive The refresh routine and monitor globals livc in the region reserved for User Interrupt Vectors because the Sun processor board does not support their use Certain other exception vectors for example the vector for a Breakpoint trap are used by the monitor However it may
5. TRAP a TRAPV overflow v was taken l Pr 1 Privilege vio violation attempt made to execute te privileged instruction while in user state UO Unimplemented 0 an opcode 1010 was executed emulator trap m e Unimplemented 1 an opcode 1111 vvas executed emulator trap Un trap was made to unassigned vector Li L2 L3 L4 L5 L6 Interrupt Autovector an Autovectored interrupt was taken at one of levels 1 through 6 Tr Trap a trap instruction was executed Several exceptions handled specially by the monitor A breakpoint trap instruction trap 1 causes the message Break at pc to appear A trace trap evokes the message _ l DECEMBER 1981 26 i SUNUSERS GUIDE Trace trap at pc to appear Use of the Dreak key causes Abort at pc to appear In cach case the pe shown is that of the next instruction to be executed For further information on the use of these three traps see section 3 7 A Bus Error trap usually caused by attempting to access non existant memory or devices gives the message Bus Error address access address at pc Similarly an Address Error trap usually caused by attempting to access a vord vvith an odd ald sa causes the monitor to print Address Error address access address at pc In either case the access address i is useful in helping to determine the cause of the trap Itis possible to continue from these traps s
6. nobody here has ever figured out how to use it Motorola 6850 Asynchronous Communication Interface Accessory This is the device that connects your terminal to the Design Module and the Design Module to a computer Alinost everybody else calls it a UART Definitions for the SUN Multibus Ethernet interface Vaughan s version of the definitions for the memory map on the 68000 processor board Please complain to him about the duplication with pcmap h and noprotect h Definitions for the NEC 7201 double UART This is what connects your terminal on the SUN board to the Motorola 6850 More stuff for the NEC 7201 UART like the aad cesses and some uii macros It is so complicated it takes two files Yet memory map file This one defines the protection codes Complain to Vaughan about the strange name Jeffs version of the memory map definitions Please complain to him about the duplication this and d map h and noprotect h Defines a macro for interrupt Please complain to Vaughan about the strange name Definitions for the Signetics 2651 UART This is the chip used on our octal UART boards Defines some symbols for the 68000 status register Some undocumented definitions for some kind of Unix like standard 1 0 Complain to 5 Vaughan t to 250 it Defines the emt codes supported by the SUN Prom monitor Sorte macros for manipulating the old wire wrap nian of the memory map Complain to
7. 1980 8 J L Hennessy Pascal Tech Rept Computer Systems Laboratory Stanford University 1 1980 9 G Kane 68000 Handbook Osbourne MeGraw Hill 1981 10 G Kane D Hawkins and L Leventhal 68000 Assembly Language Programming Osbourne McGraw Hill 1981 11 K A Lantz Perseus Rising Stanford University Computer Systems Laboratory 1980 12 MC68000 Design Module User s Guide 1979 MEX65KDM D2 13 MC68000 16 bit Microprocessor User s Manual 1980 MC68000UM AD2 14 William M Newman and Robert F Sproull Principles of Interactive Computer Graphics McGraw Hill 1979 15 D M Ritchie and K E The UNIX system Bell System Technical Journal 57 6 1978 1931 1946 16 W Yundt Gudman Report of the Study Group on Networking Stanford 007 Center for Information Technology January 1981 Perpared for the Task Force on the Future of Computing at Stanford 11 DECEMBER 1981 INDEX Index 2651 10 6821 9 6840 9 6850 10 7201 10 9513 10 Abort 17 26 ACIA 10 43 Alto 45 As68 7 Ascii 47 Assembler 7 Bout 5 9 Bootstate 24 Break key 17 Breakpointtrap 19 25 26 Byte order 5 0 5 11 13 CLibrar 11 Calling Sequence 13 Calloc 57 0068 37 Checksum 4 Compiling 5 Console 11 28 0 Context Register 17 28 Control characters 9 Debugging 39 Design Module 8 9 10 37 Diablo 3 Directories 3 Di68 9 Down load file format 14 Down line loading 9 21 37 E
8. Jeff to o get rid of this Simer macros to do storage allocation of fixed size objects Complain to Vaughan about the strange name Some more definitions for the SUN processor board timer Sec also amd9513 h Some symbols defined for the MC68000 interrupt and exception vectors 11 DECEMBER 1981 SOFTWARE DEVELOPMENT ON UNIX 2 4 Libraries Some 68000 libraries are stored in the directory usr sun lib in the form of archives compiled and assembled as b files The standard ar program as described in the Unix manual is used to manipulate these archive files The 6668 command normally searches the library usr sun 11b 11bc a automatically Some of these functions are similar to the standard C library but others are still under development The sources should all be under usr sun src 11b or usr sun src 11bc 2 4 1 The C Library In the interests of greater portability of low level code between the deien module and the SUN processor some board independent I O functions have been written and installed in Tibc a Any references to putchar printf and getchar for example will invoke functions to perform the I O on the console terminal Similarly getenv will behave rather like its Unix counterpart with getenv TERM 25 sun etc There is also a set tof lower level functions in the standard C library The device types are determined at link time by supplying the appropriate set of routines e
9. Per space all storage is reclaimed by Malloc when a space is abandoned contains no further viable processes i deos Per stack Each space may contain any number of processes these are freed by the process s physician when the process is terminated for any reason as are other patient resources known to the physician such as Stream pour Per frame No fixed scheme i is prescribed here rather each exception handler i is pet to understand its patient s conventions concerning stack use A C68 dependent convention will be to use two sources of information the add to stack pointer instruction produced by the C68 compiler after each call and the link instruction at the entry to each function Either of these uniquely determine the number of parameters and together they provide consistency check on each other in the event a6 or the stack has been badly damaged or a nonstandard calling sequence has been used without telling the exception handler A significant advantage of this approach is that it does not commit itself unbendingly to a particular choice of calling sequence New calling sequence conventions may require rewriting of but do not affect calloc itself 7 5 7 The Calloc Process Model Calloc has a conception of a process appropriate to Calloc s duties Calloc divides it its notion of the state of the into data state and control state components _ The data state components are e a value for the SID
10. The function an imate patpc patsp patsba phypc physp sid requests Calloc to add to its list a process with the given pc sp values for patient and physician and sb for patient a zero cc for cach a zero patient error status and a control statc of slecping patient Animation The function s eep requests Calloc to put the requesting process to sleep When the process is reawoken later its cpu registers 40 47 and a0 a6 may have changed but the pc sp cc values will be preserved Sleep The function terminatc requests Calloc to terminate the requesting process Calloc does not consider the issue of returning the stack and streams to free storage Termination 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM m 6 Status The physician may use the function status to extract from Calloc the entire state of the patient This information is returned to the physician in registers d4 pc d5 cc error status space size d6 sp and d7 sb In addition the physician is granted read and write access to the patient s space This access is revoked on resumption of normal processing Use of status by the patient counts as an error Run Single Step The physician may use the function run to return the process from suspended to normal status Calloc restores only the patient s pc sp cc it is the physician s responsibility to restore the other registers Calloc also restores the access control to this space in force at t
11. 2 1 Organization of SUN directories Common SUN software is stored in subdirectories under one master directory For example on the Stanford VAXcs Shasta and Diablo this directory is usr sun The following is a description of these subdirectories using the notation relative to usr sun or whatever it happens to be called on your system Every source file should contain a comment near the begining describing the author date and purpose of the file JF admin vootfile dm lib dm include doc JA doc graphics include man68 Administrative records and a wishlist Binary files for Sunix commands Complain to Vaughan about documenting Sunix Standard boot format files The production copies of stand alone programs reside here This is the default directory for the SUN boot server Test versions are put in the ODONIS test not in the main directory Files to support the Motorola Design Module Includes d1 format files of some programs that run on the design module Read chapter 5 for more information on the Support for the design module n files specific to the eee module Header files specific to the module documentation The document you are reading now resides here Some other documentation exists in subdirectories of this 0 of a Raster op level graphics package Header files used by the include directive of the C preprocessor See sectio
12. Design Module 5 1 Preparation of Programs 52 Compilation 5 3 Down line Loading 5 4 Running 5 5 Debugging Aids 5 5 1 Display 5 5 2 Setting 5 3 Breakpoints 5 5 4 Tracing 5 5 5 Trace Display 5 5 6 Symbols 5 5 7 Numeric conversions 5 6 Symbol Tables 5 7 Disassembly 5 8 P2 tA 5 9 Memory Layout 6 An Insider s Guide to SUNet 6 1 Remote Terminal Programs 62 File Transfer Programs 6 3 Walk Net Tape transfer 7 SUNOS A Small Operating System 7 1 Process oriented Services 7 1 1 External Processes 7 12 Internal Processes 7 1 3 Patient services 7 1 4 Physician services 7 2 Stream oriented Services 7 3 Performance Services 7 4 Performance Characteristics of Present 68000 Implementation 7 5 Calloc A CPU Allocator for the Motorola 68000 7 5 1 Overview 7 52 Machine Dependencies in Calloc 7 5 3 Calloc Duties 7 5 4 Calloc Nonduties 7 5 5 Requests to Sleep 7 5 6 Cleaning Up 7 5 7 The Calloc Process Model 7 5 8 Control State Transitions 7 5 9 Calloc Services 7 6 The Edit String Protocol 7 6 1 The Edit String Data Structure 7 62 Reference 7 6 3 Locating Block Headers 7 6 4 Asynchronous Access 11 DECEMBER 1981 SUN USERS GUIDE TABLE OF CONTENTS Index 11 DECEMBER 1981 m TN IV 11 DECEMBER 1981 SUN USERS GUIDE LIST OF FIGURES List of Figures Figure 1 1 Figure 2 1 Figure 3 1 Figure 3 2 Figure 4 1 Figure 4 2 Figure 4 3 Fig
13. although the apparent effect of the faulting instruction is not 257 defined User Interrupt Vectors locations 0x100 through Ox3FF are not available for use as such on the SUN board due to the hardware design For this reason this area of memory is used by the ROM monitor for storing globals and the RAM refresh routine 3 7 Tracing programs The monitor provides several facilities for tracing program execution They are quite primitive however and basically require you to understand your program at the machine code level However if you have a symbol table isting of your program n created using nm68 you will be able to at least know where each routine starts 3 7 1 Breakpoint traps The use of a Breakpoint trap BPT allows to run a program and regain when execution reaches a certain location The monitor currently can only maintain one breakpoint trap at a time A breakpoint trap is sct using the B command after giving this command you will be given the address of the previous and prompted for a new address For example Break 0010007 means that a is already set at location 1000 At this point you could type a 0 to clear the BPT a return to leave things as they are or a new address at which to set a trap the old trap will be cleared Tf you had gained Tod of your program before setting the trap by using the Break key you might want to continue it using the C command Other
14. and calls the main function ofa program Emulator traps into the PROM monitor General functions This includes string manipulation string conversion etc Standard IO functions Currently this all goes through the terminal line stc libc sunstuffSUN Processor specific part of the library Isn t all this stuff Please complain to vaughan aboutthis 5 stc libe test Floating point tests Has anybody ever used this stc libc unixstdio Some Unix stdio stuff never used for anything J src monitor PROM Monitor sources Complain to Jeff that the up to date versions are kept in his private directory instead of the proper place Jsrc mut Multi user Pup Telnet This is the program that runs on Ether Tips and in a multi window terminal program located in src tty src tty Multi window terminal program Junix68 Nu terminal Unix from MIT Optional We should put the LucasFilms Unix there someday if we ever get it 11 DECEMBER 1981 SOFTWARE DEVELOPMENT ON UNIX mE m 5 2 2 Unix Commands Relevant to 68000 Software The following Unix commands are used for MC68000 software development All of them are documented in chapter 1 of the Unix manual This listing may be obtained using the Unix command apropos 68 as68 1 Assembler cc68 1 General C command ccom68 1 Portable C compiler ddt68 1 A symbolic debugger and disassembler _ dix 1 Down line load protocol handler 616
15. be possible to alter these without dire results Any program altering the refresh routine and interrupt vector must take responsibility for doing proper memory refresh One other rule is important user programs should not modify the Context Register directly but should use the facilities described in section 3 8 3 2 Getting Started 3 2 1 Initializing the Workstation The first step in using the SUN processor is making sure it is turned on There is probably a switch labeled ON and OFF It will work better if the power switch is in the ON position Version 2 processors have a power light on their control panels A terminal should be connected to the communications cable extending from the processor If you have a serial line to a host computer available it should also be connected to the communications cable Finally if an ethernet interface is present it should be connected to an ethernet transceiver cable There is one switch labeled Reset it may actually be a power on off switch Pressing and releasing the Reset switch should be done after initial power up of the machine and whenever you want to really reset everything After a few seconds the monitor should identify itself on the console terminal with a message looking like Sun Network Monitor Version 0 9 0 20000 bytes of memory The word Network may be omitted certain commands pertaining to the ethernet only work with network monitors If this
16. if you want to be sure of l checksum errors C This option ie ignores checksums Useful only on rare occasions With all ptions your command would look something like RE 411 5 4 Running foo di To run the program type G 1000 to MACSbug If the program terminates Boris it will type an asterisk the 2 prompt to indicate that it has returned to MACSbug If G is given without an argument execution starts with the virtual PC contents of location 400 see below This permits an interrupted program to be restarted from where it was interrupted 11 DECEMBER 1981 THE MOTOROLA 68000 DESIGN MODULE B 39 5 5 Debugging Aids MACSbug offers debugging facilities that are moderately well documented in the design module manual Here are the highlights 5 5 1 Display You may display the contents of any register merely by typing its name Names are PC SR SS US DO Di 07 0 A1 A7 You may see all D registers by typing D and similarly for A To Display Memory type DM address in hex all values are in hex The 16 bytes starting with that location are typed out To see more than 16 supply the number as a second argument Thus DM 1200 100 will fill most of your screen with bytes 1200 to l2FF The memory values you display are real but the register values are virtual The register values are those that held when your program was last interrupted they are kept in memo
17. message does not appear and the halt light is not lit check the terminal s status and connection Ifthe halt light is lit and if repeated use of the Reset switch has no effect your hardware may be broken The Reset operation will probably destroy the contents of memory Pressing and releasing the Break key on the console terminal switch causes a trap also known as an Abort to the monitor so that debugging commands may be given You may continue an aborted program see the C command described in section 3 3 11 DECEMBER 1981 18 SUN USERS GUIDE 3 2 2 Some Sample Programs The following are some useful programs available in the default bootfile directory Most of their sources are in appropriate subdirectories of usr sun They all can be loaded and started with the name command of the monitor Note the locations of source files here are all wrong cy14 edp ka1 memtest 5 monhelp rect sunbfd suntty tip tty short program that displays four circles that move diagonally on the screen A good example of simple animation Runs only with a frame buffer of course simple ethernet diagnostic program Source is in usr sun diag edp You might have to load the d1 version if your ethernet 15 not 707 A kalidescope program originally vvritten in BCPL for the Alto and transeribed into C Really impressive graphics demo for the frame buffer Source is in usr sun demo A
18. pman c is too trivial to be really robust the calloc c facilities as described in section 7 5 support much more robust process managers Sunos implements processes virtual concurrency stream based interprocess communication and storage management for the Motorola 68000 computer Although the design was done specifically for the 68000 to avoid all compromises that portability considerations might have entailed the semantics of the resulting product turned out to depend only on a few architectural features common to many computers namely the existence of program counter Stack pointer and status register and the use of interrupts to schedule external processes This overview considers Sunos from a perspective midway between that of a user and an implementor Implementors sometimes have presenting a users view too soon after completing the implementation Sunos 2 the following services 7 1 Process oriented Services Processes provide virtual concurrency process may be defined to be a stack including its current contents with the current state of the processor Processes fall into two internal and external distinguished by how they are scheduled by Calloc the Cpu ALLOCator 7 1 1 External Processes m External processes are scheduled by interrupts and are not even known about by Calloc They run in system state prcempting the CPU when their interrupt occurs Each external process is
19. problem of independently setting and clearing control bits for arm and disarm The user need not keep track of the bits The of een id is that the line is busy for whatever reason whether no carrier no DTR no CTS or reception transmission Proceeding Itis assumed that all operations will be with 8 data bits 2 S bits andn no parity bit No Boon K made for detecting UART errors t may be reasonable to attempt low level error correction detection in lineget and possibly lineput however this should not be considered a substitute for higher level error checksums on downloading perhaps use of Dialnet 2 4 2 The PUP and Leaf Libraries The PUP 5 library is stored in usr sun 1ib 1 ibpup a Since TOM routines are all described in section 9 of the Unix manual available online with the 9 command they are not described in detail here 6668 will search this library if it is given the 1 pup option The 1 leaf n on a cc68 will search the leaf library stored in usr sun 1lib 1 ibleaf a Leaf is a remote file access protocol based on the Sequin reliable packet stream protocol There are Leaf servers running on most large timesharing machines Documentation of the library is jn usr local doc leaf LeafUser press Shasta 11 DECEMBER 1981 SOFTWARE DEVELOPMENT ON UNIX 13 2 4 3 The SUNOS Library The SUNOS library is stored in usr sun 1 1b 11bsunos a and can be searc
20. responsible for restoring the CPU to its original state on exit External processes communicate with internal processes via shared memory The stream services are available to them but they may also use more block oriented forms of communication 11 DECEMBER 1981 2 SUN USERS GUIDE 7 1 2 Internal Processes Internal processes share the processor under the control of Calloc a round robin preemptive scheduler An internal process may voluntarily surrender the Cpu at any time otherwise at the expiration of its time quantum the Cpu will be preempted Internal processes have two components whimsically called the patient and the physician The patient is the normal part of the process while the physician acts as exception handler The physician permits diagnosis and debugging of erring processes and is also responsible for preemption permitting individual implementations of both blocking and nonblocking mutual exclusion methods that the process may need to survive with Calloc s asychronous preemptive scheduling This does not needed for Sunos S Stream facilities which incorporate their own 2 mutual exclusion 7 1 3 Patient services spawn p n sl sn spawn process p with n streams sl sn wait p wait until p holds non busy waiting terminate terminate this process error e commit errore Medium level atomicity is Bo provided for The patient may at its option n run 00 for a l
21. section 3 8 and intelligent console facilitics Although the last may be the most visible the first two are the most important the processor would be essentially unusable without them When the processor is reset either when the Reset switch is hit or when the power first comes on SunMon gains control It initializes the on board I O devices timers and UARTS sizes memory sets up the Segment Table and Page Table initializes the parity state of the on board RAM creates the RAM refresh routine and initializes the interrupt and exception vectors After this control is transferred to a module that _ manages the console functions Memory refresh is done by the processor because it actually does not cost anything in terms of performance and because it greatly simplifies the hardware design The memory is refreshed by simply reading 128 consecutive words every 2 milliseconds some memory chips may nced slightly different refresh rates This is done by executing a routine consisting mostly of NOPs This routine is stored in RAM and so a malfunctioning program may damage it and thus cause havoc since the contents of memory will be lost The console functions are implemented with fairly straightforward routines that communicate with the user via the two on board UARTS If a Frame Buffer is available the monitor will use it for output instead of the console UART command are still entered via a keyboard connected to the e UART
22. start a file via the Ethernet The program can be started with the command Normally the current PC is set to the entry point of the loaded program Of course this command is only available on network monitors G addr Start the program by executing a subroutine call to the address addr if given or else to the current PC H a minimal amount of help will be given just a short list of commands On network 11 DECEMBER 1981 I mode _ SUN USERS GUIDE monitors this actually involves boot loading a help program via the ethernet If the ethernet interface is not working no help is available set UART operation mode A means your terminal talks to the monitor D means your host computer talks to the monitor not very uscful if directly invoked and means that you talk to the computer Transparent mode until you hit the transparent mode escape character initially set to control shift six or control up arrow followed by a c S toggles the use of the Frame Buffer as the console output device i e it selects it if it is not being used and selects console UART otherwise The S option has no effect if there is no Frame Buffer present Soft Reset resets the monitor stack and the default escape character Useful after exceptions or other anomalous situations This may confuse the monitor if a breakpoint trap is set L Host command This sends Host command to the host computer does an implicit I B a
23. to Sleep A process temporarily held up by lack of input or unavailability of some resource may temporarily surrender the CPU Calloc It does not get it back until all other processes have had a turn This is synchronous sleep as such it may not be necessary to save all the CPU registers Where the cpu changes hands frequently say every 100 microseconds or less the affected processes will arrange to minimize context switching overhead e g by replacing while fcondition pushstate sleep popstate with if Icondition pushstate do sleep while condition popstate and treating functions containing sleep as though they declared all of d2 d7 and a2 a5 a trivial mod to the compiler saving any given register across the largest block containing the sleep but not containing a reference to that register 11 DECEMBER 1981 e SUN USERS GUIDE 7 5 6 Cleaning Up The following approach is proposed for having physicians clean up There are three granularities of storage involved space stack and frame A space is defined by the 68000 board s SID Space ID register spaces protected from each other except when they overlap as when sharing for interprocess communication and related purposes Stacks are associated with processes each process has two Stacks one for normal use and a small one normally inaccessible for the physician Frames are as defined by the C68 compiler see section 25 50
24. to provide other communications media for the intermediate distance needs like 10 Mb standard Ethernet Fiber optics point to point serial links packet radio or a broad band cable TV compatible system The rough topology of the network is illustrated in Figure 6 1 For more information see the references uL and 116 This information is really quite volatile so it is imperative that this chapter be kept up to date Each description below consists of the computer you want to come from followed by a colon and the command that invokes the given program ort x includes the hosts you can go to with that program 1 Remote Terminal Programs VAV telnet host Pup user telnet 5 to any Pup host with a telnet server running Currently this means Shasta Diablo Helens Lassen DSN and Sail When the gateway is working you can get to Sumex and Tiny the 2020 at the Medical Center Documentation is obtained with the man telnet command Telnet has transcript and shell escape options Type code 036 followed by c to get out usually control t or control shift N Pup telnet has gateway capabilities to the Arpanet If the host name you give is not in the PUP network directory or there is no PUP route known to it it will connect to the telnet gateway at Sail and try the _ Arpanet Sail chat Pup user telnet as above Control meta q to get out Currently it simulates a very simple terminal so you can t even do things like backspace
25. to the state of the patient e Protection of the physician from the patient s illness e Invisibility of the physician to the patient e A single step facility to help the physician diagnose and or treat the patient Control is passed from the patient normal status to the physician suspended status when an error occurs _ Physician access to the patient is straightforward for all of the patient except its pc sp cc error state and space size To obtain this information a system call to Calloc is provided which returns this information in five CPU registers This call also grants the physician read write access to the patient s memory Protection of the physician from the patient is implemented by allocating a portion of the space to the physician and denying write access to those pages while in normal status physician whose writable memory fits in one page QK bytes will require Calloc to access only one map entry for each change of status Physician invisibility is achieved by denying the patient any read access to the space the physician writes in the motivation being for the patient not to see mysterious variations in memory Seeing or even executing the physician s code is permissible provided the code remains fixed The physician should not use the patient s stack in place of its own except where it makes arrangements to completely erase all traces of its presence before returning to normal status 7 5 5 Requests
26. 168 command or the d flag of cc68 Files in this format usually have a d1 extension Suppose the file we want to load is called test d1 Assuming that you have used transparent mode to log into the host computer and have set your working directory properly you should then escape from transparent mode Then issue the command L dix test d This will transmit the command d1x test d1 to the host and then cause the monitor to accept future commands from the host If all goes well you should see a string of periods on your terminal and then a monitor prompt when the load is done You may then start your program with the G command normally the current PC is set by the downloader to be the entry point of the program If the new monitor prompt comes immediately this means that the dTx program detected an error and your program could not be loaded probably because it could not be read If the periods stop coming one should print every few seconds this means that the loader has hung You should hit Reset or the Break key change to transparent mode and type control C or your normal interrupt character to abort the d1x command You may also have to issuc the Unix reset command to put your terminal line back into a normal mode 11 DECEMBER 1981 n mE SUN USERS GUIDE Attempting to down line load a file not in S record format will probably cause strange behaviour although the d1x program attempts to detect this err
27. 8 1 Download file generator 1468 1 Linking loader lorder68 1 Object library utility nm68 1 Print name list of object files o68 1 optimizer for assembly language pc68 1 Pascal compiler similar to cc68 pr68 1 print extended statistics on b file rev68 1 reverse byte order b and 68 b out files r168 1 print relocation commands in a b file sizc68 1 prints sizes of segments in a b file 221 Compiling with CC68 These commands are meant to mirror the standard Unix commands without the 68 suffix For example the normal C command is cc and the coresponding MC68000 command is 6668 This is the command most users will be concerned with Its function is to take the files named as arguments and do whatever needs to be done to make them into a runable program For cc68 to work properly you should follow some simple naming conventions File names should consist of a short module name by a suffix consisting ofa dot and one or two letters The are listed below 6 language source programs These are peri in and edited by theu user with any Pascal or regular Pascal source files See the Pascal reference manual 8 for a description of the language ah Header files usually consisting of declarations and macro definitions which are accessed by the include directive Some useful header files are described in section 2 3 SS Assembly language files p
28. DRAFT Edit Me SUN User s Guide 11 December 1981 Editor W I Nowicki Contributions by J C Mogul and V R Pratt Copyright 1981 Stanford University TABLE OF CONTENTS Table of Contents 1 Introduction 1 Intended Audience 1 2 Related Documentation 2 Software Development on Unix 2 1 Organization of SUN directories 22 Unix Commands Relevant to 68000 Software 22 1 Compiling with CC68 2 2 2 The 68000 Assembler 2 2 3 The 68000 Linker 2 2 4 Producing Loadable Files 2 3 Header Files in usr sun include 2 4 Libraries 24 1 The C Library 2 4 2 The PUP and Leaf Libraries 24 3 The SUNOS Library 2 5 The 68000 C and Pascal Calling Sequence 2 6 The S Record Down Line Load File Format 3 Using the SUN Processor 3 1 Introduction to the SUN ROM Monitor 3 1 1 What is the monitor 3 1 2 Absolute Rules 32 Getting Started 32 1 Initializing the Workstation 3 22 Some Sample Programs 32 3 A Simple Example 3 3 The ROM Monitor Commands 3 4 Loading Programs 3 4 1 Down line Loading 3 42 Net loading 3 5 Memory Mapping 3 6 Traps 3 7 Tracing programs 3 7 1 Breakpoint traps 3 7 2 Trace traps 3 8 Emulator Traps 3 8 1 Information EMTs 3 82 I O EMTS 3 8 3 Memory Management EMTs 4 The SUN Graphics System 4 1 Graphics on the SUN workstation 4 2 Detailed Operation of the Graphics Board 11 DECEMBER 1981 2 u 5 The Motorola 68000
29. LL OPERATING SYSTEM 49 7 SUNOS A Small Operating System SUNOS isa compact operating system for the Sun workstation t manages asynchronous processes the memory interprocess communication Process Services spawn function argcount arg1 arg2 spawn new process with stream args wait p wait till p holds non busy waiting terminate terminate this process Stream Services char getc r char r get char from stream r getcto r v char r v get from stream r into char v putc c w char c w putchar on stream w int emptyc r char r predicate stream ris currently empty char cstream create a char stream and return its writer Corresponding stream services exist for other types of streams namely short integer and reference for which the respective abbreviations s 1 and are used in place of c character Storage Services char create n create reference to start of new n byte buffer char dupref p char p duplicate reference p dispose p char p dispose of reference p The put and get primitives use ordinary char reference variables Thus to permit two processes talk to 11 DECEMBER 1981 2 S N USERS GUIDE each other use cstream twice to produce two references one pointing into each of two new streams and then apply dupref to each reference to produce two more references for reading from those streams Processes ma
30. Space ID register determining which region of the memory map the process has access to pc sp cc values program counter stack pointer condition code register for each of the physician and thc patient 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM _ 6 e thc patient s error status The SID register value is determined by Malloc who may also change it Calloc uses it only to set the SID register for the current running or retiring process The SID register maps a virtual address to a map address which further maps the result to a physical address The pc sp cc values are used to initialize the cpu on exiting to the process The patient error status is reported to the physician on request along with the patient pc sp cc values The control State components are e activity one of running retiring or sleeping e status normal or suspended A running process is one in control of the CPU A retiring process is one which is attempting to go to sleep A sleeping process is one that does not have control iE the CPU A Tunning or retiring proces is called current there is at most one current proces at a time A normal process executes the patient when running while a suspended process executes the physician When reuring a 75 executes the physician v hether normal or suspended The process state is s represented i in the present SUN with the following 32 byte struct in the C programming langua
31. al years t is written in Pascal 8 a version of Pascal for systems programming In the mean time there are several attempts to bring up Unix in various stages Vaughan Pratt has written his own stream based operating system see Chapter 7 Another operating system is being developed to be used in a multi processor configuration 3 Multibus is a trademark of Intel Corporation 11 DECEMBER 1981 2 SUN USERS GUIDE 1 1 Intended Audience This manual is intended for people who want to write programs for the SUN Eventually this should be called the Hackers Manual with a separate manual sparing casual users of the unnecessary implementation details The emphasis is on getting consistent up to date information rather than a pretty manual Suggestions additions editors and proofrcaders welcome Many of the tools described here are preliminary or interim in nature Since everything changes so fast you can incrementally generate any of the chapters of this manual The source for this document is stored in Shasta usr sun doc Each chapter exists as a press file which can be printed with the cz command cd usr sun doc cz lt chapter gt press There is a makefile in that directory so a command of the form cd usr sun doc make lt chapter gt press cz chapter 5 press will make a given chapier into a press file which is then be d ma on the Dover printer T 62 program a
32. andard graphics package to provide access at RasterOp level 4 2 Detailed Operation of the Graphics Board The graphics board decodes 20 bits on the Multibus memory address lines in the fields shown in Figure 4 4 By encoding these operation bits in the address repetitive operations like gencralized rasterOps c can De done quickly There is a patent pending on this design Up to eight graphics boards may share a single Multibus backplane ih ie high 3 bits the board Each board occupies 128K bytes of Multibus memory space 11 DECEMBER 1981 THE SUN GRAPHICS SYSTEM m 33 RasterOP Model Newman amp Sproull DST f DST SRC PAT Destination Sou rce Pattern RasterOP Me te ee hee de D Xxx gt HH Y ede e ede Constant Src Dst OR Src AND Pat Dst AND NOT Src Dst XOR Src Figure 4 3 RasterOp Concept Some mnemonic definitions for the frame buffer can be found in the f ramebuf h header file see section 2 3 for more information All the symbols begin with the letters GX To perform an operation on graphics board you must combine the bits together cast the result 10 a short and reference the pointer There are also a few combined symbols that can appear in C assignment conexts See the end of this section for some examples The GXupdate bit bit 16 is on if the frame buffer is to bc modified Usually several operations are perfomed with this bit off to set
33. ay 0x3800 00 0x3800 0x5400 0x9200 0x0000 register short cursorPointer cursor xPointer short GXUnitOBase GXselectX yPointer short GXUnitOBase GXupdate GXsource GXselectY register short junk something to move GXwidth 8 GXfunction GXinvert xPointer x yPointer y xPointer junk yPointertt cursortt yPointert cursort yPointert cursor yPointer cursor Each of these is one yPointer cursortt 68000 instruction yPointer cursort yPointer cursort yPointert cursort 11 DECEMBER 1981 36 11 DECEMBER 1981 SUN USERS GUIDE THE MOTOROLA 68000 DESIGN MODULE m Tus 5 The Motorola 68000 Design Module The MC68000 Design Module is a board with an MC68000 processor memory and some minimal 1 0 devices for designing and evaluating the MC68000 processor It was deisgned for the EXORciser development system but we use it with a serial connection to a VAX and a standard terminal Before aay using the 68000 design module read the Design Module User s Guide 12 a black booklet by Motorola that describes MACSbug the monitor that resides i in PROM on the design module and the I O devices available 5 1 Preparation of Programs Write the program as an ordinary C program called lt name gt c Do not rely on est 10 h gt it does not appiy to the Design Module Vaughan has rigged up some
34. be displayed along with the real registers To define say the 2 byte word at address 4564 as pseudoregister MS say W5 2 4564 dee You may now refer to 5 ih the TD command as in TD M5 or TD M5 1 or TD M5 0 each of which displays the appropriate amount of this 2 byte register Pseudoregisters may not be larger than 4 bytes A pseudoregister may be relative to an address register thus W3 4 4 A6 The location is 4 past what A6 points to A6 is the stack frame base register for C programs and 4 A6 is where the return address lives so that you can monitor the calling address while tracing as a supplement to the PC Similarly the arguments are in order 8 A6 C A6 10 A6 while the locals are in order 6 A6 A A6 E A6 provided they are all integers 4 bytes compensate accordingly if not Function arguments are always converted to the C type int If the routine uscs register variables subtract 4 for each 11 DECEMBER 1981 0 ee 0007777 SUN USERS GUIDE register variable in computing these offsets 5 5 6 Symbols To assign the symbolic name FOO to a value say SY FOO value To sce the value of FOO say SY FOO To see all symbols s say 5 See section for a discussion of the symbol table produced by the compilation loading process This table may bc operated on with the above me manipulating commands But Macsyma it is not 5 5 7 Numeric conversions
35. c code should help to reduce the likelihood of such unintentional map accesses One consolation is that at least Calloc is no worse in this respect than any other system state schedulers 7 5 3 Calloc Duties attends to the following l Requests for animation bringing to life of a given process that is giving it a share of the cpu 2 Requests for sleep that surrender of the cpu 3 Requests for termination that is permanent surrender of the tun 4 Equitable allocation of the processor at uniform intervals the active process is put to sleep and the next in turn is awoken round robin scheduling 5 Automatic saving and restoring of pc sp cc the process s program counter stack pointer and condition codes 6 Error recovery An erring process is permitted to try to recover on its own No limit is placed on the number of errors made Calloc depends critically on the physician patient dichotomy to avoid the major problem associated with this degree of latitude namely vegetating the perpetual survival of terminally ill processes 7 Requests by a physician to run or single step its patient The physician is at liberty to set 11 DECEMBER 1981 60 mE SUNUSER GUIDE breakpoints in the patient which Calloc supports in a way that makes this invisible to the patient 7 5 4 Calloc Nonduties ay a He mE Many dutics normally entrusted to system state software are not attended to by Calloc in the i
36. cesses may be necded for some kinds of reading and writing However for some of the cases we are particularly concerned about explicit synchronization can be avoided Consider the case of any number of readers reading in either direction in a stream being written only at the ends i e no inserting other than at the ends and no deleting By symmetry it suffices to consider a reader scanning forwards A reader fetching a non delimiter is assured that he is not at the end of the stream Fetching a delimiter is more problematical the delimiter may have been genuine at the time of the fetch but may be replaced by some other datum by the writer before the reader fetches the end address If the writer has not updated the end address then no serious problem arises the reader merely has an out of date picture However suppose that between the rcader s reading the delimiter and checking the end address that the writer writes a non delimiter and then the delimiter The writer will then bring the end address up to date and the reader will be fooled into believing that the delimiter it read is a datum There is an easy cure for this problem The reader identifying a delimiter as a datum should always refetch _ that datum and discard the old datum The second fetch is guaranteed to be correct since all writing is performed at the end This method avoids the expense of explicit synchronization When the need does arise to synchronize explicitly th
37. choing 28 Edit Streams 5 Emulator Traps 16 27 Entry point 8 Ethernet 6 10 16 17 19 20 Example 18 File names 5 File transfer programs 47 Frame buffer 9 16 20 24 FTP 47 Getting started 17 Global symbols 7 Graphics 9 31 11 DECEMBER 1981
38. decision better it helps to think of physician software as requiring a level of dependability only a little less than that of Calloc itself The reason physicians are less critical is that the penalty for physician failure while seemingly very severe is nevertheless less severe than the penalty for Calloc failure A failed physician only leads to the unreported loss of a process whereas Calloc failure can cause the unreported loss of the whole system This also means that an inappropriate choice of physician will inconvenience only the chooser and not processes running in other spaces There are of course alternative methods of debugging physicians that are not supported explicitly by Calloc just as there are methods for debugging Calloc itself For the most part physicians themselves can be debugged by running them as patients When running as physicians an alternative mode of debugging is to put the physician in communication with another physician who can at least report the termination of its partner different approach to the physician patient relation is to make it hierarchical putting physician debugging on the samc level as patient debugging The cost is added complexity in Calloc in coping with such a hierarchy Our preference here has been to sacrifice a certain amount of convenience in physician debugging in favor of keeping Calloc simple 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM E 59 7 5 2 Machine Depende
39. digits or 24 bit CN S m3or 4 bytes ord data depending on the address type where is the count given in 3 6 el The checksum test is that sum of the bytes in items 3 6 must be congruent to 255 mod 256 i e must have OxFF in the least significant byte 7 The end of the line Th are 23 pue Code 0 Header Ignored by MACSbug and no longer generated 1 Data Two byte address bytes in hex not used 2 Data Three byte address bytes in hex 8 Trailer Three byte address bytes in hex 9 Trailer m Two byte 02 bytes in hex not used Ir a header is given it goes at the start A trailer must appear and goes at the end The rest of the file consists of data records The header i is currently ignored Each data record is loaded into memory starting with the address specified in in the record provided it passes the checksum test The trailer serves two functions to terminate reading ane to load PC with the trailer s address giving a a mechanism for defining the of a program 11 DECEMBER 1981 USING THE SUN PROCESSOR 29 15 3 Using the SUN Processor The SUN processor is a powerful single board computer containing a Motorola MC68000 CPU memory with management and parity and some I O devices The board plan is illustrated in figure 3 1 32K bytes EPROM 16 bit Input Port 68000 Processor Memory Control 8 MHz 256K bytes Cloc
40. e RasterOps It is loaded from the low order 4 bits of the data bus with 0 meaning 16 so its valid range is from 1 through 16 If it is less than 16 the high order bits of the data in the Source and pattern registers will be significant on GXco ntrol loads the interrupt level low order 3 bits interrupt enable bit 3 symbol GX i ntEnab1 e and video enable bit 7 symbol GXv ideoEnab 1e bits from the data bus Accessing the last control register GXi intClear must be done once after every video interrupt to clear it when it is enabled There are four pairs of ten bit address registers sometimes called cursors selected by bits 12 and 13 Bit 11 selects either X or Y of the pair and bits 1 through 10 of the address are loaded into thc selected address register Note that every read or write reference to the graphics board has to load one of these address registers while it might or might not depending on the GXupdate and operation code bits modiy the frame buffer The low order bit bit 0 of the address must always be zero This design was meant to be used efficiently with auto incrementing addressing modes For example the following function displays an 8 by 8 cursor at the given position 11 DECEMBER 1981 THE SUN GRAPHICS SYSTEM 35 DisplayCursor x y short x y screen coordinates of upper left corner static short cursor 0x9200 0x5400 Left justified bit arr
41. e question arises as to how to minimize overhead System calls to raise interrupt priority or defeat the interrupt mechanisms are unduly expensive it is considerably cheaper to rely on shared semaphores when these can be set tested and reset with single instructions 11 DECEMBER 1981 6 EN SUN USERS GUIDE References 1 F Baskett and A V Beclitolscheim The SUN Workstation A Hardware Overview Stanford University Computer Science Department 1981 2 Baskett A V Bechtolscheim W I Nowicki and J K Scamons The SUN Workstation A Terminal System for the Stanford University Network Stanford University Computer Science Department 1980 3 F Baskett J H Clark J L Hennessy S S Owicki and B K Reid Research in VLSI systems Design and architecture Tech Rept 201 Computer Systems Laboratory Stanford University 1981 4 F Baskett J H Howard and J T Montague Task communication in DEMOS Proceedings of the Sixth Symposium on Operating Systems Principles November 1977 pp 23 31 Published as S7GOPS Operating Systems Review 11 5 5 D R Boggs 1 F Schoch E A Taft and R M Metcalfe Pup An Internetwork Architecture IEEE Transactions on Communications 28 4 April 1980 612 624 6 S L Feldman Make A program for Maintaining Compiler Programs Part of the Unix Ho 5 guide Volume 2 7 R E Gorin Computer Networking at Stanford Stanford University Computer Science Department
42. ect is that you cannot see a breakpoint merely by looking at memory to tell what breakpoints are set type BR without an argument To clear a breakpoint type BR lt address gt To clear all breakpoints type BR CLEAR To see what breakpoints are set type BR If you should reset the computer while your program is running all the breakpoints will stay put since MACSbug will have forgotten where it put them When a TRAP 15 is encountered for which MACSbug has no record it types ERROR and halts your program You will have to fix it yourself either with SM or RE You may delay a breakpoint so that it takes effect only on the nth time it is encountered by saying BR address n On the nth encounter it breaks When the program is redacted n is Aorsotten about n reverts to 1 default To restore give the command again To set a temporary one that clears itself when encountered give the command 6 TILL lt address gt The address gives the Stop unless sc some other breakpoint or the end of the program is encountered first The start is the virtual PC 5 5 4 Tracing To single step through a program say TR The program will begin execution from virtual PC and halt aftcr one instruction typing out the trace information sce below followed by 1 When the prompt is it means that you can type carriage return as a synonym for TR so that you can conveniently trace a series of ste
43. efficiency question is intended to be ignored by the user and taken care of at the implementation level see section D below Stream services fall into two categories transactional or data oriented and existential or identity oriented In the following T denotes the type of the stream and may be any of c s i or p each abbreviating one of the four types Transactional Services putT d s put datum d in stream s Stream version of s d getT s get datum from stream s Stream version of s emptyT s return 1 if stream s is empty else 0 Existential Services makestreamT create a stream return a reference to its start dupref r make a copy of reference r a typeless operation dispose r dispose of reference r a typeless operation Semantically dupref acts as an identity operation apparently merely returning its argument Behind the scenes a reference count is incremented When dispose is called a reference count is decremented Reference counts permit garbage collection of storage associated with streams permitting the user to ignore the details of storage managcment for streams 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM 55 7 3 Performance Services Performance services are services that are semantically redundant i e are already supplied by other services but that offer alternative tradcoffs in time and space The advantage of having performance services is finer programmer control of pr
44. en ensure the automatic batching of tasks a process will continue to process data coming from a stream for as long as data is available blocking only when the stream becomes empty Preemptive E is performed by anan the physician to retire this process Normally this costs 40 instructions more than blocking i e 74 instructions or about 180 microseconds If the process was running atomically then the overhead is increased to that required to single step the process through the atomic section approximately 40 instructions or 80 microseconds per step Frequency of n blocking is intended to be very low in comparison to the overhead of preemptive blocking This motivates the choice of a 10 millisecond quantum for Calloc making the 180 microseconds required for preemptive blocking negligible Whether the additional overhead of leaving an atomic section increases this substantially on the average depends on the probability of beingi in an atomic section at the time of preemption n general this can be assumcd to be less than 0 1 and atomic sections can be assumed to be less than 10 instructions long Then the expected overhead attributable to atomicity at preemption is at most 0 1 10 0 5 40 20 instructions or 40 microseconds the 0 5 assumes uniform distribution of where in the atomic section preemption was requested Interrupt mediated preemption is extremely cheap essentially the cost of the exception The external process saves onl
45. es are inhibited In this way it is possible to initialize RAM just after reset Boot state is exited on the SUN 1 processor by writing to 0 00000 and by 2 to the PROMO m address space on the SUN 2 processor 11 DECEMBER 1981 USING THE SUN PROCESSOR 2 25 When the monitor is initialized it sets the Supervisor Stack Pointer to 0x1000 and the User Stack Pointer to the top of available memory User programs may change these registers providing that they do not cause the supervisor stack to overflow into unmapped address space More exact detail on the memory mapping as well as constant definitions useful for C programs may be found in usr sun include sunmmap h Note sunmmap h currently describes only Version 1 processors 3 6 Trap ps The monitor initializes the trap vectors so that it gets control of any exception or interrupt Some such as the memory refresh timer interrupt are handled internally Others have special meanings for example the trap 1 operation is treated as a breakpoint trap For exceptions or interrupts not interna handled the monitor will print a message such as Exception Tr and then return to o command level EAM The messages s printed use a two letter code here is a list of these codes and their meanings Il Illegal illegal instruction code was executed 70 B Zero Divide division by Zero ch Check a CHK instruction faulted TV
46. f the table 572 or really 570 these are 2 bit pointers but it is convenient to work with them as 16 bit ones 11 DECEMBER 1981 THE MOTOROLA 68000 DESIGN MODULE y The format of each entry in the table is an 8 byte name followed by a 4 byte value The name is left justified padded with blanks starts with an upper case letter or period and may only contain letters digits period and the symbol at least if you want to be able to refer to them when talking to MACSbug Knowing this it is generally not too difficult to spot the end of the table by relying on the Ascii part of the DM printout You should set 576 to the exact first frec entry if you expect to bc adding symbols manually as in SY FO0 33 Otherwise you can err on the low side by up to 11 bytes when in doubt or haste br Disassembly The DM command is not much use in following code in memory To make it easier here isa disassembly program dasm di on usr sun which when loaded will run in the 6000 7000 region of memory your r programs do not reach into that region you can leave the disassembler there inspect De from n enter n into 00 and type G 6000 You can now n through the code by typing any character but Q Each step will display the next instruction and the address it is at The program will return to MACSbug either on encountering an illegal instruction or on your typing Q for du it must be capitalized b
47. file under the directory with your programs to be compiled The makefile consists of dependencies and commands dependencies consist 01 a list of files to be made followed by a colon followed by a list of files upon which the others depend Commands begin with a tab and end with a blank line Thus for example 11 DECEMBER 1981 SOFTWARE DEVELOPMENT ON UNIX 7 ethertip enet b tip b cc68 r o ethertip enet b tip b tip b tip c 6668 0 c tip c enet b enet h enet c 6068 0 c enet c is a makefile for a program called ethertip that consists of two modules tip and enet The first command line links the two modules together The tip b file depends the corresponding source t ip c and will be compiled with the optimizer because of the The enet b module is compiied from the corresponding C file but also includes a header h file After creating the akele you can edit any or all of your sources and just say make to remake the program The make program reads the makefile and infers the necessary commands from the write dates of the files Continuing the above example if we were to edit the enet h file and perform a make command the enet b module would be recompiled and the program relinked with the following commands cc68 0 c enet c cc68 r o tip enet b tip b 2 2 2 The 68000 Assembler 68000 assembler as 68 takes file s and produces file b a non text file containing 2 a
48. format to fil le b The primary tasks of the linker are to develop a symbol table for all of its inputs and execute the relocation commands to produce absolute e output contains the same eight word header as in file b text data and the symbol table Loader aprons D du Set the si size sofu the data segment to dsz Itis padded with zeros if too d RE Force thec common segment to be defined overrides second part of 4 gt e ept m Make epi the entry point of the program Otherwise the first address of the code segment is used Sd the library file named usr sun lib libname a A library file is searched B M only as its name is encountered on the command line so the order may be important Note there is no space between the 1 and the name Create a file listing the symbols and their values in sym out 0 file Outputis named file instead of b out r Preserve relocation bits so that the output file can be used for input to 1d68 in a later run Also prevents final symbol definitions for common symbols and supresses undefined symbol diagnostics S Strip the output file of all symbol table and relocation bits T addr Start the code segment at addr u sym Add sym to the symbol table This is used when loading enitrely from a library since you need at least one symbol reference to extract a root module Vyersion Specifies the version of the 68000 environment to ass
49. g costs negligible under heavy load Hence sleep should be reserved for situations involving short back and forth exchanges between processes block will be adequate for more heavily stream oriented tasks _ putTm d s isa variant of putT d s which is expanded in line instead of as a subroutine Since d is referred to more than once in the expansion evaluation of d should not have side effects For example putem getc s t will not be equivalent to putc 4 s because getc s has the side effect of assigning to s 11 DECEMBER 1981 56 9 SUN USERS GUIDE 7 4 Characteristics of Present 68000 Implementation The performance figures of greatest interest are e Cost of nonpreemptive process initiated blocking e Cost of preemptive scheduler initiated blocking e Cost of picemptive interrupt initiated blocking Cost of a stream mediated transaction combined put and get Frequency of each of the above Nonpreemptive blocking using block requires 34 instructions or about 100 microseconds if we assume 2 microseconds per instruction The non register saving s 1eep instruction avoids the two moveml s that alone account for 36 microseconds thus s 1eep costs approximately 60 microseconds Frequency of nonpreemptive e blocking is intended to decrease as system toad increases at least for ask that lend themselves to batching The use of streams in interprocess communication will oft
50. ge typedef struct Procdesc process descriptor int patpc pat program counter int patsp pat stack pointer int patsb _ pat stack base int phypc phy program counter int physp phy stack pointer int sid space id char patcc pat condition code reg char phycc phy ditto short paterr patient error status struct Procdesc next next process descriptor procdesc The current process is identified with a variable Current of type procdesc To facilitate removal of a terminated process the procdesc variable Last identifies the process that was current prior to the present one with Last Current if there is only one process Last contains no information not deducible less efficiently from Current 11 DECEMBER 19081 T MEUM SUNUSERSGUIDE 7 5 8 Control State Transitions The behavior of Calloc towards the current process can be represented as a finite state automaton the states being the control states of the process This automaton has five inputs namely error terminate sleep run and timeout An error input may be an error exception a trace exception or a request to be considered to be in error terminate input is a request to be terminated A slecp input is a request from the process to be put to sleep A run input is a request from the physician to transfer process ownership to the patient cither for one step or indefini
51. gh megabyte of mappable address space is mapped as MultiBus memory Address from 100000 to IEFFFF are mapped to Multibus memory space addresses 0 to OEFFFF respectively This is where the frame buffer The address space ine 24 bit addresses used in the internal bus i is divided into eight parts as described below 0 IFFFFF Mapped address space as described above There is usually 128K to 256K bytes of on board RAM with a limit of 512K This space can also be mapped into the Multibus I O or Multibus Memory space 200000 3FFFFF On board PROMO See the discussion below on boot state 400000 SFFFFF board PROMI 600000 The on board double UART Channel A data register is at 600000 command register at 600002 data is at 600004 and B command is at 600006 800000 9FFFFF On board Timer chip 800000 is the Data 800002 i is the Command register 1 00000 Page map in SUN 2 PID register in SUN 1 1 00000 DFFFFF Senet map in SUN 2 page map in SUN 1 00000 FFFFFF Context register in SUN 2 In boot state the state of the system after reset read and execute accesses to any location Oxxxxx in mapped addresss space are redirected to come from the corresponding location 2xxxxx in the PROMO address space but write to the mapped address space go to on board RAM Also all interrupts including normally non maskable on
52. h is all too often these days Get out with control meta q VAX sa11 score sail runs on Diablo score runs on Shasta 1200 baud serial link Use telnet sail or telnet score instead Score telnet shasta This currently goes through Sail s telnet gateway Typing this command will be guaranteed to get you there in the best possible way directly over the ethernet in the future There is also a possibility of using the 1200 baud serial link This and the score program are mutually exclusive Loads down score badly Exit with control t c 11 DECEMBER 1981 AN INSIDER S GUIDE TO SUNET m 4 6 2 File Transfer Programs VAX ftp host Pup user ftp Talks to any ae server FTP this means Shasta Diablo Helens Lassen DSN Sumex Tiny and any alto running ftp Documented with ftp Sail r pupftp Pup user ftp Same as above Experimental Preferred way of getting files from vAXen to the outside world Use type X for 32 bit binary files Documentation in pupftp tvr up doc Alto ftp host Another Pup user ftp as above Prefered way of getting files to Altos Alto ef tp Simple transfer of files from Sail Self explanatory Now mostly outdated by ftp It is still used for sendind files to the Dover but that should be done invisibly to the user Sail r eftp Old slow but reliable way to get binary files between sail and ethernet hosts Say 1 for mode using 1 for left hand bits VAX eftp e xr host fi
53. he host without recntcring transparent mode type 11 DECEMBER 1981 38 asterisk return to text SUN USERS GUIDE MACSbug This will send the return In general ping will send the text to the host you will not see the reply See Section 58 for more information The downloading command is RE for REad This command waits for the host to start typing out your file when this each line of i f input pens it reads it into memory then at the end halts and types Normally REad checksums each failing line gencrates an error report on your RE may take any of the following arguments 1 As it takes a certain dexterity to persuade the host to delay typeout until you do the tA lt return gt RE there is an option to send a line of text to the host as part of your giving the REad command Thus if you say to Unix RE 011 foo d1 7 then the file foo d1 will be loaded into the 68000 The d11 program pads each line with a nulis to allow loading at 9600 Baud This displays the data being read It permits you to watch the file being loaded so that you can see what progress is being made For example if the host dies so becoming a heavenly host you will have no indication of this without the X option A disadvantage of the X option is that any checksum error report will disappear off the screen within 24 lines of typeout so that you must watch the whole loading process
54. he time of animation of this process The physician may use the function si nglestep to achieve the same effect as run but in 68000 trace state The ensuing trace exception is treated by Calloc as an error of type trace and the process is then suspended again 7 6 The Edit String Protocol Edit strings are a particular representation of strings designed to support a variety of protocols for operating on strings The most general string editing operation replacement is supported but certain special purpose kinds of operations such as stream read and write have particularly efficient implementations with edit strings ATI to edit strings are via ordinary pointers to individual data within a string 7 6 1 The Edit siii bats Structure Storage is divided into buffers each of size a power of two each aligned by its size Each buffer contains a header anda body The header i is structured into the following fields typedef struct Bufhead Buffer head definition struct Buffer next 7 next buffer struct Buffer prev previous buffer if any char size char type short llim short rlim short refco bufhead log base 2 of size of buffer type of data in buffer left end of data in buffer right end of data in buffer number of owners of this buffer The exact start and end of data in the body are defined by both delimiters and the 11 im rlim pa
55. hed with the Tsunos option of cc68 The SUNOS library is discussed in chapter 7 2 5 The 68000 C and Pascal Calling Sequence m The stack grows downward towards smaller addresses Two address registers are used to access the stack a6 the frame pointer and a7 the stack pointer The stack pointer is the standard one for the 68000 in that BSR Branch to SubRoutine JSR Jump to SubRoutine and PEA Push Effective Address all use it Note that exceptions do not default to it but rather to the System Stack Pointer a register not accessible in user State The code produced by the C and Pascal compilers result in a6 serving as a pointer to a linked list of stack frames A stack frame is a region of the stack associated with the calling or activation of a function Stack frames are stored contiguously on the stack Stack frames have five components from low addresses ten of stack to high they 1 Locals These may be of any size and will occur in the reverse of their declaration order or perhaps more mnemonically in their declaration order going away from the Frame Center They will be contiguous to within the word alignment restriction i e non chars will be aligned at even addresses If the first local is char its address is the same as though it were a short a quirk of the compiler Te also allows one additional byte beyond the last local 2 Registers This region contains some subset of the registers d2 d7 a
56. i in this way to start a program with the trace bit set give the command C starling address Subsequent steps may be made by using the C command without an argument For m ons it S Rot possible to single step after a Breakoiit trap is taken unless you first clear the BPT Once you have stepped one instruction you may then reset the Jeff may fix this sooner or later 3 8 Emulator Traps The ROM monitor is able to provide several services to user programs via Emulator Traps EMTs An EMT is a convenient way of entering the monitor which does not depend directly on the absolute addresses used Instead of executing a jbsr instruction a program wishing to use the emulator first pushes a trap type code on the stack and then executes a trap 15 instruction In most other respects the operation is identical to a function call The services provided by the EMT facility fall into three categories information I O and memory management Some of these such as the memory management operations are restricted to supervisor mode The following section gives the C language calling sequences and descriptions for the EMTs assembly 11 DECEMBER 1981 28 5 0 SUNUSERS GUIDE language definitions are available in the file usr sun include sunemt h In general if one of these functions encounters an error condition it will return the value 1 In particular attempting to execute a trap reserved to supervisor mode
57. igned to system state processes The inaccessibility of memory to Calloc turns out to present no serious obstacles to thc implementation of Calloc As it happens none of the services provided by Calloc require access to other spaces A residual issue 11 DECEMBER 1 58 2 7 MN d SUN USERS GUIDE of accidental map access leading to accidental memory access by Calloc remains an unsolved problem that we discuss in more detail below a basis for providing services Calloc recognizes a partitioning of every internal process into what we shall term the physician patient pair This recognition takes three forms unlimited patience with ill exception causing patients support for physicians limited to the kind of support best offered by a process running in system state such as Calloc and a very contemporary intolerance for malpractice manifested as immediate and unreported termination of an erring physician along with its patient This scheme should work well provided only the most trusted software is used for implementing the physician half of each pair The behavior of Calloc towards physicians and patients is the only mechanism depended on to encourage programmers to observe this discipline in writing process software Without this discipline debugging should prove most difficult conversely with it the ease and efficiency of debugging should advance in step with advances in medical technology To appreciate this design
58. imited time In this state preemptive scheduling by Calloc though not by interrupt driven processes is inhibited The patient enters atomic State by signalling its physician typically by setting a global variable called Lock and leaves atomic state by another signal to the physician typically by clearing Lock Medium level provides an attractive alternative to locking resources in use by a preempted process Such resource locking is both expensive and a source of deadlocks At the moment of preemption it may often be cheaper to finish the critical section than to incur the costs of blocking a process sharing the resource presently accessed by the preempted process Higher levels of atomicity may be provided in the usual way with the usual deadlock problems using medium level atomicity to implement synchronization primitives for which low level atomic instructions such as test and set may not always be powerful enough 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM 5 7 1 4 Physician services The physician services include all patient services except error e together with status supply physician with patient s pc sp sr error code sstatus set patient s pc sp sr rest is directly accessible run run patient normally singlestep run patient for one step breakpoint a set breakpoint at instruction address a The status and sstatus services are needed in case the physician has no other way to access the
59. in 1100 workstations The points are addressed by X and Y column and row starting with 0 0 in the upper left corner of the screen From one to sixteen consecutive pixels may be read from written to the frame buffer in one memory cycle one microsecond Figure 4 3 illustrates the concept of RasterOp as developed by Newman and Sproull 14 A RasterOp 11 DECEMBER 1981 5 SUN USERS GULME Portrait Mode Landscape Mode 1023 1023 1023 1023 1024 1024 pixels Size 1024 1024 pixels Visible 800 1024 pixels Visible 1024 808 pixels Invisible 224 1024 pixels _ Invisible 1024 216 pixels Updates 16 pixels cycle Updates 16 pixels cycle Figure 4 2 The S UN Graphics Screen sets a destination rectangle on the screen to a bit by bit boolean function of three variables its original contents DST a source rectangle SRC and a repeating bit pattern PAT The SUN graphics system allows all 256 possible Raster OP functions although only a few are used in practice For example to clear the entire screen the constant function 0 is applied to the viewable rectangle To flash a certain window the function NOT Dst is performed on that window To write a character the Src function is used while NOT Src writes the character inverted black on white Dst OR Src overwrites paints the character and Src OR Pat writes the character with a background pattern There should be a st
60. ined and available to user programs They are initially connected to the terminal I O of the Design Module They may be set to other streams as desired their old values should be saved somewhere if it is desired to continue to communicate with the terminal The functions putchar and getchar are defined in terms of putc getc stdin and stdout as usual An example SUNOS program may be found in usr sun sunos example c This example implements a quizmaster and a quizkid who fire streams of questions and answers at each other The cdm command will produce the corresponding dl file which includes the code from pman c strm c and calloc c This filc may be loaded and started in the normal way namely via G MAINE During the settling in period the SUNOS symbols will be loaded along with the user symbols to help the user distinguish his bugs from SUNOS s but eventually they will be omitted in the interests of avoiding cluttering up the user s table SUNOS is designed to perform best under heavy load The total overhead to send and receive one datum 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM l on a heavily used stream averaging in the overhead of context switching and buffer switching and assuming usc of register variables and the readcharto as opposed to readchar primitive is roughly 20 microseconds on an 8 MHz 68000 The present versions of strm c and calloc c are close to final However the present version of
61. ip with timer h Defines the format of a b out binary file Note that although you use the same header file the bytes are reversed between the 68000 and the VAX So you must run rev68 to J convert between the two A structure definition matching the information pushed on the stack of the 68000 on a bus error and the function codes as described in the MC68000 User s Manual 13 Defines some mnemonics for control characters Definitions for the SUN Multibus frame buffer See 4 tor more information Definitions for a Raster Op graphics package which is frame buffer Chapter 4 and the separate manual on this for more information Some graphics macros for the SUN frame buffer Most people will probably want to use the graphics package instead A simple Lisp system defined in macros that map into C Complain to Vaughan about this MC68000 mnemonic definitions for registers and some Macros for performing special instructions like setting the interrupt level from C Motorola 6821 Peripheral Interface Accessory This is a fancy name for the paral VO ports on the Design Module Motorola 6840 Timer This is the timer on the Design Module t is so complicated 11 DECEMBER 1981 10 m6850 h m 8enet h map h nec7201 h necuart h noprotecth pemap h reentrant h s2651h statreg h stdio h _ sunemt h sunmmap h sys h timer h vec tors h SUN USERS GUIDE
62. ir The last delimiter before the start address marks the start boundary while the first delimiter following the end address marks the end boundary 11 DECEMBER 1981 66 x SUN USERS GUIDE 7 6 2 Reference All references to edit strings are via pointers to data within the body of some buffer This differs from schemes where a reference is a more complex structure which may include a count of the remaining items in the current buffer and the address of a function to call when the count vanishes Data are accessed via pointers in the usual way In the case of accessing a stream the pointer will be incremented after the access This may take it out of the data The test for this is performed when accessing rather than when incrementing The condition of being out of the data is recognized when the pointer points to a delimiter and the end address given in the buffer header does not lie beyond the pointer When storing at the end of an edit string as when writing a stream the writer only need update if it writes a delimiter 7 6 3 icon Block Headers The question arises as to how to locate the start of the buffer given only a pointer into the buffer body To this end all buffers are taken to be of size a power of two and are aligned on buffer boundaries fati is they Start at an address which isa multiple of their length rfe size of the buffer is o the buffer header may be located by masking out the low order bit
63. ither as parameters to cc 68 for example vm uart functions begin with line and have the line number as their first argument By convention line number 0 is the lacal terminal or keyboard and line number 1 is connceted to a remote host This trades off size of the library for size of the code and a little speed char 11 neget ine Get a character from line line assuming the receiver is ready MO d Put character chr on line line assuming the transitter is ready int Vinereadytx line True if the transmitter is ready on line Jine to accept another character to be transmitted int 1 inereadyrx ine True if the receiver is ready on line ine li neservice proc Set the given procedure pointer to be the interrupt service routine for both lines proc should be declared with the reentrant macro described in section 2 3 linearmrx ine Enable receiver interrupts on the given ne The interrupt service routine should already be set up linedisarmrx ine 11 DECEMBER 1981 n a SUN USERS GUIDE Disarm receiver interrupt on the given Zine 11 nearmtx line Arm transmitter interrupt for line Jine linedisarmtx line disarm transmitter interrupt for line 14 ineresettxint ine Reset a transmitter interrupt when there no more characters to print 11 nereset ine Reset line Default to interrupts disarmed It is the responsibility of the individual libraries to dar with the
64. ks Logic etc Management dynamic RAM with Byte parity IEEE 7 96 Bus Interface Figure 3 1 Layout of the SUN Processor Board 3 1 Introduction to the SUN ROM Monitor Most use of the SUN processor involves interacting at least initially with the ROM resident monitor The following sections discusses the purpose of the monitor and how to use it Note the discussion below assumes occasionally the use of the PC board version of the Sun Processor which has a two level memory map Users of the Versions 1 and 2 wire wrap boards can probably deduce the points of difference however neither of these boards will be supported in the future Although the primary function of the ROM monitor is to provide a simple consolc for the workstation there are a few features which affect the user programs that run under it For simple programs especially those using standard I O routines the characteristics of the monitor should not be important However if a program makes direct use of interrupts or I O devices a few critical details are relevant 11 DECEMBER 1981 16 m SUNUSERS GUIDE 1 1 What is the monitor It i is useful at this point to give a brief description of the operation of the monitor SunMon mostly to provide a context for understanding the few rules imposed upon user programs The monitor has four major functions initialization on processor reset memory refresh providing Emulator Trap service see
65. lename Obsolete way of getting binary files to from sail Be sure to do a man eftp command since there are many obscure options We ususally use e and often s for binary files and ct for text files For text files the command vtos x for VAX to Sail abbreviates ef tp reqtlv sai 1 x while stov for Sail to VAX abbreviates ef tp xeqtlv sail x Sail ftp Arpanet ftp Remember to use ascii mode or right curly braces as as other random characters will disappear Score f tp host Prefered way of shipping files around the Arpanet 6 3 Walk Net Tape transfer VAX ans i 1oad init vol write files Reads ANSI standard labeled tapes Works with VMS RSX 11 tapeioa with Format Ansi and vaxtap tapes Text files only Documented with man ansi Score vaxtap Writes and reads ANSI standard labeled tapes for VMS systems also works with the ansi program on Unix Unfortunately it does not handle wildcards so you need MIC files for large transfers Score tapeio Writes and reads ANSI standard labeled tapes for CIT also is supposed to write DEC compatible labeled tapes You can exchange tapes with thc ansi program with the format ansi option You must run the tapelabel program on a new tape to write a label Score su i net taput really kludgy way of getting binary tapes to VAXen Use ftp to sail and pu instead 11 DECEMBER 1981 4 11 DECEMBER 1981 SUN USERS GUIDE SUNOS A SMA
66. likely to be because you loaded something not in reversed b out format Of course if the exception occurs with the load and go N command it may have been caused by your program The network bootstrap server running under Unix interprets filenames not beginning with as relative to usr sun bootf ile Thus N memtest will load the file usr sun bootf ile memtest In fact the help command in the network monitor is equivalent to doing an monhelp Normally bootload requests are broadcast to all servers on the net Howcver you can specify the name of 11 DECEMBER 1981 USING THE SUN PROCESSOR 1 3 the host you want to boot the file from by preceeding the filename with the hostname and a colon For example N shasta memtest will gct the program memtest from the PUP host named shasta Note that it is not possible to load more than one file at a time with the loader If you want to load more than one file presumably into different arcas of memory you must use the down line loader 3 5 Memory Mapping The SUN processor is provided with a map so that you can map pages of 2K bytes anywhere in your address space The structure of the virtual address is given in figure 3 2 SunMon during initialization sets 5 up the Segment Table and Page Table in a standard way which makes all memory and I O devices available to user programs User programs may change these maps although page 0 and wha
67. lso see ikal an interactive version A memory diagnostic sources in usr sun di ag memte s t When your workstation has nothing better to do it could run this to help check for faulty memory As described below this is a file which prints out a quick summary of the available monitor commands Note various versions of monhelp exist corresponding to the various versions of the monitor On version 0 7 and later monitors monhe 1 2 is the program to run Please bug Jeff to clean this up Another graphics demo for the frame buffer The sources are located in usr sun demo This just does some random raster ops in rectangles on the screen frect is an fast version of rect program n lists the standard bootfiles available via the ethernet program which simulates a multi window terminal on the Eu buffer itio a separate PUP telnet connection in each window The source to this and the tty program is in ever SUR P ety A mole PUP telnet program If you have any octal UART boards in your machine they may each have a PUP telnet connection as well as the primary terminal Another version of the multi window terminal program This one uses the serial line instead of the ethernet interface so you talk directly to one host 3 2 3 A Simple Example We will now step through how to write compile load and run a simple program First we use our favorit editor to enter the following program into the file mnt smi th te
68. n 2 3 for more information Object libraries These are searched by the 1 option of cc68 Some of these are described near Hi end of this d Master copies of manual pages describing Unix commands See next section for details on these commands is a trademark of Digital Equipment Corporation 11 DECEMBER 1981 monitor Jsic src cmd src diag src games stc graphics Jsrc libc src libe crt Jsrc libc emt src libc gen Jsrc libc stdio SUN USERS GUIDE 01 files for making monitor proms Sources are hidden under src monitor Some sun related sources subdivided into the following subdirectories These should correspond to the debugged production versions of programs Each subdirectory should have a makef ile describing how to compile sources in it the result of the makefile should be the bootfiles in bootfile or bin Commands that run on Vax and Sun Further divided into subdirectories for some of the important tools like the compiler loader etc Sun hardware diagnostics These consist of a memory test an ethernet interface test and a graphics board test Source for some games Most of these run on a dumb terminal instead of using the graphics board Graphics demostration programs and a Raster op package Sun libc a sources Further subdivided into the following subdirectories C run time support This is the routine which sets up the stack
69. n 8 word header and segments for text data symbols data relocation commands and text relocation commands The header contains two words of magic numbers the sizes of the text initialized data uninitialized data symbol and Telocation command segments and the entry point the start address of the top level routine The listing might by slightly helpful i in debugging the values it gives for symbols however are incomplete Uninitialized symbols have no values in the listing while all other values are relative to the start address determined at load time Assembler options dXdigiD Used for num the assembler only The digit gives some of the level of debug printout e B ah pui external symbols into the output binary file g Treat any undefined bob as globals They must be eventually resolved by the loader L name Put the cus file into the file name The cc68 command normally puts the listing in a file with a name of the form name 1s Produce a listing in filename list or other file if L is given 11 DECEMBER 1981 n SUN USERS GUIDE Put the output in the file name instead of filename b p Print the listing on standard output s Put the symbol table in the file 1i st out The loader s mi table is s probably more useful since it is made after relocation 2 2 3 The 68000 Linker The68000 linker 1468 produces a file callcd b out in a similar
70. ncies in Calloc The initial Calloc design is tailored to the SUN 1 a Motorola 68000 based CPU board The only features of this board on which Calloc depends critically and which are not features of essentially every CPU board are the 68000 s trace facility without which the dutics of physicians would require substantially morc assistance from Calloc compromising system robustness and the SUN Ts per page protection capability on which Calloc depends to protect physicians from their patients and both from Calloc and to make physicians invisible to their patients To within these details the principles of Calloc should be found to be broadly applicable Ideally Calloc should be the junior sibling to Malloc in that Calloc should have no say in how memory is allocated to processes and should not be able to interfere with Malloc s duties in contrast to Malloc s absolute freedom Unforturnately the SUN 1 does not support this level of protection since map access and hence unrestricted memory access is granted to all system state processes not just to Malloc as we would prefer Thus the promised protection of internal process memory from Calloc is only weakly achieved by not having any Calloc code that intentionally references the map Accidental map references remain an unfortunate possibility that we would hope future hardware would make it easier to avoid The absence of iterative constructs and address register arithmetic from the Callo
71. nd a2 a5 saved on entry The registers saved are those actually used The convention is made that C subroutines always preserve thesc registers as well as and a7 but change 40 41 0 and al unpredictably The optimization is such that this convention holds down to the statement level or even lower J Alignment is on multiples of 4 Because of the additional byte allowed by the compiler for locals that byte and up to 3 more the worst case being when the locals actually declared end on a multiple of are unused 3 Fine Center This contains a 4 byte pointer to the Frame Cete of the next stack frame down the stack i e at a higher address 4 Return Address This contains the caller s 4 byte return address 5 Arguments The arguments passed by the caller are implicitly cast as ints before being pushed on the stack Hence they are stored in consecutive 4 bytes regardless of their actual size They are stored in calling order with the first argument closest to the Frame Center It follows that the order in which they are pushed is the reverse of the order they are written 11 DECEMBER 1981 7 ae SUNUSERS GUIDE 2 6 The S Record Down Line Load File Format di file consists of a series of records each having seven components 1 The letter S 2 A type a digit in the ve 0 to 9 3 A digit one bytc count giving the number of bis in the record 4 An address either 16 bit wo hex
72. nd sends a X to the N Bootfile name O addr Pp S S record X char computer to indicate that it is ready to be downloaded The Host command is normally dix file dl which will put the terminal back into normal mode when the file is downloaded 6 On the SUN 1 processor open Map register m On the SUN 2 processor open Segment Map register Load and start file via the Ethernet Bootfile name is the pathname of the file to be bootstrapped It should be in r format produced with the r option of cc68 or the rev68 program This command is only available on network monitors Opens the byte location specified The byte vs word distinction is a problem on the Multibus since the convention on byte ordering within words is different for Multibus addresses On the SUN 2 processor open Page Map register p On the SUN 1 processor this is used to set the PID Process Identification register to p Opens the miscellaneous registers in order SS Supervisor Stack Pointer US User Stack Pointer SR Status Register and PC Program counter SS may not be altered This causes the monitor to accept the S record Normally done by the host computer in L mode this responds with a two digit record count and one of L for length error K for checksum error or Y for success set the transparent mode escape character to char Because of the way that the parser treats spaces the escape character cannot be
73. nology this would be called a scheduler and its senior sibling process Malloc the Map ALLOCator run in system state at interrupt level 0 The only other processes are the interrupt driven processes or IDP s which run in system state at positive interrupt levels preempting the cpu according to their level An IDP is visible only to those processes with which it shares memory which normally will be one or more internal processes on the distal end ofa stream shared with the IDP Calloc is entirely unaware of the existence of IDP s Calloc has a minimal set of duties which require little code to implement and can be easily performed As such Calloc should be of interest to operating systems theorists as a tractably small object of study and to operating systems implementors as a small easily implemented efficient and effective component of an operating system Calloc is dedicated to maximal autonomy of internal processes The objective is to minimize duties performed in system state thus minimizing the chances of global system failure due to errors committed in vulnerable system state The autonomy is supported in two ways negative and onc positive On the negative side Calloc forgoes the luxury of access to any 50860 but its own thereby reducing the vulnerability of the system to system state errors More positively Calloc offers enough services to permit competent user gt State processes to assume duties normally ass
74. nterests of autonomy flexibility and efficiency Such duties often include the following l Saving and restoring the contents of the cpu other than pc sp cc Calloc assumes that each internal process will save and restore the contents of the cpu registers that it cares about 2 Diagnosis repair or reporting of sick processes The process must diagnose and report its own problems using its physician component and heal or terminate itself 3 Allocation of memory This is handled at two levels on the SUN 1 as a consequence of details of its memory structure At the higher level SUN 1 memory is structured into possibly overlapping spaces of varying sizes Accordingly there exists Calloc s aforementioned companion 6 which like Calloc runs in system state at interrupt level 0 At a lower level is conventional memory allocation within a space which is handled by the user processes themselves 4 Allocation of the processor to interrupt driven processes IDP s introduced at the start of the overview section 5 Creation and destruction of processes Calloc draws a Pinnochio like distinction between creation _ and animation taking responsibility only for the latter Process creation and destruction are left to user processes The quality of the created process is up to the author of the creating process in general the best effects should be obtained by creating processes with highly trusted physicians Process destruction entails p
75. of the C library for the design module and it should be referred to here 0 Section 2 3 some header files that can be included in C programs and section 2 4 describes some libraries available As described in section 2 2 1 you probably want the vm option on the cc68 command 5 2 Compilation To compile a single program which can be loaded into the 68000 design 0 the Motorola supplied board use the command cc68 vm d es lt name gt m name c Error messages vill be printed on your terminal Errors may arise at any of several stages preprocessing compilation assembly and loading To understand these stages see section 2 2 1 for the moment assume that you have got your program to compile successfully on the VAX You now want to down line load and test your program which you will find in your working directory as name2 d1 5 3 Down line Loading Downloading is the process of getting your program into the 68000 from the VAX or ees you your program While it is necessary to compile on the VAX thc result of compilation can be put on any computer Get your 68000 to the point where you can talk through it in transparent or P2 mode to the computer where your file is Type to return to MACSbug the 68000 board monitor Note that this sends tAtX to the host before downloading you will need to compensate somehow for this A carriage return will suffice on most systems To send a return to t
76. ogram performance Their disadvantage is that program structure may be obscured by the clutter of performance details interwoven with those aspects of the program that contribute to its semantic correctness The performance services are as follows block temporarily suspend execution of this process slee destructive block 40 47 0 not preserved on cm pu tTto d P same as putt d s ifevaluation of d has no side effects getTto 5 equivalent to v getT s block is semantically equivalent to the empty statement Its effect is to temporarily surrender the processor to another process Eventually the scheduler will return the pr ocessor unharmed to the blocked process is used by which is implemented as while sTeep is a variant of b1 ock which does not preserve registers 40 47 or a0 a6 On the Motorola 68000 6 p i is s implemented as a system call trap 82 while block i is as push sleep pop namely moveml FFFE sp8 trap 82 7 movem g 7FFF spQ The two movem1 s together require 290 68000 cycles or 36 micr on MHz 68000 Thus context switching efficiency may be improved substantially by use of sleep together with alternative ways to preserve needed registers such as saving them most of them on entry to a body of code that executes sleep repeatedly For many applications however the load buffering capability of Sunos should make context switchin
77. or Also you may omit the 01 extension in most cases i e L dix test should be equivalent to L dix test d unless both test d and test are S record files 3 4 2 Net loading If you have network monitor and an ethernet interface you mai oad programs over the ethernet 7 Program files to be loaded in this way should be in reversed b out format this means that a file produced by the loader should be converted using the rev68 command or the r flag of cc68 should be used in compilation Files in this format often have a r extension but sometimes they have either a Boot extension or no extension at all Suppose you want to load the file mnt person test r You should give the command F mnt person test 20 You should almost immediately get a new monitor prompt You may then start your program xd the G command normally the current PC is set by the net loader to be the entry point of the program Alternatively you may give the load and go command N mnt person test r which will load the file and immediately start it If the net loader fails to load the file it will print a period and try again up to a reasonable limit If it gives up it will print Timeout and return to the monitor Even if a file is not successfully loaded it is quite probable that the memory has been altered If you get an exception when net loading a file it may be because there is a hardware problem but it is more
78. p If you type MACSbug commands at any point the prompt reverts to TR n will trace steps printing trace information on cach step To trace steps without any printout at 11 DECEMBER 1981 THE MOTOROLA 68000 DESIGN MODULE 41 all do TD CL see below 5 5 5 Trace Display Whenever MACSbug interrupts your program by reaching a breakpoint or after one instruction in the case of tracing or when you type TD it types out selected information The default is that it types out the contents of all the registers You may modify this default as follows Each TD command is sticky i e its effect is felt till you give another TD command TD CL Displays nothing Tu be combed asin TD CL PC TD ALL Restores the default 020 Displays PC similarly TD PC TD SR but not TD Dor TD A TD D0 0 Do not display D similarly TD PC 0 TD SR 0 5 TD D0 1 Display significant byte of PC TD 00 2 Display lower word of DO TD 00 3 Display lower three bytes of only effective after TD CL The short forms are helpful in two ways they give a less cluttered display and they permit tracing to happen faster TD CL permits multistep tracing as in TR n to proceed independently of the terminal speed _ though not at full machine 7 unfortunately To see the final register values when the tracing stops do TD ALL then TD You may also turn words of memory into pseudoregisters which can then
79. patient s program counter stack pointer status register and error code reason for invoking the physician The rest of the patient state is accessible Physicians are expected to be implemented with system supplied routines as a rule and are not themselves candidates for diagnosis and debugging this is a strict two level approach rather than a hierarchical one The physician inherits all the capabilities read write execute access rights of its patient together with write capability for the patient s state cpu registers and stack and read capability for all code ior which the patient has execute capability cn service provides an additional capability for code 7 2 Stream oriented Services Streams provide a form of communication between processes in which one process may write a sequence of data into the stream and any number of processes may read that sequence from the stream asychronously The data types supported by Sunos are characters one byte shorts two bytes integers four bytes references four bytes garbage collected Streams are type homogencous only one of the four possible types of data may appear in a stream Streams are accessed by stream references which are values of type either char short or int in C sense Sunos provides the equivalent of s d for storing a datum d into a stream referenced by s and s4 for fetching a datum from stream referenced by s It is not pos
80. rimarily deallocation of resources which though it may be handled by any component of the poc is for greatest m left to specialist programs running in user state zi af R 6 Reading or vriting of internal process memory Calloc does not reference internal process memory making it independent of decisions about how system state processes access memory normally accessed in user state Although the SUN 1 makes system state access to user state memory as easy as access to system state memory future boards may vary this Calloc is immune to such variations 7 Capability management No global system of capability management is envisaged for SUNOS The definition and use of capabilities is intended to be a matter of agreement between consenting processes The set of rights and duties of internal processes from Calloc s point of view provides an example of this This philosophy is part of thc overall decentralization philosophy of SUNOS 8 Interprocess communication No global system of interprocess communication is envisaged for SUNOS Instead it is expected that a variety of interprocess communication protocols will be used one or two of which may come to dominate on account of their combination of general applicability and high efficiency Calloc offers enough services to permit quality care of the patient by its physician including 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM _ amp e Full access by the physician
81. roduced by the compiler or written by hand Compiler produced S files are usually not seen by the user except for detailed optimization or debugging These used to be called a68 files but 6668 used s which unfortunately conflicts with all other assembler files such as VAX assembler files bos Binary files the output of the assembler none The default output of the linker is the file name b out Usually an explicit output file will be Specified with the o option the name of the program without any suffix If the file is 11 DECEMBER 1981 _ 6 SUN USERS GUIDE generated on a machine with non standard byte order such as a VAX the r format should bc the final result E Byte reversed files produced by rev68 ready to be loaded over ethernet In actual practice the r suffix tends to not actually appear d1 Motorola down line load format called S records Used to load Over slow serial lines The three most often used options of 6668 are o lt name gt which means the the output will be named lt name gt c which specifies a separately compiled module and 0 which causes the optimizer to be invoked Terminal Loading 0068 6 0 9 Other b files and libraries 6668 c file s 0668 8 Network Loading n file Figure 2 1 Developing Software with Unix The make program simpifics the construction of programs using scveral modules 6 Just create a file called makefile or Make
82. ry locations 400 to 44B inclusive in the order PC SR DA US where A7 is taken to be SS the system stack pointer rather than US presumably since it happens to be dumped while in system mode 5 5 2 Setting E set register to value V type R V as in D3 247 These settings will take effect on the processor proper as soon as you type To set all of the D registers say D and MACSbug will show you each in turn for each you should either type return if you want it unchanged or a value return if you wan to change it to that value gt Set Memory say SM address lt value lt value The values will be stored starting in that address immediately Values may be from 1 to 8 hex digits Each value is stored in the next few bytes as few as possible consistent with the number of digits no zero suppression Thus SM 4000 12 34567 DM 4000 004000 12 03 45 67 SM 4000 00004321 6547 DM 4000 004000 00 00 43 21 65 47 11 DECEMBER 1981 _ 40 0 SUN USERS GUIDE 5 5 3 Breakpoints To set a breakpoint use the command BR lt address gt 57 Your program will stop when it reaches that address This is implemented by placing a 434F TRAP 15 instruction at that address not at the BReak command but at the G command The instruction is removed after it has had its effect it will be restored again at the next Note that CALL described below docs not install the breakpoints The eff
83. s of the pointer In effect a pointer has two components a pointer to the start of the buffer and an offset from that start Unlike other ways of forming two element structures this approach has the benefit that the Structure forms an ordinary machine address that can be used as an indirect reference and incremented in the usual ways W hen the size of the buffer is not known it may be determined by trying all sizes in decreasing order and for each masking out the iow order bits of the pointer as in the case when the size is known The largest size yielding a header which a is within the storage region allocated to this scheme and b contains this size in its size field is the size of the containing buffer The correctness of this method depends on the observations that a every address within a buffer yields the buffer header using SOME mask and b every mask larger than must yield some buffer header The advantage of this approach is that processes that know the buffer size in advance can run faster while processes that don t such as postmortem diagnosers can still find their way around given only pointers into buffers 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM NM 3 7 6 4 Asynchronous Access The question now arises as to asynchronous reading and writing can a reader get a consistent picture of a string while it is being written In general a certain amount of explicit synchronization of independent pro
84. set to be a space Opening a memory word map register or processor register means that the address or register name is displayed along with it current contents You may then type a new hexadccimai value or simply return to go on the next address or register Typing Q will get you back to command level For registers next 11 DECEMBER 1981 USING THE SUN PROCESSOR 2 means within the sequence 00 07 A0 A6 SS US SR PC For example the following commands set location 1234 to 5678 and register D1 to 00 T he user types the underlined parts with a return a thc end of each command e 1234 001234 23CF 5678 001236 0000 q gt d DO 00000001 Di 00000231 0 D2 01203405 q 5 3 4 Loading Programs One of the primary uses of the monitor is to load programs into the processor s memory Programs can either be loaded via a serial line connected to a host computer refered to as down line loading or via the ethernet refered to as net loading In usual terminology down line loading often refers to any method loading one computer from another but it is useful to make the distinction here Net loading is usually much faster but both modes have their advantages and disadvantages 4 4 Down line Loading Down line loading involves transferring a program file over a serial line The file must be converted into 4 format known as S records before transmission either using the d
85. sible however to use s d and s directly due to discontinuities in the internal representation of streams and the need to garbage collect 11 DECEMBER 1981 54 mE _ SUN USERS GUIDE streams Stream references have many of the attributes of ordinary pointers They may be assigned to variables passed as arguments to functions and returned from functions In passing them around however they may not be duplicated implicitly but must be copied explicitly with the Sunos function dupref s Thus if the assignment s2 sl is performed and then both sl and 52 are subsequently used as references to the same stream the assignment must be rewritten as s2 dupref sl Pointer arithmetic is not permitted nor may pointers be compared with each other since distinct pointers may point to the same place in a stream Streams are defined entirely independently of Calloc They do not take advantage of the atomicity catered for by Calloc but rely on nonblocking methods for accomplishing mutual exclusion at all potential interaction sites This permits streams to be used in common by both internal and external processes reducing the variety of communication primitives required in the system It is possible to perform all interprocess communication via streams t is intended that even transactions that might ordinarily be handled for the sake of efficiency by block moves be handled by streams for the sake of uniformity of communication The
86. st c 11 DECEMBER 1981 USING THE SUN PROCESSOR mS 19 main A simple tst program for the SUN workstation printf Hello world An We now compile the program with the following command cc68 r o test test c We then go to our workstaion and type the command to load and run n mnt smith test Hello world 3 3 The ROM Monitor Commands The command format understood by the monitor is quite simple It is lt verb gt lt space gt lt argument gt lt return gt The verb part is always one alphabetic character case d s not matter space gt means that any number of spaces is skipped here argument is normally a hexadecimal number or a single letter again case does not matter As indicated by J the argument portion may be optional When typing commands backspace and delete also called lt rubout erase one character control U erases the entire line The commands are An Open A register n 0 lt n lt 6 See the discussion below of open B Seta breakpoint You will be n with the old breakpoint address give the new address at which you want a brcakpoint trap instruction inserted C addr Continue a program The address addr if given is the address at which execution will begin Da Open D register 0 gt 7 E addr Open the word at memory address addr odd addresses are rounded down F Pootfile name Load but do not
87. t is in Prom so learn to live with it If you run your terminal at 9600 baud and the host at 1200 baud a sensible arrangement for at home you will hit the obvious snag when you use P2 As should be clear from the above discussion while you must change your terminal s speed you need not change ACIAT s speed A more brute force way of getting out of transparent mode is to press the resct button on the design module the black one This will clobber the registers and resct MACSbug however Pressing the red abort button does not leave P2 mode but makes MACSbug forget that PZ mode is on leaving ina confused State 2 5 9 Merion Layout Memory in the Motorola Design Module is laid out as follows 0 3FF 0 Interrupt vectors 400689 MACSbU variables 6BA FFF MACSbug symbol table 1000 C00 m User space 7E00 7EFF User Sock ma be taken if necessary chay 7F 00 7 uz stack ne system user distinction is vague on this board 11 DECEMBER 1981 AN INSIDER S GUIDE TO SUNET 45 6 An Insider s Guide to SUNet This chapter describes the current state of network communication around here Ethernet is used to connect computers within the same building with repeaters and gateways being used to temporarily extend the Ethernet between buildings Arpanet connects several machines and some are connected to Telenet Tymnet and other ad hoc networks Eventually we hope
88. t while running in another context Since there may be no properly initialized segments in a given context it is not 11 DECEMBER 1981 USING TI IE SUN PROCESSOR x possible for the kernel to simply switch contexts before changing the segment map this operation must be done by code running entirely in ROM and processor registers The memory management EMTS provide this service Note that it is essential that the context register not be changed except via the EMT described below short emte getsegmap cxt segno int cxt int segno Returns the contents of segment map entry number segno in context number cxt emte setsegmap cxt segno entry int cxt int segno Short entry Sets segment map entry number segno in context number cxt to entry int emte getcontext Returns the current value of the context register emte setcontext cxt int cxt Sets the context register to cxt Here is an example of the use of the ticks global to derive an accurate timer counting seconds Warning a previous version of this example contained a program logic error that rendered it inaccurate main long NextTick value of RefrCnt at next second long ThisTick temporary used to avoid a race long seconds 0 ThisTick emtticks initialize loop invariant for printf Time 15 d n secondstt NextTick ThisTick 1000 predict next second while ThisTick gt NextTick busy wait
89. tely A timeout input is a signal from the timer that this process s time is up The following state transition table covers the case when exactly input has arrived As we care only about the current process here the initial states are normal running suspended running normal retiring and Sleep terminated suspended retiring INPUT error terminate sleep timeout STATE m PME norm run susp run terminated norm sleep susp run norm ret susp run terminated terminated susp sleep norm run susp ret norm ret terminated terminated norm sleep terminated terminated susp ret terminated terminated susp terminated t is possible for any combination of i error il one of terminate sleep or run and timeout to occur simultaneously If error is present then terminate slecp and run requests are ignored though the request is stored as part of the error state of the patient Otherwise multiple inputs are processed as though they had arrived sequentially in the order given in the table Thus error and timeout together take a running patient first to a running physician and then to a retiring physician For the case of sleep with timeout we add the _ condition that timeout of a sleeping process has no effect Thus a returning patient that gets its sleep request in just as the timeout arrives survives by the skin of its teeth 7 5 9 Calloc Services We now detail the services provided by Calloc
90. tever pages likely to contain the top of the Supervisor stack should not be remapped or memory refresh may pio However for simple programs the initial mapping may be best left alone Segment Map o 3 2 x i ew 0 1024716 Page Map 1024 16 68000 Reserved m Reserved i Protection 12 E EN physical Adress address Space i Page Control 23 bits 11 L Protection Page Control Address Space execute accessed m onboard read moditied offboard write 1 0 user Invalid Figure 3 2 Memory Mapping on the SUN Processor Each actually existing page of on board RAM is initially mapped so that its physical and virtual addresses 11 DECEMBER 1981 SUN USERS GUIDE are identical This means that each segment starting at segment 0 is fully mapped up to the limit of available memory Segments are only initialized for context 0 Segment protection is set so that both Supervisor and User modes have Read Write and Execute access to every segment Two other physical address spaces are mapped into the memory address space The first 64K bytes of MultiBus I O space is mapped at the top of the virtual address space and extends for 32 pages 64K bytes Thus addresses from 1F0000 to IFFFFF get mapped to the Multibus I O space The Ethernet interface and most commercially available Multibus I O devices use this space The rest of the hi
91. ume Currently the only available options are vm for the Design Module and the default for the SUN X Discard locals starting with L weaker than x This option is used by 6668 to discard internally generated symbols DECEMBER 1981 SOFTWARE DEVELOPMENT ON UNIX 9 Discard all local symbols from the output file 2 2 4 Producing Loadable Files The binary produced by the linker is converted into a file suitable for down line loading by most PROM monitors with the d168 program The only d168 option is T sr which specifies s as the starting address The input file must be the first argument options other than T are ignored in silence Symbol tables are preserved See section 5 3 or 3 3 for information on actually loading the design module or SUN processor The rev68 program takes linked out files and does some final byte reversing if the target machine has a different byte order than the current machine 2 3 Header Files in us r sun include Several useful header files are located i in the usr sun include directory This directory is searched automatically by the C preprocessor when you use Z include directives amd9513 h bouth buserrh charsh framebuf h graphics h graphmacs h lisp h m68000 h m6821 h m6840 h Dehnitons for AMD9513 timer chip Jeff and several others have their own private versions of this file Please complain to them about it and the relationsh
92. up the control registers and one of the coordinates Then this bit is set to actually perform the desired modification of the frame buffer Bits 14 and 15 select the operation If they are set to GXnone then the data on the data bus is not used although an X or Y address may be loaded in this cycle If they set to GXothers then of the four control registers will be written with the data If they are set to GXpat the pattern register sometimes called the mask will be loaded from the data bus If they are set to GXsource the data bus is loaded into the source register This is the normal case for copy operations When GXothers is specified the control register number is given in bits 1 and 2 GXfunct ion loads the function register from the low order eight bits of the data bus The function register can be thought of as a bit 11 DECEMBER 1981 34 SEA SUN USERS GUIDE 13 12 11 10 1 Unit ress Buffer Address 2 1 7 0to3 No Operation Function Width Control 0 1 2 3 Interrupt clear 1 Load Control Registers 2 Load Pattern Register 3 Load Source Register Figure 4 4 Graphics Board Address Decoding vector indexed For example GXinvert 0x55 inverts the destination GXcopy 0 copies the source to the desitination and GXc Tear 0 clears the destination _ GXwidth is the register that determines the width of th
93. ure 4 4 Figure 6 1 Major SUN Workstation Components Developing Software with Unix Layout of the SUN Processor Board Memory Mapping on the SUN Processor The SUN Graphics Board The SUN Graphics Screen RasterOp Concept Graphics Board Address Decoding Topology of SUNet 11 DECEMBER 1981 INTRODUCTION 57 ae 1 1 Introduction QE 0 SUN is the Stanford University Nelwork This is an on going effort of several groups within Stanford University to provide a local computer network for Stanford University 2 based on inexpensive but high performance workstations 3 The network currently connects several time sharing systems 7 in the Computer Science and Electrical Engineering Departments with plans to extend the network to the rest of the campus 16 The processor architecture in the workstation is the Motorola MC68000 The workstation uses the Intel Multibus which is proposed IEEE standard 796 so many other common peripheral interfaces are comercially available Workstation is used instead of personal computer or terminal to emphasize the flexibility of the design Multibus 68000 Graphics Ethernet Processor System Interface Keyboard Display Ethernet Figure 1 1 Major SUN Workstation Components There are currently several operating systems being developed for the SUN workstation Perseus 11 is a distributed operating system based on messages and links 4 that has been evolving for sever
94. ut that s how you have to talk to MACSbug Dasm understands symbols if present in the symbol table When loaded it brings its own symbols with it _ you have to load the program to be debugged after you ve loaded Dasm This will be fixed soon Hal 5 8 P2 P2 mode on the 68000 i is soiva and hardwar combination that splices out the 68000 from the terminal host path it normally intercepts This is accomplished when you type P2 to MACSbug by setting the RTS bit of 1 high Random logic attached to this bit then routes input to one serial connector of the board directly to the output of the other serial connector Terminal host traffic then proceeds at a rate dependent only on the host and the terminal MACSbug monitors the terminal to host traffic it is physically possible to read the traffic in either direction and exits from P2 mode when tA is seen This assumes that the speed of 1 is set to agree with that of the traffic which it need not be The tA is the default escape to set some other escape say tV type P2 tv Since the tA is scen by the host and MACSbug simultaneously there is no way in this arrangement to prevent sending the escape to the host so like any wise jailbird you should plan your escape carefully MACSbug adds 11 DECEMBER 1981 4 SUNUSERS GUIDE insult to injury however by transmitting 1X to the host after secing the tA Unlike the tA the is not a default bu
95. utomatically inserts the figures in their proper places To get the entire manual simply use the commands cd usr sun doc cz manual press 1 2 Related Documentation l The architecture of the MC68000 procesor and a d lon of the processor chip can be found i in Motorola s User s Manual 13 There several books describing the 68000 architecture 9 10 Most Hardware is described in separate manuals or data sheets 2 The hardware manual currently somewhere on Sail describes the processor and graphics boards designed at Stanford Someday we should convert this into Scribe and merge it into this manual 3 The Documentation for Unix can be found in the standard Unix 15 and Berkeley manuals Most of this is stored on the large Unix systems and available through the man and apropos commands Some specific MC68000 Unix commands are described in the next Chapter 4 The Perseus documentation under IFS Perseus Perseus is a distributed operating system currently under development There are probably a dozen CS246b projects that arc related the documentation of which is scattered throught the world Unix is a trademark of Bell Laboratories 11 DECEMBER 1981 Dur WAKE DEVELOPMENT ON UNIX 2 Software Development on Unix Currently our development work is being done on a VAX 3 computer running the Unix operating system With any luck Unix may soon be running on the 68000 itself
96. while operating in user mode will result in an error return 3 8 1 Information EMTs int ente ticks Returns the number of milliseconds since the monitor was last booted This is incremented whenever memory is refreshed at least every 4 milliseconds The accuracy is sufficient for time of day uses if the crystal on the processor card is working right int emte getmemsize Returns the size of the on board RAM in bytes dnt emte version Returns the version of the ROM monitor the most significant byte is the major version number the next byte is the minor version number For example 0x0105 corresponds to version 1 5 _ 3 8 2 1 0 EMTs _ emte putchar c char c Prints the specified character on the Console If c is a linefeed or a carriage return then it is followed by a carriage return or a linefeed respectively The I O is done using busy waiting char ente getchar Returns the next character typed on the Console keyboard Normally the charge is also echoed on the Console The I O is done using busy waiting setecho flag int flag Controls whether characters input from the Console by emte getchar are echoed or not they are echoed if and only if f 1ag is true 3 8 3 Memory Management EMTs These EMTs are provided for use by the kernel of an operating system and are restricted to supervisor mode only They are necessary because it is not possible to access the segment registers for one contex
97. wise you will probably want to start the program using the G 11 DECEMBER 1981 USING THE SUN PROCESSOR 27 command Execution will then proceed until the trap is reached at which point you will get a message such as Break at 001000 At this point you may examine the location at which you set the and you will find that it contains the original instruction You may clear the DPT or set a new one at this point If y u do not you may continue using the 6 command which will execute the broken instruction then reset the BPT and continue If you give an ddress to the C command the breakpoint trap will not be reset unless for some reason you take a Trace trap If you load a new program while a BPT is set the monitor will normally be able to detect this On the other hand if you give the K command Soft Reset while a is set and then set a new one wicrd things will happen if the first trap is taken Jeff should fix this 3 7 2 Trace traps 7 The support for Trace traps single stepping a user program is even more minimal than the support for Breakpoint traps set a trace trap you should use the R command proceed to the Status Register SR and alter it so as to inclusive OR it with 0x3000 Similarly the trace trap can be cleared by ANDing the value of SR with OXTFFF the bit is set in the SR you should then give the C command to continue the program the G command cannot be used
98. y pass references around freely provided they observe the discipline of using dupref p to make duplicate copies of references and dispose p to dispose of those duplicates A reference may be used either for reading or vvriting so long as it is consistently used for that Only one reference to a given stream may be used for writing but any number of independent references may be used for reading permitting independent processes to read the same stream each at its own speed A file using SUNOS should include suni o h and should contain a sunos function which should be confined to spawning an initial set of processes and creating and passing streams to them The spawned functions are animated brought to life after sunos exits There should be no main function in the file this being provided by the library If the user does provide a mai n it will be substituted for the library supplied main in which case to ensure an orderly startup of sunos it should be modelled on the library version for which the source is in usr sun sunos sunos c The library supplied ma 1n initializes the stream and process managers and the interrupt handlers then calls strtcal to start up calloc and finally exits to by executing a sleep strtcal in turn initializes calloc and calls the user supplied sunos to create the initial processes which come to life after main goes to sleep The char streams stdin and stdout are predef
99. y those registers it needs immediately which is the same protocol observed in the C calling sequence for d lar subroutine calls whence should not be counted as an additional overhead 11 DECEMBER 1981 SUNOS A SMALL OPERATING SYSTEM m 57 The cost of reading and writing data in a strcam decomposes into typical and boundary buffer discontinuity costs We first give the costs if the efficiency oriented operations are used assuming the stream pointers and data are held in registers The typical cost of writing a datum is 4 instructions while the boundary cost is 90 instructions The typical cost of reading a datum is 2 instructions while the boundary cost is estimated at 40 instructions though has not been checked With buffers holding say 240 data the average cost of a write and read transaction is then 4 2 40 240 or approximately 6 5 instructions Measurements suggest that the cost of a transaction along with a minimal amount of computation on the data being transacted adding up a stream of chars requires about 20 microseconds on an 6 Mhz 68000 which is in line with the analytic prediction if we allow 7 microseconds for the associated computation 7 5 Calloc A CPU Allocator for the Motorola 68000 7 5 1 Overview l Calloc for Cpu ALLOCator is concerned with allocation of the CPU to internal processes defined as processes running in user state at interrupt level 0 In standard operating system termi

Download Pdf Manuals

image

Related Search

Related Contents

ダウンロード[ 4.861MB]  TV-MONITOR WIDE VISION, d  - Bil-Jax  

Copyright © All rights reserved.
Failed to retrieve file