Annotation of coherent/d/conf/tboot/monitor.c, revision 1.1

1.1     ! root        1: /* Mini-monitor for testing boot code.
        !             2:  *
        !             3:  * La Monte H. Yarroll <[email protected]>, September 1991
        !             4:  */
        !             5: 
        !             6: 
        !             7: #include <ctype.h>
        !             8: #include <canon.h>
        !             9: #include <sys/types.h>
        !            10: #include <sys/ino.h>
        !            11: #include <sys/inode.h>
        !            12: #include <sys/dir.h>
        !            13: #include "tboot.h"
        !            14: 
        !            15: #define PROMPT ": "
        !            16: 
        !            17: void
        !            18: monitor()
        !            19: {
        !            20:        int i, j;
        !            21:        uint16 segment, offset;
        !            22: 
        !            23:        char buff[LINESIZE];    /* Buffer for outputing numbers.  */
        !            24:        unsigned char localdata[BLOCK];
        !            25: 
        !            26:        /* Value of ds register, initialized in Startup.s.  */
        !            27:        extern uint16 myds;
        !            28: 
        !            29:        
        !            30:        puts("\r\nWelcome to the tboot mini-monitor!\r\n");
        !            31:        puts("g to continue, ? for help.\r\n");
        !            32:        
        !            33:        puts(PROMPT);
        !            34:        gets(buff);
        !            35:        puts("\r\n");
        !            36: 
        !            37:        while (buff[0] != 'g') {
        !            38:                switch (buff[0]) {
        !            39:                case 'd':       /* Display the next 16 bytes.  */
        !            40:                case 'D':
        !            41:                        /* Fetch the memory we want to examine.  */
        !            42:                        ffcopy(localdata, myds, offset, segment, BLOCK);
        !            43:        
        !            44:                        for (j=0; j < 8; ++j) {
        !            45:                            /* Format is segm:offs 00 00 00 00 etc... */
        !            46: 
        !            47:                            /* Print the segm:offs part for each line.  */      
        !            48:                            print16(segment);
        !            49:                            putchar(':');
        !            50:                            print16(offset);
        !            51:                            putchar(' ');
        !            52:                        
        !            53:                            /* Print one line worth of numbers.  */
        !            54:                            for (i=0; i < 16; ++i) {
        !            55:                                print8(localdata[(j*16) + i]);
        !            56: 
        !            57:                                /* Put in a dash after the eigth byte.  */
        !            58:                                if (7 == i) {
        !            59:                                        putchar('-');
        !            60:                                } else {
        !            61:                                        putchar(' ');
        !            62:                                }
        !            63:                            }
        !            64:        
        !            65:                            /* Print the characters for the numbers.  */
        !            66:                            puts("  ");
        !            67:                            for (i=0; i < 16; ++i) {
        !            68:                                if (isprint(localdata[(j*16) +i])) {
        !            69:                                        putchar(localdata[(j*16) +i]);
        !            70:                                } else {
        !            71:                                        putchar('.');
        !            72:                                }
        !            73:                            }
        !            74:                            
        !            75:                            puts("\r\n");
        !            76:                            /* Position for next line.  */
        !            77:                            seginc(&offset, &segment, 16);
        !            78:                        }
        !            79: 
        !            80:                        break;
        !            81: 
        !            82:                case 'o':       /* Set/print offset.  */
        !            83:                case 'O':
        !            84:                        if ('\0' != buff[1]) {
        !            85:                                offset = basetoi(buff+1, 16);
        !            86:                        }
        !            87:                        puts("Offset: ");
        !            88:                        print16(offset);
        !            89:                        puts("\r\n");
        !            90:                        break;
        !            91: 
        !            92:                case 's':       /* Set/print segment.  */
        !            93:                case 'S':
        !            94:                        if ('\0' != buff[1]) {
        !            95:                                segment = basetoi(buff+1, 16);
        !            96:                        }
        !            97:                        puts("Segment: ");
        !            98:                        print16(segment);
        !            99:                        puts("\r\n");
        !           100:                        break;
        !           101:                        
        !           102:                case '?':
        !           103:                        puts("g       go (return to program).\r\n");
        !           104:                        puts("oxxxx   set offset to xxxx.\r\n");
        !           105:                        puts("sxxxx   set segment to xxxx.\r\n");
        !           106:                        puts("d       display next 16 bytes.\r\n");
        !           107:                        break;
        !           108:                default:
        !           109:                        break;
        !           110:                }
        !           111: 
        !           112:                puts(PROMPT);
        !           113:                gets(buff);
        !           114:                puts("\r\n");
        !           115:        }
        !           116: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.