Warning, cross-references for /kernel/sysprogs/terminal_server.c need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <stdio.h>
0019 #include <string.h>
0020
0021 static char *pchVideo = (char *) 0x000200000;
0022
0023 static int
0024 _putchar (int ch, int attribute)
0025 {
0026
0027 static int x, y;
0028
0029 if (ch == '\n') {
0030 x = 0;
0031 y++;
0032
0033 if (y > 24) {
0034 memcpy (pchVideo, pchVideo + 160, 24 * 160);
0035 memset (pchVideo + (24 * 160), 0, 160);
0036 y = 24;
0037 }
0038 return (int) (unsigned char) ch;
0039 }
0040
0041 if (y * 160 + x * 2 >= 0x1000) return ch;
0042
0043 pchVideo[y * 160 + x * 2] = ch;
0044 pchVideo[y * 160 + x * 2 + 1] = attribute;
0045 x++;
0046
0047 if (y * 160 + x * 2 >= 0x1000) return ch;
0048
0049 pchVideo[y * 160 + x * 2] = ' ';
0050 pchVideo[y * 160 + x * 2 + 1] = attribute;
0051
0052
0053 outb (0x0E, 0x3D4);
0054 outb ((y * 80 + x) >> 8, 0x3D5);
0055 outb (0x0F, 0x3D4);
0056 outb ((y * 80 + x) & 0xFF, 0x3D5);
0057
0058 return (int) (unsigned char) ch;
0059 }
0060
0061
0062 void
0063 splash_screen (void)
0064 {
0065
0066 char line1[80];
0067 char line2[80];
0068 char *p;
0069 int i;
0070
0071 uname (line2);
0072
0073 sprintf (line1,
0074 "**** Quest kernel version: %s ***** //---\\ \\\\ \\ //-- //--\\ \\\\---\\ \n",
0075 line2);
0076 for (p = line1; *p; p++)
0077 _putchar (*p, 4);
0078
0079 sprintf (line1,
0080 "* Copyright Boston University, 2005 * || | || | ||-- \\\\--\\ || \n");
0081 for (p = line1; *p; p++)
0082 _putchar (*p, 4);
0083
0084 sprintf (line1, "%u", meminfo ());
0085 i = strlen (line1);
0086
0087 for (i = strlen (line1); i < 16; i++)
0088 line2[i - strlen (line1)] = '*';
0089
0090 sprintf (line1,
0091 "******** %u bytes free %s \\\\__\\_ \\\\_/ \\\\__ \\\\__/ || \n",
0092 meminfo (), line2);
0093 for (p = line1; *p; p++)
0094 _putchar (*p, 4);
0095 }
0096
0097 int
0098 main ()
0099 {
0100
0101 int arg;
0102
0103 asm volatile ("movl %%ebx, %0":"=m" (arg));
0104
0105 splash_screen ();
0106
0107
0108 outb (0x0A, 0x3D4);
0109 outb (0x00, 0x3D5);
0110 outb (0x0B, 0x3D4);
0111 outb (0x0E, 0x3D5);
0112
0113 while (1) {
0114 _putchar (arg, 7);
0115
0116 asm volatile ("iret");
0117
0118 asm volatile ("movl %%ebx, %0":"=m" (arg));
0119 }
0120
0121 return 0;
0122
0123 }
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134