3 unsigned int counter = 0;
6 unsigned char thestr[512];
7 unsigned char logents[4][41] = {0};
9 unsigned char vgaread(unsigned char idx)
15 void strblit(char *src, int r, int c)
17 char *destp = (char*)(0xB8000UL | (((unsigned int)vgaread(0xC)) << 9) | (((unsigned int)vgaread(0xD)) << 1)) + r*80*2 + c*2;
20 smramc = pci_read8(0, 0, 0, 0x70);
21 pci_write8(0, 0, 0, 0x70, (smramc & 0xF3) | 0x08);
24 *(destp++) = *(src++);
27 pci_write8(0, 0, 0, 0x70, smramc);
34 unsigned char *basep = (char*)(0xB8000UL | (((unsigned int)vgaread(0xC)) << 9) | (((unsigned int)vgaread(0xD)) << 1));
36 smramc = pci_read8(0, 0, 0, 0x70);
37 pci_write8(0, 0, 0, 0x70, (smramc & 0xF3) | 0x08);
38 for (y = 0; y < 4; y++)
39 for (x = 40; x < 80; x++)
41 basep[y*80*2+x*2] = ' ';
42 basep[y*80*2+x*2+1] = 0x1F;
44 pci_write8(0, 0, 0, 0x70, smramc);
46 for (y = 0; y < 4; y++)
47 strblit(logents[y], y, 40);
53 memmove(logents[0], logents[1], sizeof(logents[0])*3);
54 strcpy(logents[3], s);
60 static int curdev = 0; /* 0 if kbd, 1 if mouse */
71 strcpy(s, "READxxxxxxxxxxxxxxxx");
73 b = inb(cts & 0xFFFF);
75 if ((cts & 0xFFFF) == 0x64)
76 curdev = (b & 0x20) ? 1 : 0;
77 if ((curdev == 0) && ((cts & 0xFFFF) == 0x60) && (b == 0x01))
80 *(unsigned char*)0xAFFD0 /* EAX */ = b;
87 strcpy(s, "WRITxxxxxxxxxxxxxxxx");
88 b = *(unsigned char*)0xAFFD0 /* EAX */;
92 outb(cts & 0xFFFF, b);
96 dolog("Unhandled PCI cycle");
102 unsigned char smramc;
103 static int first = 1;
105 pcisave = inl(0xCF8);
106 vgasave = inb(0x3D4);
111 dolog("NetWatch running...");
115 outb(0x80, (counter & 0xFF));
117 strcpy(thestr, "15-412! xxxxxxxx xxxxxxxx");
118 tohex(thestr + 8, inl(0x0834));
119 tohex(thestr + 17, counter);
120 strblit(thestr, 0, 0);
122 if (inl(0x834) & 0x20)
123 dolog("Warning: unhandled APM access");
124 if (inl(0x834) & 0x1000)
126 if (inl(0x844) & 0x1000) /* devact_sts */
133 if (inl(0x834) & 0x4000)
134 dolog("Long periodic timer");
135 if (inl(0x840) & 0x1000)
137 dolog("Caught device monitor trap");
142 if (inl(0x834) & ~(0x4160))
145 strcpy(s, "Unknown: xxxxxxxx");
146 tohex(s + 9, inl(0x834) & ~(0x140));
153 outl(0xCF8, pcisave);
154 outb(0x3D4, vgasave);
157 outl(0x834, /*0x40*/0xFFFF); // ack the periodic IRQ
158 outb(0x830, (inb(0x830) | 0x2) & ~0x40);
159 outb(0x830, inb(0x830) | 0x40);