DOC PREVIEW
UNO CSCI 8530 - The Tempo/32 Operating System

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

11The Tempo/32 Operating SystemPart 8System Call ImplementationLow-Level Input/Output Subsystem2Device Drivers• Device drivers are the primary components of the I/O subsystem.• Each device driver:– is responsible for managing input/output on a single type of device at the lowest level by managing the device’s controller– is not (normally) called from user mode (usually can’tbe called from user mode)– frequently presents a “normalized” interface to the kernel3Devices and Device Controllers• The distinction between devices and their controllers is sometimes blurred– A serial port is usually a single chip (e.g. an 8250 or 16550)– A modern (IDE or SCSI) disk has a built-in controller– A display has a monitor and a video “adapter”that usually has many components• A common practice is to allow one controller to support multiple devices4Controllers and DevicesSystem BusCPU MemoryControllerIDE DiskControllerIDE DiskThe controller in this drive is inactive.Serial PortSerial Device (e.g. a modem)Keyboard (with 8042 chip)PPI: Programmable Peripheral InterfaceVideo Adapter Monitor5Buses: ISA, PCI, USB, AGP• Although simple diagrams (as in the previous slide) show only one bus with everything connected to it, modern systems have many interface buses. For example:– ISA (Industry Standard Architecture): found in older PCs– PCI (Peripheral Component Interconnection): modern replacement for ISA– USB (Universal Serial Bus): frequently used to connect external devices– AGP (Accelerated Graphics Port): based on enhancement of PCI for video adapters6Bridges• How do all these buses connect in a PC?• Answer: bridges!• A bridge is essentially a device (chip) that maps signals between bus formats (synchronization, data, control, etc.)• A common PC architecture has a “north” bridge between the host bus and the PCI, and DRAM (memory) buses; the “south” bridge connects the PCI bus to the ISA, USB, IDE, and AGP buses.• But – many different organizations are possible!27CPU 1CPU 2CPU n. . .NorthBridgeMemory (RAM)Memory (RAM)Video ControllerAGPPCISouthBridgeUSB ATASATASCSIEthernetISAFirewire,Audio,etc.8Another illustration of the bus/bridge configuration of a modern PC (from www.extremetech.com)9Device Classes• Devices are commonly separated into two classes for ease of organization:– Block devices: those which have addressable blocks of data (e.g. disks, CDs, DVDs); device drivers must be given a block number, a read/write command, and a buffer in each request– Character devices: everything else; device drivers transfer only one or a few bytes at a time, but must still have a read/write command and know where to get/put the data.10“Normalized” Driver Interface (1)• In most UNIX implementations each device in each class has two numbers:– major: identifies the controller for all devices of the same type (i.e. all IDE disks will have the same major device number)– minor: identifies an instance of the device (i.e. each individual IDE disk will have a unique minor device number)• Two arrays of structures (bdevsw and cdevsw) are indexed by the major device number to locate entry points to device drivers.11“Normalized” Driver Interface (2)• Block device driver entry points:– d_open – open a device– d_close – close a device– d_strategy – read or write a block– d_ioctl – I/O actions other than read or write• Character device driver entry points– d_open – open a device– d_close – close a device– d_read, d_write – read or write a block– d_ioctl – I/O actions other than read or write12Tempo’s Device Drivers• Tempo doesn’t (yet) use a “normalized”device driver format.• Each device driver is represented by a system call for the most common actions.• Device-specific Tempo system calls:– rdc – read next keyboard character– conout – write character to the display– diskio – read/write a disk block– asynchio –asynchronous disk I/O request313rdc: basics• Basic data structures:– kbdata: circular queue with at most NKEYSentries, each containing one character code. frstkey is index of first unused character code.– keysem: semaphore with count equal to number of entries in kbdata14rdc: pseudocode• Down on semaphore keysem with specified timeout• Return TIMEOUT if down timed out.• Copy kbdata[frstkey] to result.• Increment frstkey modulo NKEYS.• Return result.15Keyboard Interrupt Handling (1)• Each key press or release generates an interrupt (0x21, IRQ 1)• When a keyboard interrupt is handled– PIC reenabled– Keyboard status register read (to clear interrupt request)– Keyboard data register is read and used as argument to kybdisr(second-level handler)– When kybdisr returns, continue at isr30i (normal system call return activity)16Keyboard Interrupt Handling (2)• The kbtoa function is called with the key code as an argument. It returns NOCHAR if no charactercode should be returned.• If the code indicates a virtual console switch should happen, do it (by calling setvidpg) and return.• If the keyboard buffer is full, the character is ignored.• Add the character code to the circular queue.• If no processes are awaiting input, increment the keysemsemaphore’s count.• Otherwise, awaken the first waiting process (remove from the delta queue as appropriate); if it’s priority is higher than that of the running process, arrange for a context switch.17Text-Mode Video Display (1)• Almost every video adapter in every PC ever made supports text in the same way.• The generic chipset used has only a few significant features:– Video RAM (usually at physical address 0xb8000) is treated as 16-bit values• High-order 8-bits control foreground/background color, blinking, underling, etc.• Low-order 8-bits contain a character code• Standard 25 row, 80 column screen needs 4000 bytes– Most adapters have more than 4000 bytes available, so multiple “pages” can be maintained, but only one can be displayed at a time.18Text-Mode Video Display (2)– A pair of 8-bit wide adapter registers (12 & 13) contain the offset of the 16-bit item in video RAM that is to be displayed in the upper-left corner of the display. Following bytes used to fill remainder of display.– Another pair of registers (14/15) contain the offset in video RAM of the position where the visible cursor is located.419setvidpg: select a video page• Check requested page number; return error


View Full Document

UNO CSCI 8530 - The Tempo/32 Operating System

Download The Tempo/32 Operating System
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view The Tempo/32 Operating System and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view The Tempo/32 Operating System 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?