nbreceive is used to permit alternately accepting messages if available and

Nbreceive is used to permit alternately accepting

This preview shows page 58 - 60 out of 140 pages.

nb_receive , is used to permit alternately accepting messages, if available, and testing the keyboard for input, which can be expected to be one of the options suggested in the message Hit ESC to reboot, DEL to shutdown, F-keys for debug dumps printed on entering this function. In the next section we will see the code that implements do_newkmess and do_diagnostics. 3.8.6. Implementation of the Display Driver The IBM PC display may be configured as several virtual terminals, if sufficient memory is available. We will examine the console's device-dependent code in this section. We will also look at the debug dump routines that use low-level services of the keyboard and
Image of page 58
display. These provide support for limited interaction with the user at the console, even when other parts of the MINIX 3 system are not functioning and can provide useful information even following a near-total system crash. [Page 358] Hardware-specific support for console output to the PC memory-mapped screen is in console.c. The console structure is defined on lines 15981 to 15998. In a sense this structure is an extension of the tty structure defined in tty.c. At initialization the tp- >tty_priv field of a console's tty structure is assigned a pointer to its own console structure. The first item in the console structure is a pointer back to the corresponding tty structure. The components of a console structure are what one would expect for a video display: variables to record the row and column of the cursor location, the memory addresses of the start and limit of memory used for the display, the memory address pointed to by the controller chip's base pointer, and the current address of the cursor. Other variables are used for managing escape sequences. Since characters are initially received as 8-bit bytes and must be combined with attribute bytes and transferred as 16- bit words to video memory, a block to be transferred is built up in c_ramqueue, an array big enough to hold an entire 80-column row of 16-bit character-attribute pairs. Each virtual console needs one console structure, and the storage is allocated in the array cons_table (line 16001). As we have done with the tt y and other structures, we will usually refer to the elements of a console structure using a pointer, for example, cons- >c_tty. The function whose address is stored in each console's tp->tty_devwrite entry is cons_write (line 16036). It is called from only one place, handle_events in tty.c. Most of the other functions in console.c exist to support this function. When it is called for the first time after a client process makes a write call, the data to be output are in the client's buffer, which can be found using the tp->tty_outproc and tp->out_vir fields in the tty structure. The tp->tty_outleft field tells how many characters are to be transferred, and the tp->tty_outcum field is initially zero, indicating none have yet been transferred. This is the usual situation upon entry to cons_write, because normally, once called, it transfers all the data requested in the original call. However, if the user wants to slow the process
Image of page 59
Image of page 60

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20
  • ASCII

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors