- Replace broken bootvid by a new bootvid based on TinyKRNL's version. It is a .DLL instead of a .SYS and takes advantage of my patch to FreeLDR which allows us to load DLLs that drivers/the kernel load.

- This new version is also binary compatible, so Windows's bootvid can be dropped instead and our kernel can talk to it. It has been tested under Windows/TinyKRNL.
- Write 90% of the Inbv component in the kernel. Displaying the boot bitmap hasn't yet been coded.
- The HAL is missing required routines for bootvid.dll, so it doesn't work yet.
- .BMP resources haven't yet been added to the kernel. I will add them soon.

svn path=/trunk/; revision=25706
This commit is contained in:
Alex Ionescu
2007-02-03 20:30:32 +00:00
parent f0d898c481
commit ffe900f573
25 changed files with 2729 additions and 1641 deletions
+2 -1
View File
@@ -240,7 +240,8 @@ dll\win32\wsock32\wsock32.dll 1
; Drivers
drivers\base\kdcom\kdcom.dll 2
drivers\base\kdcom\kdcom.dll 2
drivers\base\bootvid\bootvid.dll 2
drivers\base\beep\beep.sys 2
drivers\base\bootvid\bootvid.sys 2
drivers\base\null\null.sys 2
@@ -744,7 +744,8 @@ LdrPEGetOrLoadModule(IN PCHAR ModuleName,
* code, and we'll just call it instead.
*/
if (!_stricmp(ImportedName, "hal.dll") ||
!_stricmp(ImportedName, "kdcom.dll"))
!_stricmp(ImportedName, "kdcom.dll") ||
!_stricmp(ImportedName, "bootvid.dll"))
{
/* Load the HAL */
FrLdrLoadImage(ImportedName, 10);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

+309
View File
@@ -0,0 +1,309 @@
#include "precomp.h"
USHORT AT_Initialization[] =
{
0x10 | CMD_STREAM_READ, // Major Command = 0x10. Minor Command = 0x08.
0x3DA, // Index Status 1 Register Port Address
//
// This Stream performs a USHORT Array Indexed Write at port 0x3C0
//
0x20 | 0x01, // Major Command = 0x20. Minor Command = 0x01.
0x3C0, // Attribute Controller Data Register
0x10, // Loop Count = 16 (Number of Pallette Entries)
0x0, // Index to select (Index = 0, palettes)
0x00, // Palette 0
0x01, // Palette 1
0x02, // Palette 2
0x03, // Palette 3
0x04, // Palette 4
0x05, // Palette 5
0x06, // Palette 6
0x07, // Palette 7
0x08, // Palette 8
0x09, // Palette 9
0x0A, // Palette 10
0x0B, // Palette 11
0x0C, // Palette 12
0x0D, // Palette 13
0x0E, // Palette 14
0x0F, // Palette 15
//
// This Stream performs a UCHAR READ of port 0x3DA
//
0x10 | CMD_STREAM_READ, // Major Command = 0x10. Minor Command = 0x08.
0x3DA, // Index Status 1 Register Port Address
//
// This Stream performs a UCHAR WRITE of value 0x20 at port 0x3C0
//
0x10 | CMD_STREAM_WRITE, // Major Command = 0x10. Minor Command = 0x00.
0x3C0, // Attribute Controller Data Register
0x20, // Set Palette Address Source
//
// End of Stream Marker
//
0x0 // End of command stream
};
CHAR FontData[256 * 13] =
{
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 0
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 13
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 26
0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 39
0x14, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 52
0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 65
0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 78
0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 91
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, // 104
0x14, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 117
0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 130
0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 143
0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 156
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, // 169
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 182
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 195
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 208
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 221
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 234
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 247
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 260
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 273
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 286
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 299
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 312
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 325
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 338
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 351
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 364
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 377
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 390
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 403
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 416
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // 429
0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 442
0x00, 0x14, 0x14, 0x14, 0x7F, 0x28, 0xFE, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, // 455
0x10, 0x3C, 0x50, 0x50, 0x70, 0x38, 0x1C, 0x14, 0x14, 0x78, 0x10, 0x00, 0x00, // 468
0x00, 0x61, 0x92, 0x94, 0x68, 0x18, 0x16, 0x29, 0x49, 0x86, 0x00, 0x00, 0x00, // 481
0x00, 0x18, 0x24, 0x24, 0x38, 0x71, 0x89, 0x8E, 0xC6, 0x7E, 0x00, 0x00, 0x00, // 494
0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 507
0x06, 0x08, 0x10, 0x30, 0x20, 0x20, 0x20, 0x20, 0x30, 0x10, 0x08, 0x06, 0x00, // 520
0x60, 0x10, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x10, 0x60, 0x00, // 533
0x00, 0x10, 0x52, 0x24, 0x3C, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 546
0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xFE, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, // 559
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, // 572
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 585
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, // 598
0x01, 0x02, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, // 611
0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x3C, 0x00, 0x00, 0x00, // 624
0x00, 0x30, 0xD0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, // 637
0x00, 0x78, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00, // 650
0x00, 0x78, 0x04, 0x04, 0x08, 0x30, 0x0C, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, // 663
0x00, 0x08, 0x18, 0x28, 0x28, 0x48, 0x88, 0xFC, 0x08, 0x08, 0x00, 0x00, 0x00, // 676
0x00, 0x3C, 0x20, 0x20, 0x38, 0x04, 0x04, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, // 689
0x00, 0x1C, 0x20, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, // 702
0x00, 0x7E, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, // 715
0x00, 0x3C, 0x42, 0x42, 0x24, 0x3C, 0x46, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 728
0x00, 0x38, 0x44, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x04, 0x38, 0x00, 0x00, 0x00, // 741
0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, // 754
0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, // 767
0x00, 0x00, 0x00, 0x02, 0x0C, 0x10, 0x60, 0x10, 0x0C, 0x02, 0x00, 0x00, 0x00, // 780
0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, // 793
0x00, 0x00, 0x00, 0x40, 0x30, 0x08, 0x06, 0x08, 0x30, 0x40, 0x00, 0x00, 0x00, // 806
0x00, 0x7C, 0x42, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // 819
0x00, 0x3C, 0x62, 0xDE, 0xB2, 0xA2, 0xA6, 0x9B, 0x44, 0x3C, 0x00, 0x00, 0x00, // 832
0x00, 0x00, 0x18, 0x18, 0x24, 0x24, 0x24, 0x7E, 0x42, 0x81, 0x00, 0x00, 0x00, // 845
0x00, 0x00, 0x7C, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, 0x00, // 858
0x00, 0x00, 0x3E, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x3E, 0x00, 0x00, 0x00, // 871
0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00, 0x00, // 884
0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x7E, 0x00, 0x00, 0x00, // 897
0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, // 910
0x00, 0x00, 0x3E, 0x40, 0x80, 0x80, 0x8E, 0x82, 0x42, 0x3E, 0x00, 0x00, 0x00, // 923
0x00, 0x00, 0x42, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, // 936
0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00, 0x00, // 949
0x00, 0x00, 0x3C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, // 962
0x00, 0x00, 0x42, 0x44, 0x48, 0x70, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, // 975
0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00, 0x00, // 988
0x00, 0x00, 0xC6, 0xC6, 0xAA, 0xAA, 0xAA, 0x92, 0x82, 0x82, 0x00, 0x00, 0x00, // 1001
0x00, 0x00, 0x42, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x42, 0x00, 0x00, 0x00, // 1014
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, // 1027
0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x7C, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, // 1040
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x06, 0x03, 0x00, // 1053
0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, // 1066
0x00, 0x00, 0x3E, 0x40, 0x40, 0x38, 0x04, 0x02, 0x02, 0x7C, 0x00, 0x00, 0x00, // 1079
0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, // 1092
0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 1105
0x00, 0x00, 0x81, 0x42, 0x42, 0x44, 0x24, 0x28, 0x38, 0x10, 0x00, 0x00, 0x00, // 1118
0x00, 0x00, 0x81, 0x81, 0x92, 0x5A, 0x5A, 0x6A, 0x66, 0x24, 0x00, 0x00, 0x00, // 1131
0x00, 0x00, 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81, 0x00, 0x00, 0x00, // 1144
0x00, 0x00, 0x82, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, // 1157
0x00, 0x00, 0xFE, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0xFE, 0x00, 0x00, 0x00, // 1170
0x1E, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1E, 0x00, // 1183
0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x02, 0x01, 0x00, // 1196
0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00, // 1209
0x00, 0x08, 0x08, 0x18, 0x14, 0x24, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, // 1222
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, // 1235
0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1248
0x00, 0x00, 0x00, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 1261
0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x00, 0x00, 0x00, // 1274
0x00, 0x00, 0x00, 0x1E, 0x20, 0x40, 0x40, 0x40, 0x20, 0x1E, 0x00, 0x00, 0x00, // 1287
0x02, 0x02, 0x02, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 1300
0x00, 0x00, 0x00, 0x3C, 0x22, 0x42, 0x7E, 0x40, 0x40, 0x3E, 0x00, 0x00, 0x00, // 1313
0x1E, 0x20, 0x20, 0xFE, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, // 1326
0x00, 0x00, 0x00, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02, 0x3C, // 1339
0x40, 0x40, 0x40, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, // 1352
0x18, 0x18, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 1365
0x18, 0x18, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, // 1378
0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00, // 1391
0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 1404
0x00, 0x00, 0x00, 0xB6, 0xDA, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, // 1417
0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, // 1430
0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 1443
0x00, 0x00, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40, 0x40, // 1456
0x00, 0x00, 0x00, 0x3A, 0x46, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02, 0x02, // 1469
0x00, 0x00, 0x00, 0x5C, 0x64, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, // 1482
0x00, 0x00, 0x00, 0x3C, 0x40, 0x60, 0x18, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, // 1495
0x00, 0x00, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00, 0x00, // 1508
0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 1521
0x00, 0x00, 0x00, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, // 1534
0x00, 0x00, 0x00, 0x81, 0x91, 0x5A, 0x5A, 0x6A, 0x24, 0x24, 0x00, 0x00, 0x00, // 1547
0x00, 0x00, 0x00, 0x42, 0x24, 0x18, 0x18, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, // 1560
0x00, 0x00, 0x00, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x10, 0x30, 0xE0, // 1573
0x00, 0x00, 0x00, 0x7E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x00, 0x00, 0x00, // 1586
0x1C, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, // 1599
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, // 1612
0x30, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, // 1625
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, // 1638
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 1651
0x00, 0x00, 0x3E, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x3E, 0x04, 0x02, 0x06, // 1664
0x00, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 1677
0x08, 0x10, 0x00, 0x3C, 0x22, 0x42, 0x7E, 0x40, 0x40, 0x3E, 0x00, 0x00, 0x00, // 1690
0x18, 0x24, 0x00, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 1703
0x00, 0x24, 0x00, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 1716
0x10, 0x08, 0x00, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 1729
0x10, 0x28, 0x10, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 1742
0x00, 0x00, 0x00, 0x1E, 0x20, 0x40, 0x40, 0x40, 0x20, 0x1E, 0x08, 0x04, 0x0C, // 1755
0x18, 0x24, 0x00, 0x3C, 0x22, 0x42, 0x7E, 0x40, 0x40, 0x3E, 0x00, 0x00, 0x00, // 1768
0x00, 0x12, 0x00, 0x3C, 0x22, 0x42, 0x7E, 0x40, 0x40, 0x3E, 0x00, 0x00, 0x00, // 1781
0x10, 0x08, 0x00, 0x3C, 0x22, 0x42, 0x7E, 0x40, 0x40, 0x3E, 0x00, 0x00, 0x00, // 1794
0x00, 0x24, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 1807
0x18, 0x24, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 1820
0x10, 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 1833
0x24, 0x00, 0x18, 0x18, 0x24, 0x24, 0x24, 0x7E, 0x42, 0x81, 0x00, 0x00, 0x00, // 1846
0x10, 0x28, 0x10, 0x28, 0x28, 0x24, 0x44, 0x7E, 0x42, 0x81, 0x00, 0x00, 0x00, // 1859
0x08, 0x10, 0x7E, 0x40, 0x40, 0x40, 0x7C, 0x40, 0x40, 0x7E, 0x00, 0x00, 0x00, // 1872
0x00, 0x00, 0x00, 0xFC, 0x12, 0x12, 0x7E, 0x90, 0x90, 0x6E, 0x00, 0x00, 0x00, // 1885
0x00, 0x00, 0x0F, 0x18, 0x18, 0x28, 0x2E, 0x78, 0x48, 0x8F, 0x00, 0x00, 0x00, // 1898
0x18, 0x24, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 1911
0x00, 0x24, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 1924
0x20, 0x10, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 1937
0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 1950
0x20, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 1963
0x00, 0x24, 0x00, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x10, 0x30, 0xE0, // 1976
0x24, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, // 1989
0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 2002
0x00, 0x08, 0x1C, 0x28, 0x48, 0x48, 0x48, 0x68, 0x1C, 0x08, 0x00, 0x00, 0x00, // 2015
0x00, 0x0E, 0x10, 0x10, 0x10, 0x38, 0x10, 0x10, 0x20, 0x3E, 0x00, 0x00, 0x00, // 2028
0x00, 0x81, 0x42, 0x24, 0x18, 0x7C, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, // 2041
0x00, 0xE0, 0x90, 0x90, 0xE0, 0x96, 0xBC, 0x94, 0x92, 0x9E, 0x00, 0x00, 0x00, // 2054
0x0E, 0x10, 0x10, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xE0, // 2067
0x08, 0x10, 0x00, 0x38, 0x04, 0x04, 0x3C, 0x44, 0x44, 0x3E, 0x00, 0x00, 0x00, // 2080
0x08, 0x10, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, // 2093
0x08, 0x10, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 2106
0x08, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, // 2119
0x14, 0x28, 0x00, 0x5C, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, // 2132
0x14, 0x28, 0x42, 0x62, 0x52, 0x52, 0x4A, 0x4A, 0x46, 0x42, 0x00, 0x00, 0x00, // 2145
0x00, 0x78, 0x08, 0x38, 0x48, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2158
0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2171
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x42, 0x3E, 0x00, // 2184
0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, // 2197
0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 2210
0x00, 0xC4, 0x48, 0x48, 0x50, 0x37, 0x21, 0x43, 0x44, 0x87, 0x00, 0x00, 0x00, // 2223
0x00, 0xC4, 0x48, 0x48, 0x50, 0x22, 0x26, 0x4A, 0x4F, 0x82, 0x00, 0x00, 0x00, // 2236
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, // 2249
0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x48, 0x24, 0x12, 0x00, 0x00, 0x00, 0x00, // 2262
0x00, 0x00, 0x00, 0x00, 0x48, 0x24, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, // 2275
0x94, 0x00, 0x00, 0x94, 0x00, 0x94, 0x00, 0x00, 0x94, 0x00, 0x94, 0x00, 0x00, // 2288
0x49, 0x94, 0x00, 0x49, 0x94, 0x49, 0x00, 0x94, 0x49, 0x94, 0x49, 0x00, 0x94, // 2301
0xFF, 0x94, 0x94, 0xFF, 0x94, 0xFF, 0x94, 0x94, 0xFF, 0x94, 0xFF, 0x94, 0x94, // 2314
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2327
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2340
0x10, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x10, // 2353
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2366
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2379
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x10, // 2392
0x14, 0x14, 0x14, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x14, 0x14, 0x14, 0x14, 0x14, // 2405
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2418
0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14, 0x14, 0x14, 0x14, // 2431
0x14, 0x14, 0x14, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, // 2444
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2457
0x10, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, // 2470
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2483
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2496
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2509
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2522
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2535
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2548
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2561
0x10, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, // 2574
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2587
0x14, 0x14, 0x14, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, // 2600
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14, 0x14, 0x14, 0x14, // 2613
0x14, 0x14, 0x14, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, // 2626
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x14, 0x14, // 2639
0x14, 0x14, 0x14, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14, 0x14, 0x14, 0x14, // 2652
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, // 2665
0x14, 0x14, 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x14, 0x14, // 2678
0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, // 2691
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2704
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, // 2717
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2730
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2743
0x10, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, // 2756
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, // 2769
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2782
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, // 2795
0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, // 2808
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2821
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 2834
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 2847
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 2860
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, // 2873
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 2886
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2899
0x00, 0x00, 0x00, 0x31, 0x49, 0x86, 0x84, 0x84, 0x8A, 0x71, 0x00, 0x00, 0x00, // 2912
0x38, 0x48, 0x48, 0x50, 0x50, 0x58, 0x44, 0x42, 0x42, 0x5C, 0x00, 0x00, 0x00, // 2925
0x00, 0x00, 0x3F, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, // 2938
0x00, 0x00, 0x00, 0x7F, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, // 2951
0x00, 0x00, 0xFF, 0x40, 0x20, 0x10, 0x10, 0x20, 0x40, 0xFF, 0x00, 0x00, 0x00, // 2964
0x00, 0x00, 0x00, 0x7F, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, // 2977
0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x66, 0x5A, 0x40, 0x40, 0x40, // 2990
0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, // 3003
0x00, 0x00, 0x10, 0x7C, 0x92, 0x92, 0x92, 0x92, 0x7C, 0x10, 0x00, 0x00, 0x00, // 3016
0x00, 0x00, 0x38, 0x44, 0x82, 0xBA, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, // 3029
0x00, 0x00, 0x7C, 0xC6, 0x82, 0x82, 0x82, 0x84, 0x44, 0xEE, 0x00, 0x00, 0x00, // 3042
0x38, 0x40, 0x60, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, // 3055
0x00, 0x00, 0x00, 0x00, 0x66, 0x99, 0x99, 0x99, 0x66, 0x00, 0x00, 0x00, 0x00, // 3068
0x10, 0x10, 0x10, 0x7C, 0x92, 0x91, 0x91, 0x91, 0x92, 0x7C, 0x10, 0x10, 0x10, // 3081
0x00, 0x00, 0x00, 0x1E, 0x20, 0x40, 0x7C, 0x40, 0x60, 0x1E, 0x00, 0x00, 0x00, // 3094
0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, // 3107
0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, // 3120
0x00, 0x00, 0x00, 0x10, 0x10, 0xFE, 0x10, 0x10, 0x00, 0xFE, 0x00, 0x00, 0x00, // 3133
0x00, 0x00, 0x40, 0x30, 0x08, 0x06, 0x08, 0x30, 0x40, 0x00, 0x7E, 0x00, 0x00, // 3146
0x00, 0x00, 0x02, 0x0C, 0x10, 0x60, 0x10, 0x0C, 0x02, 0x00, 0x7E, 0x00, 0x00, // 3159
0x0C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 3172
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, // 3185
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // 3198
0x00, 0x00, 0x00, 0x00, 0x72, 0x4E, 0x00, 0x72, 0x4E, 0x00, 0x00, 0x00, 0x00, // 3211
0x00, 0x10, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3224
0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, // 3237
0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, // 3250
0x01, 0x01, 0x02, 0x02, 0x02, 0x04, 0x04, 0xC4, 0x28, 0x28, 0x18, 0x10, 0x00, // 3263
0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3276
0x00, 0x3C, 0x04, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3289
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, // 3302
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // 3315
};
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

+455 -270
View File
@@ -1,290 +1,475 @@
#include "precomp.h"
/* PRIVATE FUNCTIONS *********************************************************/
BOOLEAN
NTAPI
VgaInterpretCmdStream(IN PUSHORT CmdStream)
{
PUCHAR Base = (PUCHAR)VgaRegisterBase;
USHORT Cmd;
UCHAR Major, Minor;
USHORT Count;
UCHAR Index;
PUSHORT Buffer;
PUSHORT ShortPort;
PUCHAR Port;
UCHAR Value;
USHORT ShortValue;
/* First make sure that we have a Command Stream */
if (!CmdStream) return TRUE;
/* Loop as long as we have commands */
while (*CmdStream)
{
/* Get the Major and Minor Function */
Cmd = *CmdStream;
Major = Cmd & 0xF0;
Minor = Cmd & 0x0F;
/* Move to the next command */
CmdStream++;
/* Check which major function this was */
if (Major == 0x10)
{
/* Now let's see the minor function */
if (Minor & CMD_STREAM_READ)
{
/* Now check the sub-type */
if (Minor & CMD_STREAM_USHORT)
{
/* The port is what is in the stream right now */
ShortPort = UlongToPtr((ULONG)*CmdStream);
/* Move to the next command */
CmdStream++;
/* Read USHORT from the port */
READ_PORT_USHORT(PtrToUlong(Base) + ShortPort);
}
else
{
/* The port is what is in the stream right now */
Port = UlongToPtr((ULONG)*CmdStream);
/* Move to the next command */
CmdStream++;
/* Read UCHAR from the port */
READ_PORT_UCHAR(PtrToUlong(Base) + Port);
}
}
else if (Minor & CMD_STREAM_WRITE_ARRAY)
{
/* Now check the sub-type */
if (Minor & CMD_STREAM_USHORT)
{
/* The port is what is in the stream right now */
ShortPort = UlongToPtr(Cmd);
/* Move to the next command and get the count */
Count = *(CmdStream++);
/* The buffer is what's next in the command stream */
Buffer = CmdStream++;
/* Write USHORT to the port */
WRITE_PORT_BUFFER_USHORT(PtrToUshort(Base) + ShortPort, Buffer, Count);
/* Move past the buffer in the command stream */
CmdStream += Count;
}
else
{
/* The port is what is in the stream right now */
Port = UlongToPtr(Cmd);
/* Move to the next command and get the count */
Count = *(CmdStream++);
/* Add the base to the port */
Port = PtrToUlong(Port) + Base;
/* Move to next command */
CmdStream++;
/* Loop the cmd array */
for (; Count; Count--, CmdStream++)
{
/* Get the byte we're writing */
Value = (UCHAR)*CmdStream;
/* Write UCHAR to the port */
WRITE_PORT_UCHAR(Port, Value);
}
}
}
else if (Minor & CMD_STREAM_USHORT)
{
/* Get the ushort we're writing and advance in the stream */
ShortValue = *CmdStream;
CmdStream++;
/* Write USHORT to the port (which is in cmd) */
WRITE_PORT_USHORT((PUSHORT)Base + Cmd, ShortValue);
}
else
{
/* The port is what is in the stream right now */
Port = UlongToPtr((ULONG)*CmdStream);
/* Get the uchar we're writing */
Value = (UCHAR)*++CmdStream;
/* Move to the next command */
CmdStream++;
/* Write UCHAR to the port (which is in cmd) */
WRITE_PORT_UCHAR(PtrToUlong(Base) + Port, Value);
}
}
else if (Major == 0x20)
{
/* Check the minor function. Note these are not flags anymore. */
switch (Minor)
{
case 0:
/* The port is what is in the stream right now */
ShortPort = UlongToPtr(*CmdStream);
/* Move to the next command and get the count */
Count = *(CmdStream++);
/* Move to the next command and get the value to write */
ShortValue = *(CmdStream++);
/* Add the base to the port */
ShortPort = PtrToUlong(ShortPort) + (PUSHORT)Base;
/* Move to next command */
CmdStream++;
/* Make sure we have data */
if (!ShortValue) continue;
/* Loop the cmd array */
for (; Count; Count--, CmdStream++, Value++)
{
/* Get the byte we're writing */
ShortValue += (*CmdStream) << 8;
/* Write USHORT to the port */
WRITE_PORT_USHORT(ShortPort, ShortValue);
}
break;
case 1:
/* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base;
/* Move to the next command and get the count */
Count = *++CmdStream;
/* Move to the next command and get the index to write */
Index = (UCHAR)*++CmdStream;
/* Move to next command */
CmdStream++;
/* Loop the cmd array */
for (; Count; Count--, Index++)
{
/* Write the index */
WRITE_PORT_UCHAR(Port, Index);
/* Get the byte we're writing */
Value = (UCHAR)*CmdStream;
/* Move to next command */
CmdStream++;
/* Write UCHAR value to the port */
WRITE_PORT_UCHAR(Port, Value);
}
break;
case 2:
/* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base;
/* Read the current value and add the stream data */
Value = READ_PORT_UCHAR(Port);
Value &= *CmdStream++;
Value ^= *CmdStream++;
/* Write the value */
WRITE_PORT_UCHAR(Port, Value);
break;
default:
/* Unknown command, fail */
return FALSE;
}
}
else if (Major != 0xF0)
{
/* Unknown major function, fail */
return FALSE;
}
/* Get the next command */
Cmd = *CmdStream;
}
/* If we got here, return success */
return TRUE;
}
BOOLEAN
NTAPI
VgaIsPresent(VOID)
{
UCHAR VgaReg, VgaReg2, VgaReg3;
UCHAR SeqReg, SeqReg2;
UCHAR i;
/* Read the VGA Address Register */
VgaReg = READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE);
/* Select Read Map Select Register */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 4);
/* Read it back...it should be 4 */
if (((READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE)) & 0xF) != 4) return FALSE;
/* Read the VGA Data Register */
VgaReg2 = READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF);
/* Enable all planes */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 3);
/* Read it back...it should be 3 */
if (READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF) != 0x3)
{
/* Reset the registers and fail */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0);
return FALSE;
}
/* Select Bit Mask Register */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 8);
/* Read it back...it should be 8 */
if (((READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE)) & 0xF) != 8)
{
/* Reset the registers and fail */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 4);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0);
return FALSE;
}
/* Read the VGA Data Register */
VgaReg3 = READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF);
/* Loop bitmasks */
for (i = 0xBB; i; i >>= 1)
{
/* Set bitmask */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, i);
/* Read it back...it should be the same */
if (READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF) != i)
{
/* Reset the registers and fail */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0xFF);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 4);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0);
return FALSE;
}
}
/* Select Read Map Select Register */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 4);
/* Read it back...it should be 3 */
if (READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF) != 3)
{
/* Reset the registers and fail */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 8);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, 0xFF);
return FALSE;
}
/* Write the registers we read earlier */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, VgaReg);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, 8);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CF, VgaReg2);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3CE, VgaReg3);
/* Read sequencer address */
SeqReg = READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C4);
/* Select memory mode register */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C4, 4);
/* Read it back...it should still be 4 */
if (((READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C4)) & 7) != 4)
{
/* Fail */
return FALSE;
}
/* Read sequencer Data */
SeqReg2 = READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C5);
/* Write null plane */
WRITE_PORT_USHORT((PUSHORT)VgaRegisterBase + 0x3C4, 0x100);
/* Write sequencer flag */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C5, SeqReg2 ^ 8);
/* Read it back */
if ((READ_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C5)) != (SeqReg2 ^ 8))
{
/* Not the same value...restore registers and fail */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C5, 2);
WRITE_PORT_USHORT((PUSHORT)VgaRegisterBase + 0x3C4, 0x300);
return FALSE;
}
/* Now write the registers we read */
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C5, SeqReg2);
WRITE_PORT_USHORT((PUSHORT)VgaRegisterBase + 0x3C4, 0x300);
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + 0x3C4, SeqReg);
/* VGA is present! */
return TRUE;
}
/* PUBLIC FUNCTIONS **********************************************************/
/*
* ReactOS Boot video driver
*
* Copyright (C) 2003 Casper S. Hornstroup
* Copyright (C) 2004, 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* @implemented
*/
/* INCLUDES ******************************************************************/
#include "bootvid.h"
#include "resource.h"
#define NDEBUG
#include <debug.h>
//#define USE_PROGRESS_BAR
/* GLOBALS *******************************************************************/
static volatile LONG ShutdownNotify;
static KEVENT ShutdownCompleteEvent;
/* DATA **********************************************************************/
static RGBQUAD _MainPalette[16];
static UCHAR _Square1[9 * 4];
static UCHAR _Square2[9 * 4];
static UCHAR _Square3[9 * 4];
/* FUNCTIONS *****************************************************************/
static VOID NTAPI
BootVidAnimationThread(PVOID Ignored)
BOOLEAN
NTAPI
VidInitialize(IN BOOLEAN SetMode)
{
UCHAR PaletteBitmapBuffer[sizeof(BITMAPINFOHEADER) + sizeof(_MainPalette)];
PBITMAPINFOHEADER PaletteBitmap = (PBITMAPINFOHEADER)PaletteBitmapBuffer;
LPRGBQUAD Palette = (LPRGBQUAD)(PaletteBitmapBuffer + sizeof(BITMAPINFOHEADER));
ULONG Iteration, Index, ClrUsed;
UINT AnimBarPos;
LARGE_INTEGER Interval;
/*
* Build a bitmap containing the fade in palette. The palette entries
* are then processed in a loop and set using VidBitBlt function.
*/
ClrUsed = sizeof(_MainPalette) / sizeof(_MainPalette[0]);
RtlZeroMemory(PaletteBitmap, sizeof(BITMAPINFOHEADER));
PaletteBitmap->biSize = sizeof(BITMAPINFOHEADER);
PaletteBitmap->biBitCount = 4;
PaletteBitmap->biClrUsed = ClrUsed;
ULONG Context = 0;
PHYSICAL_ADDRESS TranslatedAddress;
PHYSICAL_ADDRESS NullAddress = {{0}};
ULONG AddressSpace = 1;
BOOLEAN Result;
ULONG_PTR Base;
/*
* Main animation loop.
*/
/* Make sure that we have a bus translation function */
if (!HalFindBusAddressTranslation) return FALSE;
for (Iteration = 0, AnimBarPos = 0; !ShutdownNotify; Iteration++)
{
if (Iteration <= PALETTE_FADE_STEPS)
{
for (Index = 0; Index < ClrUsed; Index++)
{
Palette[Index].rgbRed =
_MainPalette[Index].rgbRed * Iteration / PALETTE_FADE_STEPS;
Palette[Index].rgbGreen =
_MainPalette[Index].rgbGreen * Iteration / PALETTE_FADE_STEPS;
Palette[Index].rgbBlue =
_MainPalette[Index].rgbBlue * Iteration / PALETTE_FADE_STEPS;
}
/* Get the VGA Register address */
Result = HalFindBusAddressTranslation(NullAddress,
&AddressSpace,
&TranslatedAddress,
&Context,
TRUE);
if (!Result) return FALSE;
VidBitBlt(PaletteBitmapBuffer, 0, 0);
}
#ifdef USE_PROGRESS_BAR
else
{
break;
}
/* See if this is I/O Space, which we need to map */
TryAgain:
if (!AddressSpace)
{
/* Map it */
Base = (ULONG_PTR)MmMapIoSpace(TranslatedAddress, 0x400, MmNonCached);
}
else
{
/* The base is the translated address, no need to map I/O space */
Base = TranslatedAddress.LowPart;
}
Interval.QuadPart = -PALETTE_FADE_TIME;
#else
/* Set the VGA Register base and now check if we have a VGA device */
VgaRegisterBase = Base;
if (VgaIsPresent())
{
/* Translate the VGA Memory Address */
NullAddress.LowPart = 0xA0000;
AddressSpace = 0;
Result = HalFindBusAddressTranslation(NullAddress,
&AddressSpace,
&TranslatedAddress,
&Context,
FALSE);
if (Result)
{
/* Success! See if this is I/O Space, which we need to map */
if (!AddressSpace)
{
/* Map it */
Base = (ULONG_PTR)MmMapIoSpace(TranslatedAddress,
0x20000,
MmNonCached);
}
else
{
/* The base is the translated address, no need to map I/O space */
Base = TranslatedAddress.LowPart;
}
#if 0
if (AnimBarPos == 0)
{
VidSolidColorFill(0x173, 354, 0x178, 354 + 9, 0);
}
else if (AnimBarPos > 3)
{
VidSolidColorFill(0xe3 + AnimBarPos * 8, 354,
0xe8 + AnimBarPos * 8, 354 + 9,
0);
}
/* Set the VGA Memory Base */
VgaBase = Base;
if (AnimBarPos >= 3)
{
VidBufferToScreenBlt(_Square1, 0xeb + AnimBarPos * 8, 354, 6, 9, 4);
}
if (AnimBarPos >= 2 && AnimBarPos <= 16)
{
VidBufferToScreenBlt(_Square2, 0xf3 + AnimBarPos * 8, 354, 6, 9, 4);
}
if (AnimBarPos >= 1 && AnimBarPos <= 15)
{
VidBufferToScreenBlt(_Square3, 0xfb + AnimBarPos * 8, 354, 6, 9, 4);
}
#endif
/* Now check if we have to set the mode */
if (SetMode)
{
//
// Reset the display
//
HalResetDisplay();
curr_x = 0;
curr_y = 0;
if (Iteration <= PALETTE_FADE_STEPS)
{
Interval.QuadPart = -PALETTE_FADE_TIME;
if ((Iteration % 5) == 0)
AnimBarPos++;
}
else
{
Interval.QuadPart = -PALETTE_FADE_TIME * 5;
AnimBarPos++;
}
AnimBarPos = Iteration % 18;
#endif
/* Initialize it */
VgaInterpretCmdStream(AT_Initialization);
return TRUE;
}
}
}
else
{
/* It's not, so unmap the I/O space if we mapped it */
if (!AddressSpace) MmUnmapIoSpace((PVOID)VgaRegisterBase, 0x400);
}
/* Wait for a bit. */
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
}
/* If we got here, then we failed...let's try again */
Result = HalFindBusAddressTranslation(NullAddress,
&AddressSpace,
&TranslatedAddress,
&Context,
TRUE);
if (Result) goto TryAgain;
DPRINT("Finishing bootvid thread.\n");
KeSetEvent(&ShutdownCompleteEvent, 0, FALSE);
PsTerminateSystemThread(0);
/* If we got here, then we failed even past our re-try... */
return FALSE;
}
NTSTATUS NTAPI
BootVidDisplayBootLogo(PVOID ImageBase)
/*
* @implemented
*/
VOID
NTAPI
VidResetDisplay(IN BOOLEAN HalReset)
{
PBITMAPINFOHEADER BitmapInfoHeader;
LPRGBQUAD Palette;
static const ULONG BitmapIds[2] = {IDB_BOOTIMAGE, IDB_BAR};
PUCHAR BitmapData[2];
ULONG Index;
HANDLE BitmapThreadHandle;
CLIENT_ID BitmapThreadId;
NTSTATUS Status;
/* Clear the current position */
curr_x = 0;
curr_y = 0;
KeInitializeEvent(&ShutdownCompleteEvent, NotificationEvent, FALSE);
/* Clear the screen with HAL if we were asked to */
if (HalReset) HalResetDisplay();
/*
* Get the bitmaps from the executable.
*/
/* Re-initialize the VGA Display */
VgaInterpretCmdStream(AT_Initialization);
for (Index = 0; Index < sizeof(BitmapIds) / sizeof(BitmapIds[0]); Index++)
{
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
LDR_RESOURCE_INFO ResourceInfo;
ULONG Size;
ResourceInfo.Type = /* RT_BITMAP */ 2;
ResourceInfo.Name = BitmapIds[Index];
ResourceInfo.Language = 0x09;
Status = LdrFindResource_U(
ImageBase,
&ResourceInfo,
RESOURCE_DATA_LEVEL,
&ResourceDataEntry);
if (!NT_SUCCESS(Status))
{
DPRINT("LdrFindResource_U() failed with status 0x%.08x\n", Status);
return Status;
}
Status = LdrAccessResource(
ImageBase,
ResourceDataEntry,
(PVOID*)&BitmapData[Index],
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT("LdrAccessResource() failed with status 0x%.08x\n", Status);
return Status;
}
}
/*
* Initialize the graphics output.
*/
if (!VidInitialize(TRUE))
{
return STATUS_UNSUCCESSFUL;
}
/*
* Load the bar bitmap and get the square data from it.
*/
VidBitBlt(BitmapData[1], 0, 0);
VidScreenToBufferBlt(_Square1, 0, 0, 6, 9, 4);
VidScreenToBufferBlt(_Square2, 8, 0, 6, 9, 4);
VidScreenToBufferBlt(_Square3, 16, 0, 6, 9, 4);
/*
* Save the main image palette and replace it with black palette, so
* we can do fade in effect later.
*/
BitmapInfoHeader = (PBITMAPINFOHEADER)BitmapData[0];
Palette = (LPRGBQUAD)(BitmapData[0] + BitmapInfoHeader->biSize);
RtlCopyMemory(_MainPalette, Palette, sizeof(_MainPalette));
RtlZeroMemory(Palette, sizeof(_MainPalette));
/*
* Display the main image.
*/
VidBitBlt(BitmapData[0], 0, 0);
/*
* Start a thread that handles the fade in and bar animation effects.
*/
Status = PsCreateSystemThread(
&BitmapThreadHandle,
THREAD_ALL_ACCESS,
NULL,
NULL,
&BitmapThreadId,
BootVidAnimationThread,
NULL);
if (!NT_SUCCESS(Status))
{
VidCleanUp();
return Status;
}
ZwClose(BitmapThreadHandle);
return STATUS_SUCCESS;
/* Re-initialize the palette and fill the screen black */
InitializePalette();
VidSolidColorFill(0, 0, 639, 479, 0);
}
VOID NTAPI
BootVidUpdateProgress(ULONG Progress)
{
#ifdef USE_PROGRESS_BAR
if (ShutdownNotify == 0)
{
VidSolidColorFill(0x103, 354, 0x103 + (Progress * 120 / 100), 354 + 9, 1);
}
#endif
}
VOID NTAPI
BootVidFinalizeBootLogo(VOID)
{
InterlockedIncrement(&ShutdownNotify);
DPRINT1("Waiting for bootvid thread to finish.\n");
KeWaitForSingleObject(&ShutdownCompleteEvent, Executive, KernelMode,
FALSE, NULL);
DPRINT1("Bootvid thread to finish.\n");
//VidResetDisplay();
}
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
return STATUS_SUCCESS;
}
+13 -12
View File
@@ -1,14 +1,15 @@
LIBRARY bootvid.sys
LIBRARY BOOTVID.DLL
EXPORTS
VidInitialize
VidCleanUp
VidResetDisplay
VidBufferToScreenBlt
VidScreenToBufferBlt
VidBitBlt
VidSolidColorFill
VidDisplayString
BootVidDisplayBootLogo
BootVidUpdateProgress
BootVidFinalizeBootLogo
VidBitBlt@12
VidBufferToScreenBlt@24
VidCleanUp@0
VidDisplayString@4
VidDisplayStringXY
VidInitialize@4
VidResetDisplay@4
VidScreenToBufferBlt@24
VidSetScrollRegion@16
VidSetTextColor@4
VidSolidColorFill@20
-65
View File
@@ -1,65 +0,0 @@
/*
* ReactOS Boot video driver
*
* Copyright (C) 2003 Casper S. Hornstroup
* Copyright (C) 2004, 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef _BOOTVID_H
#define _BOOTVID_H
#include <ntddk.h>
#include <windef.h>
#include <wingdi.h>
#include <ndk/ldrfuncs.h>
#define PALETTE_FADE_STEPS 15
#define PALETTE_FADE_TIME 20 * 10000 /* 20ms */
BOOLEAN NTAPI VidInitialize(BOOLEAN);
VOID NTAPI VidCleanUp(VOID);
VOID NTAPI VidResetDisplay(VOID);
VOID NTAPI VidBufferToScreenBlt(PUCHAR, ULONG, ULONG, ULONG, ULONG, ULONG);
VOID NTAPI VidScreenToBufferBlt(PUCHAR, ULONG, ULONG, ULONG, ULONG, ULONG);
VOID NTAPI VidBitBlt(PUCHAR, ULONG, ULONG);
VOID NTAPI VidSolidColorFill(ULONG, ULONG, ULONG, ULONG, ULONG);
VOID NTAPI VidDisplayString(PCSTR);
typedef BOOLEAN (NTAPI *PVID_INITIALIZE)(BOOLEAN);
typedef VOID (NTAPI *PVID_CLEAN_UP)(VOID);
typedef VOID (NTAPI *PVID_RESET_DISPLAY)(VOID);
typedef VOID (NTAPI *PVID_BUFFER_TO_SCREEN_BLT)(PUCHAR, ULONG, ULONG, ULONG, ULONG, ULONG);
typedef VOID (NTAPI *PVID_SCREEN_TO_BUFFER_BLT)(PUCHAR, ULONG, ULONG, ULONG, ULONG, LONG);
typedef VOID (NTAPI *PVID_BITBLT)(PUCHAR, ULONG, ULONG);
typedef VOID (NTAPI *PVID_SOLID_COLOR_FILL)(ULONG, ULONG, ULONG, ULONG, ULONG);
typedef VOID (NTAPI *PVID_DISPLAY_STRING)(PCSTR);
typedef struct _VID_FUNCTION_TABLE
{
PVID_INITIALIZE Initialize;
PVID_CLEAN_UP CleanUp;
PVID_RESET_DISPLAY ResetDisplay;
PVID_BUFFER_TO_SCREEN_BLT BufferToScreenBlt;
PVID_SCREEN_TO_BUFFER_BLT ScreenToBufferBlt;
PVID_BITBLT BitBlt;
PVID_SOLID_COLOR_FILL SolidColorFill;
PVID_DISPLAY_STRING DisplayString;
} VID_FUNCTION_TABLE, *PVID_FUNCTION_TABLE;
#endif /* _BOOTVID_H */
+5 -7
View File
@@ -1,14 +1,12 @@
<module name="bootvid" type="kernelmodedll" entrypoint="DriverEntry@8" installbase="system32/drivers" installname="bootvid.sys">
<module name="bootvid" type="kernelmodedll" entrypoint="DriverEntry@8" installbase="system32/drivers" installname="bootvid.dll">
<importlibrary definition="bootvid.def"></importlibrary>
<bootstrap base="reactos" nameoncd="bootvid.sys" />
<bootstrap base="reactos" nameoncd="bootvid.dll" />
<include base="bootvid">.</include>
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<file>bootvid.c</file>
<file>vid.c</file>
<file>vid_vga.c</file>
<file>vid_vgatext.c</file>
<file>vid_xbox.c</file>
<file>bootdata.c</file>
<file>vga.c</file>
<file>bootvid.rc</file>
</module>
</module>
+4 -8
View File
@@ -3,12 +3,8 @@
#include "resource.h"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Boot Video\0"
#define REACTOS_STR_INTERNAL_NAME "bootvid\0"
#define REACTOS_STR_ORIGINAL_FILENAME "bootvid.sys\0"
#define REACTOS_STR_FILE_DESCRIPTION "VGA Boot Driver\0"
#define REACTOS_STR_INTERNAL_NAME "bootvid.dll\0"
#define REACTOS_STR_ORIGINAL_FILENAME "bootvid.dll\0"
#include <reactos/version.rc>
IDB_BOOTIMAGE BITMAP DISCARDABLE "bootimage.bmp"
IDB_BAR BITMAP DISCARDABLE "bar.bmp"
+46
View File
@@ -0,0 +1,46 @@
#include "ntddk.h"
#include "arc\arc.h"
#include "halfuncs.h"
#include "drivers\bootvid\bootvid.h"
//
// Command Stream Definitions
//
#define CMD_STREAM_WRITE 0x0
#define CMD_STREAM_WRITE_ARRAY 0x2
#define CMD_STREAM_USHORT 0x4
#define CMD_STREAM_READ 0x8
//
// Bitmap Header
//
typedef struct tagBITMAPINFOHEADER
{
ULONG biSize;
LONG biWidth;
LONG biHeight;
USHORT biPlanes;
USHORT biBitCount;
ULONG biCompression;
ULONG biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
ULONG biClrUsed;
ULONG biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
VOID
NTAPI
InitializePalette(
VOID
);
//
// Globals
//
extern USHORT AT_Initialization[];
extern ULONG curr_x;
extern ULONG curr_y;
extern ULONG_PTR VgaRegisterBase;
extern ULONG_PTR VgaBase;
extern CHAR FontData[256 * 13];
-6
View File
@@ -1,6 +0,0 @@
/* $Id$ */
/* Bitmaps */
#define IDB_BOOTIMAGE 1
#define IDB_BAR 8
File diff suppressed because it is too large Load Diff
-119
View File
@@ -1,119 +0,0 @@
/*
* ReactOS Boot video driver
*
* Copyright (C) 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* INCLUDES ******************************************************************/
#include "bootvid.h"
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
static PVID_FUNCTION_TABLE VidTable;
extern VID_FUNCTION_TABLE VidVgaTable;
extern VID_FUNCTION_TABLE VidVgaTextTable;
extern VID_FUNCTION_TABLE VidXboxTable;
/* FUNCTIONS *****************************************************************/
BOOLEAN NTAPI
VidInitialize(
IN BOOLEAN SetMode)
{
ULONG PciId;
/*
* Check for Xbox by identifying device at PCI 0:0:0, if it's
* 0x10de/0x02a5 then we're running on an Xbox.
*/
CHECKPOINT;
WRITE_PORT_ULONG((PULONG)0xcf8, 0x80000000);
PciId = READ_PORT_ULONG((PULONG)0xcfc);
if (0x02a510de == PciId)
VidTable = &VidXboxTable;
else if (SetMode)
VidTable = &VidVgaTable;
else
VidTable = &VidVgaTextTable;
return VidTable->Initialize(SetMode);
}
VOID STDCALL
VidResetDisplay(VOID)
{
VidTable->ResetDisplay();
}
VOID NTAPI
VidCleanUp(VOID)
{
VidTable->CleanUp();
}
VOID NTAPI
VidBufferToScreenBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
VidTable->BufferToScreenBlt(Buffer, Left, Top, Width, Height, Delta);
}
VOID NTAPI
VidScreenToBufferBlt(
OUT PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
VidTable->ScreenToBufferBlt(Buffer, Left, Top, Width, Height, Delta);
}
VOID NTAPI
VidBitBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top)
{
VidTable->BitBlt(Buffer, Left, Top);
}
VOID NTAPI
VidSolidColorFill(
IN ULONG Left,
IN ULONG Top,
IN ULONG Right,
IN ULONG Bottom,
IN ULONG Color)
{
VidTable->SolidColorFill(Left, Top, Right, Bottom, Color);
}
VOID NTAPI
VidDisplayString(
IN PCSTR String)
{
VidTable->DisplayString(String);
}
-512
View File
@@ -1,512 +0,0 @@
/*
* ReactOS Boot video driver
*
* Copyright (C) 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* INCLUDES ******************************************************************/
#include "bootvid.h"
#define NDEBUG
#include <debug.h>
/* TYPES AND DEFINITIONS *****************************************************/
typedef struct _VGA_REGISTERS
{
UCHAR CRT[24];
UCHAR Attribute[21];
UCHAR Graphics[9];
UCHAR Sequencer[5];
UCHAR Misc;
} VGA_REGISTERS, *PVGA_REGISTERS;
/* VGA registers */
#define MISC (PUCHAR)0x3c2
#define SEQ (PUCHAR)0x3c4
#define SEQDATA (PUCHAR)0x3c5
#define CRTC (PUCHAR)0x3d4
#define CRTCDATA (PUCHAR)0x3d5
#define GRAPHICS (PUCHAR)0x3ce
#define GRAPHICSDATA (PUCHAR)0x3cf
#define ATTRIB (PUCHAR)0x3c0
#define STATUS (PUCHAR)0x3da
#define PELMASK (PUCHAR)0x3c6
#define PELINDEX (PUCHAR)0x3c8
#define PELDATA (PUCHAR)0x3c9
/* GLOBALS *******************************************************************/
/*
* NOTE:
* This is based on SvgaLib 640x480x16 mode definition with the
* following changes:
* - Graphics: Data Rotate (Index 3)
* Set to zero to indicate that the data written to video memory by
* CPU should be processed unmodified.
* - Graphics: Mode Register (Index 5)
* Set to Write Mode 2 and Read Mode 0.
*/
static const VGA_REGISTERS VidpMode12Regs =
{
/* CRT Controller Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xEA, 0x8C, 0xDF, 0x28, 0x00, 0xE7, 0x04, 0xE3},
/* Attribute Controller Registers */
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
0x0C, 0x0D, 0x0E, 0x0F, 0x81, 0x00, 0x0F, 0x00, 0x00},
/* Graphics Controller Registers */
{0x00, 0x0F, 0x00, 0x00, 0x00, 0x02, 0x05, 0x0F, 0xFF},
/* Sequencer Registers */
{0x03, 0x01, 0x0F, 0x00, 0x06},
/* Misc Output Register */
0xE3
};
static const RGBQUAD DefaultPalette[] =
{
{0, 0, 0},
{0, 0, 0x80},
{0, 0x80, 0},
{0, 0x80, 0x80},
{0x80, 0, 0},
{0x80, 0, 0x80},
{0x80, 0x80, 0},
{0x80, 0x80, 0x80},
{0xC0, 0xC0, 0xC0},
{0, 0, 0xFF},
{0, 0xFF, 0},
{0, 0xFF, 0xFF},
{0xFF, 0, 0},
{0xFF, 0, 0xFF},
{0xFF, 0xFF, 0},
{0xFF, 0xFF, 0xFF}
};
static BOOLEAN VidpInitialized = FALSE;
static PUCHAR VidpMemory;
static CHAR VidpMaskBit[640];
static ULONG VidpCurrentX;
static ULONG VidpCurrentY;
/* FUNCTIONS *****************************************************************/
static VOID FASTCALL
VidpSetRegisters(const VGA_REGISTERS *Registers)
{
UINT i;
/* Update misc output register */
WRITE_PORT_UCHAR(MISC, Registers->Misc);
/* Synchronous reset on */
WRITE_PORT_UCHAR(SEQ, 0x00);
WRITE_PORT_UCHAR(SEQDATA, 0x01);
/* Write sequencer registers */
for (i = 1; i < sizeof(Registers->Sequencer); i++)
{
WRITE_PORT_UCHAR(SEQ, i);
WRITE_PORT_UCHAR(SEQDATA, Registers->Sequencer[i]);
}
/* Synchronous reset off */
WRITE_PORT_UCHAR(SEQ, 0x00);
WRITE_PORT_UCHAR(SEQDATA, 0x03);
/* Deprotect CRT registers 0-7 */
WRITE_PORT_UCHAR(CRTC, 0x11);
WRITE_PORT_UCHAR(CRTCDATA, Registers->CRT[0x11] & 0x7f);
/* Write CRT registers */
for (i = 0; i < sizeof(Registers->CRT); i++)
{
WRITE_PORT_UCHAR(CRTC, i);
WRITE_PORT_UCHAR(CRTCDATA, Registers->CRT[i]);
}
/* Write graphics controller registers */
for (i = 0; i < sizeof(Registers->Graphics); i++)
{
WRITE_PORT_UCHAR(GRAPHICS, i);
WRITE_PORT_UCHAR(GRAPHICSDATA, Registers->Graphics[i]);
}
/* Write attribute controller registers */
for (i = 0; i < sizeof(Registers->Attribute); i++)
{
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, i);
WRITE_PORT_UCHAR(ATTRIB, Registers->Attribute[i]);
}
/* Set the PEL mask. */
WRITE_PORT_UCHAR(PELMASK, 0xff);
}
static BOOLEAN NTAPI
VidVgaInitialize(
IN BOOLEAN SetMode)
{
ULONG Index;
PHYSICAL_ADDRESS PhysicalAddress;
if (!VidpInitialized)
{
PhysicalAddress.QuadPart = 0xA0000;
VidpMemory = MmMapIoSpace(PhysicalAddress, 0x10000, MmNonCached);
if (VidpMemory == NULL)
return FALSE;
for (Index = 0; Index < 80; Index++)
{
VidpMaskBit[Index * 8 + 0] = 128;
VidpMaskBit[Index * 8 + 1] = 64;
VidpMaskBit[Index * 8 + 2] = 32;
VidpMaskBit[Index * 8 + 3] = 16;
VidpMaskBit[Index * 8 + 4] = 8;
VidpMaskBit[Index * 8 + 5] = 4;
VidpMaskBit[Index * 8 + 6] = 2;
VidpMaskBit[Index * 8 + 7] = 1;
}
VidpInitialized = TRUE;
}
if (SetMode)
{
VidpSetRegisters(&VidpMode12Regs);
VidpCurrentX = VidpCurrentY = 0;
/* Disable screen and enable palette access. */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x00);
for (Index = 0; Index < sizeof(DefaultPalette) / sizeof(RGBQUAD); Index++)
{
WRITE_PORT_UCHAR(PELINDEX, Index);
WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index].rgbRed >> 2);
WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index].rgbGreen >> 2);
WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index].rgbBlue >> 2);
}
/* Enable screen and disable palette access. */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x20);
}
return TRUE;
}
static VOID STDCALL
VidVgaResetDisplay(VOID)
{
VidVgaInitialize(TRUE);
}
static VOID NTAPI
VidVgaCleanUp(VOID)
{
if (VidpInitialized)
{
MmUnmapIoSpace(VidpMemory, 0x10000);
VidpInitialized = FALSE;
}
}
static VOID NTAPI
VidVgaBufferToScreenBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
ULONG x, y;
PUCHAR BufferPtr;
ULONG VidOffset;
for (x = Left; x < Left + Width; x++)
{
WRITE_PORT_UCHAR(GRAPHICS, 0x08);
WRITE_PORT_UCHAR(GRAPHICSDATA, VidpMaskBit[x]);
BufferPtr = Buffer;
VidOffset = (x >> 3) + (Top * 80);
if (((x - Left) % 2) == 0)
{
for (y = Top; y < Top + Height; y++)
{
READ_REGISTER_UCHAR(VidpMemory + VidOffset);
WRITE_REGISTER_UCHAR(VidpMemory + VidOffset, *BufferPtr >> 4);
VidOffset += 80;
BufferPtr += Delta;
}
}
else
{
for (y = Top; y < Top + Height; y++)
{
READ_REGISTER_UCHAR(VidpMemory + VidOffset);
WRITE_REGISTER_UCHAR(VidpMemory + VidOffset, *BufferPtr & 0xf);
VidOffset += 80;
BufferPtr += Delta;
}
Buffer++;
}
}
}
static VOID NTAPI
VidVgaScreenToBufferBlt(
OUT PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN LONG Delta)
{
UCHAR Plane;
UCHAR b;
ULONG x, y;
/* Reset the destination. */
RtlZeroMemory(Buffer, (Delta > 0 ? Delta : -Delta) * Height);
for (Plane = 0; Plane < 4; Plane++)
{
WRITE_PORT_UCHAR(GRAPHICS, 0x04);
WRITE_PORT_UCHAR(GRAPHICSDATA, Plane);
for (y = Top; y < Top + Height; y++)
{
for (x = Left; x < Left + Width; x++)
{
b = READ_REGISTER_UCHAR(VidpMemory + (y * 80 + (x >> 3)));
b >>= 7 - (x & 7);
b &= 1;
b <<= Plane + ((~(x - Left) & 1) << 2);
Buffer[(y - Top) * Delta + ((x - Left) >> 1)] |= b;
}
}
}
}
static VOID NTAPI
VidVgaBitBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top)
{
PBITMAPINFOHEADER BitmapInfoHeader;
LPRGBQUAD Palette;
ULONG bfOffBits;
UCHAR ClrUsed;
ULONG Index;
LONG Delta;
BitmapInfoHeader = (PBITMAPINFOHEADER)Buffer;
Palette = (LPRGBQUAD)(Buffer + BitmapInfoHeader->biSize);
if (BitmapInfoHeader->biClrUsed)
ClrUsed = BitmapInfoHeader->biClrUsed;
else
ClrUsed = 1 << BitmapInfoHeader->biBitCount;
bfOffBits = BitmapInfoHeader->biSize + ClrUsed * sizeof(RGBQUAD);
/* Disable screen and enable palette access. */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x00);
for (Index = 0; Index < ClrUsed; Index++)
{
WRITE_PORT_UCHAR(PELINDEX, Index);
WRITE_PORT_UCHAR(PELDATA, Palette[Index].rgbRed >> 2);
WRITE_PORT_UCHAR(PELDATA, Palette[Index].rgbGreen >> 2);
WRITE_PORT_UCHAR(PELDATA, Palette[Index].rgbBlue >> 2);
}
/* Enable screen and disable palette access. */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x20);
if (BitmapInfoHeader->biCompression == 2)
{
PUCHAR OutputBuffer;
ULONG InputPos, OutputPos;
ULONG x, y;
UCHAR b;
ULONG Length;
Delta = (BitmapInfoHeader->biWidth + 1) >> 1;
OutputBuffer = ExAllocatePool(NonPagedPool, Delta * BitmapInfoHeader->biHeight);
RtlZeroMemory(OutputBuffer, Delta * BitmapInfoHeader->biHeight);
OutputPos = InputPos = 0;
Buffer += bfOffBits;
while (InputPos < BitmapInfoHeader->biSizeImage &&
OutputPos < (ULONG)Delta * BitmapInfoHeader->biHeight * 2)
{
Length = Buffer[InputPos++];
if (Length > 0)
{
/* Encoded mode */
b = Buffer[InputPos++];
if (OutputPos % 2)
{
OutputBuffer[OutputPos >> 1] |= b & 0xf;
b = (b >> 4) | (b << 4);
Length--;
OutputPos++;
}
memset(OutputBuffer + (OutputPos >> 1), b, Length / 2);
OutputPos += Length;
if (Length & 1)
{
OutputBuffer[OutputPos >> 1] |= b & 0xf;
OutputPos++;
}
}
else
{
/* Absolute mode */
b = Buffer[InputPos++];
if (b == 0)
{
/* End of line */
if (OutputPos % Delta)
OutputPos = ((OutputPos / Delta) + 1) * Delta;
}
else if (b == 1)
{
/* End of image */
break;
}
else if (b == 2)
{
x = Buffer[InputPos++];
y = Buffer[InputPos++];
OutputPos = ((OutputPos / Delta) + y) * Delta +
((OutputPos % Delta) + x);
}
else
{
Length = b;
if (Length)
{
if (OutputPos % 2)
{
ASSERT(FALSE);
}
for (Index = 0; Index < (Length / 2); Index++)
{
b = Buffer[InputPos++];
OutputBuffer[OutputPos >> 1] = b;
OutputPos += 2;
}
if (Length & 1)
{
b = Buffer[InputPos++];
OutputBuffer[OutputPos >> 1] |= b >> 4;
OutputPos++;
}
}
/* Word align */
InputPos += (InputPos & 1);
}
}
}
VidBufferToScreenBlt(OutputBuffer +
(Delta * (BitmapInfoHeader->biHeight - 1)),
0, 0, BitmapInfoHeader->biWidth,
BitmapInfoHeader->biHeight, -Delta);
ExFreePool(OutputBuffer);
}
else
{
Delta = ((BitmapInfoHeader->biWidth + 31) & ~31) >> 1;
if (BitmapInfoHeader->biHeight < 0)
{
VidBufferToScreenBlt(Buffer + bfOffBits,
0, 0, BitmapInfoHeader->biWidth,
-BitmapInfoHeader->biHeight, Delta);
}
else
{
VidBufferToScreenBlt(Buffer + bfOffBits +
(Delta * (BitmapInfoHeader->biHeight - 1)),
0, 0, BitmapInfoHeader->biWidth,
BitmapInfoHeader->biHeight, -Delta);
}
}
}
static VOID NTAPI
VidVgaSolidColorFill(
IN ULONG Left,
IN ULONG Top,
IN ULONG Right,
IN ULONG Bottom,
IN ULONG Color)
{
ULONG x, y;
ULONG VidOffset;
for (x = Left; x <= Right; x++)
{
WRITE_PORT_UCHAR(GRAPHICS, 0x08);
WRITE_PORT_UCHAR(GRAPHICSDATA, VidpMaskBit[x]);
VidOffset = (x >> 3) + (Top * 80);
for (y = Top; y <= Bottom; y++)
{
READ_REGISTER_UCHAR(VidpMemory + VidOffset);
WRITE_REGISTER_UCHAR(VidpMemory + VidOffset, Color & 0xF);
VidOffset += 80;
}
}
}
static VOID NTAPI
VidVgaDisplayString(
IN PCSTR String)
{
}
VID_FUNCTION_TABLE VidVgaTable =
{
VidVgaInitialize,
VidVgaCleanUp,
VidVgaResetDisplay,
VidVgaBufferToScreenBlt,
VidVgaScreenToBufferBlt,
VidVgaBitBlt,
VidVgaSolidColorFill,
VidVgaDisplayString
};
-250
View File
@@ -1,250 +0,0 @@
/*
* ReactOS Boot video driver
*
* Copyright (C) 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* INCLUDES ******************************************************************/
#include "bootvid.h"
#define NDEBUG
#include <debug.h>
/* TYPES AND DEFINITIONS *****************************************************/
/* VGA registers */
#define MISC (PUCHAR)0x3c2
#define SEQ (PUCHAR)0x3c4
#define SEQDATA (PUCHAR)0x3c5
#define CRTC (PUCHAR)0x3d4
#define CRTCDATA (PUCHAR)0x3d5
#define GRAPHICS (PUCHAR)0x3ce
#define GRAPHICSDATA (PUCHAR)0x3cf
#define ATTRIB (PUCHAR)0x3c0
#define STATUS (PUCHAR)0x3da
#define PELMASK (PUCHAR)0x3c6
#define PELINDEX (PUCHAR)0x3c8
#define PELDATA (PUCHAR)0x3c9
#define CRTC_COLUMNS 0x01
#define CRTC_OVERFLOW 0x07
#define CRTC_ROWS 0x12
#define CRTC_SCANLINES 0x09
#define CRTC_CURHI 0x0e
#define CRTC_CURLO 0x0f
#define CHAR_ATTRIBUTE_BLACK 0x00 /* black on black */
#define CHAR_ATTRIBUTE 0x07 /* grey on blue */
/* GLOBALS *******************************************************************/
static BOOLEAN VidpInitialized = FALSE;
static PUCHAR VidpMemory;
static ULONG SizeX, SizeY;
/* FUNCTIONS *****************************************************************/
static VOID NTAPI
VidpVgaTextClearDisplay(VOID)
{
volatile WORD *ptr = (volatile WORD*)VidpMemory;
ULONG i;
for (i = 0; i < SizeX * SizeY; i++, ptr++)
*ptr = (0x0000 + ' ');
}
static BOOLEAN NTAPI
VidVgaTextInitialize(
IN BOOLEAN SetMode)
{
ULONG ScanLines;
PHYSICAL_ADDRESS PhysicalAddress;
UCHAR Data;
if (!VidpInitialized)
{
PhysicalAddress.QuadPart = 0xB8000;
VidpMemory = MmMapIoSpace(PhysicalAddress, 0x2000, MmNonCached);
if (VidpMemory == NULL)
return FALSE;
VidpInitialized = TRUE;
WRITE_PORT_UCHAR(CRTC, CRTC_COLUMNS);
SizeX = READ_PORT_UCHAR(CRTCDATA) + 1;
WRITE_PORT_UCHAR(CRTC, CRTC_ROWS);
SizeY = READ_PORT_UCHAR(CRTCDATA);
WRITE_PORT_UCHAR(CRTC, CRTC_OVERFLOW);
Data = READ_PORT_UCHAR(CRTCDATA);
SizeY |= (((Data & 0x02) << 7) | ((Data & 0x40) << 3));
SizeY++;
WRITE_PORT_UCHAR(CRTC, CRTC_SCANLINES);
ScanLines = (READ_PORT_UCHAR(CRTCDATA) & 0x1F) + 1;
SizeY = SizeY / ScanLines;
VidpVgaTextClearDisplay();
WRITE_PORT_UCHAR(CRTC, CRTC_CURLO);
WRITE_PORT_UCHAR(CRTCDATA, 0);
WRITE_PORT_UCHAR(CRTC, CRTC_CURHI);
WRITE_PORT_UCHAR(CRTCDATA, 0);
}
return TRUE;
}
static VOID NTAPI
VidVgaTextResetDisplay(VOID)
{
VidVgaTextInitialize(TRUE);
}
static VOID NTAPI
VidVgaTextCleanUp(VOID)
{
if (VidpInitialized)
{
MmUnmapIoSpace(VidpMemory, 0x10000);
VidpInitialized = FALSE;
}
}
static VOID NTAPI
VidVgaTextBufferToScreenBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
}
static VOID NTAPI
VidVgaTextScreenToBufferBlt(
OUT PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN LONG Delta)
{
}
static VOID NTAPI
VidVgaTextBitBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top)
{
}
static VOID NTAPI
VidVgaTextSolidColorFill(
IN ULONG Left,
IN ULONG Top,
IN ULONG Right,
IN ULONG Bottom,
IN ULONG Color)
{
}
static VOID NTAPI
VidpVgaTextScrollDisplay(VOID)
{
volatile USHORT *ptr;
int i;
RtlMoveMemory(VidpMemory, (PUSHORT)VidpMemory + SizeX, SizeX * (SizeY - 1) * 2);
ptr = (volatile USHORT *)VidpMemory + (SizeX * (SizeY - 1));
for (i = 0; i < (int)SizeX; i++, ptr++)
*ptr = (CHAR_ATTRIBUTE << 8) + ' ';
}
static VOID NTAPI
VidVgaTextDisplayString(
IN PCSTR String)
{
PCSTR pch;
int offset;
ULONG CursorX;
ULONG CursorY;
pch = String;
WRITE_PORT_UCHAR(CRTC, CRTC_CURHI);
offset = READ_PORT_UCHAR(CRTCDATA) << 8;
WRITE_PORT_UCHAR(CRTC, CRTC_CURLO);
offset += READ_PORT_UCHAR(CRTCDATA);
CursorY = offset / SizeX;
CursorX = offset % SizeX;
while (*pch != 0)
{
if (*pch == '\n')
{
CursorY++;
CursorX = 0;
}
else if (*pch == '\b')
{
if (CursorX > 0)
CursorX--;
}
else if (*pch != '\r')
{
volatile USHORT *ptr;
ptr = (volatile USHORT *)VidpMemory + ((CursorY * SizeX) + CursorX);
*ptr = (CHAR_ATTRIBUTE << 8) + *pch;
CursorX++;
if (CursorX >= SizeX)
{
CursorY++;
CursorX = 0;
}
}
if (CursorY >= SizeY)
{
VidpVgaTextScrollDisplay();
CursorY = SizeY - 1;
}
pch++;
}
offset = (CursorY * SizeX) + CursorX;
WRITE_PORT_UCHAR(CRTC, CRTC_CURLO);
WRITE_PORT_UCHAR(CRTCDATA, (UCHAR)(offset & 0xff));
WRITE_PORT_UCHAR(CRTC, CRTC_CURHI);
WRITE_PORT_UCHAR(CRTCDATA, (UCHAR)((offset >> 8) & 0xff));
}
VID_FUNCTION_TABLE VidVgaTextTable = {
VidVgaTextInitialize,
VidVgaTextCleanUp,
VidVgaTextResetDisplay,
VidVgaTextBufferToScreenBlt,
VidVgaTextScreenToBufferBlt,
VidVgaTextBitBlt,
VidVgaTextSolidColorFill,
VidVgaTextDisplayString
};
-101
View File
@@ -1,101 +0,0 @@
/*
* ReactOS Boot video driver
*
* Copyright (C) 2005 Filip Navara
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* INCLUDES ******************************************************************/
#include "bootvid.h"
#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
static BOOLEAN NTAPI
VidXboxInitialize(
IN BOOLEAN SetMode)
{
return TRUE;
}
static VOID NTAPI
VidXboxResetDisplay(VOID)
{
}
static VOID NTAPI
VidXboxCleanUp(VOID)
{
}
static VOID NTAPI
VidXboxBufferToScreenBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
}
static VOID NTAPI
VidXboxScreenToBufferBlt(
OUT PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN LONG Delta)
{
}
static VOID NTAPI
VidXboxBitBlt(
IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top)
{
}
static VOID NTAPI
VidXboxSolidColorFill(
IN ULONG Left,
IN ULONG Top,
IN ULONG Right,
IN ULONG Bottom,
IN ULONG Color)
{
}
static VOID NTAPI
VidXboxDisplayString(
IN PCSTR String)
{
}
VID_FUNCTION_TABLE VidXboxTable = {
VidXboxInitialize,
VidXboxCleanUp,
VidXboxResetDisplay,
VidXboxBufferToScreenBlt,
VidXboxScreenToBufferBlt,
VidXboxBitBlt,
VidXboxSolidColorFill,
VidXboxDisplayString
};
+22 -6
View File
@@ -23,6 +23,7 @@ Author:
// Dependencies
//
#include <umtypes.h>
#include <inbvtypes.h>
#ifndef NTOS_MODE_USER
//
@@ -30,16 +31,20 @@ Author:
//
VOID
NTAPI
InbvAcquireDisplayOwnership(VOID);
InbvAcquireDisplayOwnership(
VOID
);
BOOLEAN
NTAPI
InbvCheckDisplayOwnership(VOID);
InbvCheckDisplayOwnership(
VOID
);
VOID
NTAPI
InbvNotifyDisplayOwnershipLost(
IN PVOID Callback
IN INBV_RESET_DISPLAY_PARAMETERS Callback
);
//
@@ -54,12 +59,14 @@ InbvEnableBootDriver(
VOID
NTAPI
InbvInstallDisplayStringFilter(
IN PVOID DisplayFilter
IN INBV_DISPLAY_STRING_FILTER DisplayFilter
);
BOOLEAN
NTAPI
InbvIsBootDriverInstalled(VOID);
InbvIsBootDriverInstalled(
VOID
);
//
// Display Functions
@@ -78,7 +85,9 @@ InbvEnableDisplayString(
BOOLEAN
NTAPI
InbvResetDisplay(VOID);
InbvResetDisplay(
VOID
);
VOID
NTAPI
@@ -105,5 +114,12 @@ InbvSolidColorFill(
IN ULONG Color
);
VOID
NTAPI
InbvSetProgressBarSubset(
IN ULONG Floor,
IN ULONG Ceiling
);
#endif
#endif
+55
View File
@@ -0,0 +1,55 @@
/*++ NDK Version: 0098
Copyright (c) Alex Ionescu. All rights reserved.
Header Name:
inbvtypes.h
Abstract:
Type definitions for the Boot Video Driver.
Author:
Alex Ionescu (alexi@tinykrnl.org) - Created - 02-Feb-2007
--*/
#ifndef _INBVTYPES_H
#define _INBVTYPES_H
//
// Dependencies
//
#include <umtypes.h>
#ifndef NTOS_MODE_USER
//
// Boot Video Display Ownership Status
//
typedef enum _INBV_DISPLAY_STATE
{
INBV_DISPLAY_STATE_OWNED,
INBV_DISPLAY_STATE_DISABLED,
INBV_DISPLAY_STATE_LOST
} INBV_DISPLAY_STATE;
//
// Function Callbacks
//
typedef
BOOLEAN
(NTAPI *INBV_RESET_DISPLAY_PARAMETERS)(
ULONG Cols,
ULONG Rows
);
typedef
VOID
(NTAPI *INBV_DISPLAY_STRING_FILTER)(
PCHAR *Str
);
#endif
#endif
@@ -0,0 +1,72 @@
#ifndef _BOOTVID_
#define _BOOTVID_
BOOLEAN
NTAPI
VidInitialize(IN BOOLEAN SetMode);
VOID
NTAPI
VidResetDisplay(IN BOOLEAN HalReset);
ULONG
NTAPI
VidSetTextColor(ULONG Color);
VOID
NTAPI
VidDisplayStringXY(PUCHAR String,
ULONG Left,
ULONG Top,
BOOLEAN Transparent);
VOID
NTAPI
VidSetScrollRegion(ULONG x1,
ULONG y1,
ULONG x2,
ULONG y2);
VOID
NTAPI
VidCleanUp(VOID);
VOID
NTAPI
VidBufferToScreenBlt(IN PUCHAR Buffer,
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta);
VOID
NTAPI
VidDisplayString(PUCHAR String);
VOID
NTAPI
VidBitBlt(PUCHAR Buffer,
ULONG Left,
ULONG Top);
VOID
NTAPI
VidScreenToBufferBlt(PUCHAR Buffer,
ULONG Left,
ULONG Top,
ULONG Width,
ULONG Height,
ULONG Delta);
VOID
NTAPI
VidSolidColorFill(IN ULONG Left,
IN ULONG Top,
IN ULONG Right,
IN ULONG Bottom,
IN UCHAR Color);
#endif
+6 -5
View File
@@ -1020,20 +1020,20 @@ Phase1InitializationDiscard(PVOID Context)
SosEnabled = strstr(CommandLine, "SOS") ? TRUE: FALSE;
/* Setup the boot driver */
InbvDisplayInitialize();
if (!ExpInTextModeSetup) InbvDisplayInitialize2(NoGuiBoot);
InbvEnableBootDriver(!NoGuiBoot);
InbvDriverInitialize(LoaderBlock, 18);
/* Check if GUI boot is enabled */
if (!NoGuiBoot)
{
/* It is, display the boot logo and enable printing strings */
InbvEnableDisplayString(SosEnabled);
InbvDisplayBootLogo(SosEnabled);
//DisplayBootBitmap(SosEnabled);
}
else
{
/* Release display ownership if not using GUI boot */
if (!SosEnabled) InbvNotifyDisplayOwnershipLost(NULL);
InbvNotifyDisplayOwnershipLost(NULL);
/* Don't allow boot-time strings */
InbvEnableDisplayString(FALSE);
@@ -1207,7 +1207,8 @@ Phase1InitializationDiscard(PVOID Context)
/* Wait 5 seconds for it to initialize */
Timeout.QuadPart = Int32x32To64(5, -10000000);
Status = ZwWaitForSingleObject(ProcessInfo->ProcessHandle, FALSE, &Timeout);
if (!NoGuiBoot) InbvFinalizeBootLogo();
//if (InbvBootDriverInstalled) FinalizeBootLogo();
if (Status == STATUS_SUCCESS)
{
/* Bugcheck the system if SMSS couldn't initialize */
+440 -259
View File
@@ -1,350 +1,531 @@
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/inbv/inbv.c
* PURPOSE: Boot video support
*
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, InbvDisplayInitialize)
#endif
#include <debug.h>
#include "bootvid\bootvid.h"
/* GLOBALS *******************************************************************/
/* DATA **********************************************************************/
static BOOLEAN BootVidDriverInstalled = FALSE;
static BOOLEAN (NTAPI *VidInitialize)(BOOLEAN);
static VOID (NTAPI *VidCleanUp)(VOID);
static VOID (NTAPI *VidResetDisplay)(VOID);
static VOID (NTAPI *VidBufferToScreenBlt)(PUCHAR, ULONG, ULONG, ULONG, ULONG, ULONG);
static VOID (NTAPI *VidScreenToBufferBlt)(PUCHAR, ULONG, ULONG, ULONG, ULONG, ULONG);
static VOID (NTAPI *VidBitBlt)(PUCHAR, ULONG, ULONG);
static VOID (NTAPI *VidSolidColorFill)(ULONG, ULONG, ULONG, ULONG, ULONG);
static VOID (NTAPI *VidDisplayString)(PCSTR);
static NTSTATUS (NTAPI *BootVidDisplayBootLogo)(PVOID);
static VOID (NTAPI *BootVidUpdateProgress)(ULONG Progress);
static VOID (NTAPI *BootVidFinalizeBootLogo)(VOID);
static KSPIN_LOCK InbvLock;
static KIRQL InbvOldIrql;
static ULONG InbvDisplayState = 0;
static PHAL_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL;
static PVOID BootVidBase;
KSPIN_LOCK BootDriverLock;
KIRQL InbvOldIrql;
INBV_DISPLAY_STATE InbvDisplayState;
BOOLEAN InbvBootDriverInstalled;
BOOLEAN InbvDisplayDebugStrings;
INBV_DISPLAY_STRING_FILTER InbvDisplayFilter;
ULONG ProgressBarLeft, ProgressBarTop;
BOOLEAN ShowProgressBar;
INBV_PROGRESS_STATE InbvProgressState;
INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters;
ULONG ResourceCount;
PUCHAR ResourceList[64];
/* FUNCTIONS *****************************************************************/
VOID NTAPI INIT_FUNCTION
InbvDisplayInitialize(VOID)
PVOID
NTAPI
FindBitmapResource(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG ResourceId)
{
struct {
ANSI_STRING Name;
PVOID *Ptr;
} Exports[] = {
{ RTL_CONSTANT_STRING("VidInitialize"), (PVOID*)&VidInitialize },
{ RTL_CONSTANT_STRING("VidCleanUp"), (PVOID*)&VidCleanUp },
{ RTL_CONSTANT_STRING("VidResetDisplay"), (PVOID*)&VidResetDisplay },
{ RTL_CONSTANT_STRING("VidBufferToScreenBlt"), (PVOID*)&VidBufferToScreenBlt },
{ RTL_CONSTANT_STRING("VidScreenToBufferBlt"), (PVOID*)&VidScreenToBufferBlt },
{ RTL_CONSTANT_STRING("VidBitBlt"), (PVOID*)&VidBitBlt },
{ RTL_CONSTANT_STRING("VidSolidColorFill"), (PVOID*)&VidSolidColorFill },
{ RTL_CONSTANT_STRING("VidDisplayString"), (PVOID*)&VidDisplayString },
{ RTL_CONSTANT_STRING("BootVidDisplayBootLogo"), (PVOID*)&BootVidDisplayBootLogo },
{ RTL_CONSTANT_STRING("BootVidUpdateProgress"), (PVOID*)&BootVidUpdateProgress },
{ RTL_CONSTANT_STRING("BootVidFinalizeBootLogo"), (PVOID*)&BootVidFinalizeBootLogo }
};
UNICODE_STRING BootVidPath = RTL_CONSTANT_STRING(L"bootvid.sys");
PLDR_DATA_TABLE_ENTRY ModuleObject = NULL, LdrEntry;
ULONG Index;
NTSTATUS Status;
UNICODE_STRING UpString = RTL_CONSTANT_STRING(L"ntoskrnl.exe");
UNICODE_STRING MpString = RTL_CONSTANT_STRING(L"ntkrnlmp.exe");
PLIST_ENTRY NextEntry, ListHead;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
LDR_RESOURCE_INFO ResourceInfo;
ULONG Size;
NTSTATUS Status;
PVOID Data = NULL;
/* FIXME: Hack, try to search for boot driver. */
#if 0
ModuleObject = LdrGetModuleObject(&BootVidPath);
#else
{
NTSTATUS LdrProcessModule(PVOID, PUNICODE_STRING, PLDR_DATA_TABLE_ENTRY*);
PLIST_ENTRY ListHead, NextEntry;
/* Loop the driver list */
ListHead = &LoaderBlock->LoadOrderListHead;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the entry */
LdrEntry = CONTAINING_RECORD(NextEntry,
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
ListHead = &KeLoaderBlock->LoadOrderListHead;
NextEntry = ListHead->Flink;
while (ListHead != NextEntry)
{
/* Get the entry */
LdrEntry = CONTAINING_RECORD(NextEntry,
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
/* Compare names */
if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &BootVidPath, TRUE))
{
/* Tell, that the module is already loaded */
LdrEntry->Flags |= LDRP_ENTRY_INSERTED;
Status = LdrProcessModule(LdrEntry->DllBase,
&BootVidPath,
&ModuleObject);
if (!NT_SUCCESS(Status))
{
DPRINT1("%x\n", Status);
return;
}
/* Check for a match */
if ((RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE)) ||
(RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE)))
{
/* Break out */
break;
}
}
}
/* Go to the next driver */
NextEntry= NextEntry->Flink;
}
}
#endif
/* Check if we found it */
if (NextEntry != ListHead)
{
/* Try to find the resource */
ResourceInfo.Type = 2;
ResourceInfo.Name = ResourceId;
ResourceInfo.Language = 0;
Status = LdrFindResource_U(LdrEntry->DllBase,
&ResourceInfo,
RESOURCE_DATA_LEVEL,
&ResourceDataEntry);
if (NT_SUCCESS(Status))
{
/* Access the resource */
Status = LdrAccessResource(LdrEntry->DllBase,
ResourceDataEntry,
&Data,
&Size);
if (!NT_SUCCESS(Status)) Data = NULL;
}
}
if (ModuleObject != NULL)
{
for (Index = 0; Index < sizeof(Exports) / sizeof(Exports[0]); Index++)
{
Status = LdrGetProcedureAddress(ModuleObject->DllBase,
&Exports[Index].Name, 0,
Exports[Index].Ptr);
if (!NT_SUCCESS(Status))
return;
}
DPRINT("Done!\n");
KeInitializeSpinLock(&InbvLock);
BootVidBase = ModuleObject->DllBase;
BootVidDriverInstalled = TRUE;
}
/* Return the pointer */
return Data;
}
static VOID NTAPI
BOOLEAN
NTAPI
InbvDriverInitialize(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Count)
{
PCHAR CommandLine;
BOOLEAN CustomLogo = FALSE;
ULONG i;
/* Quit if we're already installed */
if (InbvBootDriverInstalled) return TRUE;
/* Initialize the lock and check the current display state */
KeInitializeSpinLock(&BootDriverLock);
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
{
/* Check if we have a custom boot logo */
CommandLine = _strupr(LoaderBlock->LoadOptions);
CustomLogo = strstr(CommandLine, "BOOTLOGO") ? TRUE: FALSE;
}
/* Initialize the video */
InbvBootDriverInstalled = VidInitialize(CustomLogo);
DPRINT1("Init: %lx\n", InbvBootDriverInstalled);
if (InbvBootDriverInstalled)
{
/* Find bitmap resources in the kernel */
ResourceCount = Count;
for (i = 0; i < Count; i++)
{
/* Do the lookup */
ResourceList[i] = FindBitmapResource(LoaderBlock, i);
}
/* Set the progress bar ranges */
InbvSetProgressBarSubset(0, 100);
}
/* Return install state */
return InbvBootDriverInstalled;
}
VOID
NTAPI
InbvAcquireLock(VOID)
{
if ((InbvOldIrql = KeGetCurrentIrql()) < DISPATCH_LEVEL)
InbvOldIrql = KfRaiseIrql(DISPATCH_LEVEL);
KiAcquireSpinLock(&InbvLock);
/* Check if we're below dispatch level */
InbvOldIrql = KeGetCurrentIrql();
if (InbvOldIrql < DISPATCH_LEVEL)
{
/* Raise IRQL to dispatch level */
InbvOldIrql = KfRaiseIrql(DISPATCH_LEVEL);
}
/* Acquire the lock */
KiAcquireSpinLock(&BootDriverLock);
}
static VOID NTAPI
VOID
NTAPI
InbvReleaseLock(VOID)
{
KiReleaseSpinLock(&InbvLock);
if (InbvOldIrql < DISPATCH_LEVEL)
KfLowerIrql(InbvOldIrql);
/* Release the driver lock */
KiReleaseSpinLock(&BootDriverLock);
/* If we were below dispatch level, lower IRQL back */
if (InbvOldIrql < DISPATCH_LEVEL) KfLowerIrql(InbvOldIrql);
}
VOID STDCALL
VOID
NTAPI
InbvEnableBootDriver(IN BOOLEAN Enable)
{
if (BootVidDriverInstalled)
{
if (InbvDisplayState >= 2)
return;
InbvAcquireLock();
if (InbvDisplayState == 0)
VidCleanUp();
InbvDisplayState = !Enable;
InbvReleaseLock();
}
else
{
InbvDisplayState = !Enable;
}
/* Check if we're installed */
if (InbvBootDriverInstalled)
{
/* Check for lost state */
if (InbvDisplayState >= INBV_DISPLAY_STATE_LOST) return;
/* Acquire the lock */
InbvAcquireLock();
/* Cleanup the screen if we own it */
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED) VidCleanUp();
/* Set the new display state */
InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED:
INBV_DISPLAY_STATE_DISABLED;
/* Release the lock */
InbvReleaseLock();
}
else
{
/* Set the new display state */
InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED:
INBV_DISPLAY_STATE_DISABLED;
}
}
VOID NTAPI
VOID
NTAPI
InbvAcquireDisplayOwnership(VOID)
{
if (InbvResetDisplayParameters && InbvDisplayState == 2)
{
if (InbvResetDisplayParameters != NULL)
InbvResetDisplayParameters(80, 50);
}
InbvDisplayState = 0;
/* Check if we have a callback and we're just acquiring it now */
if ((InbvResetDisplayParameters) &&
(InbvDisplayState == INBV_DISPLAY_STATE_LOST))
{
/* Call the callback */
InbvResetDisplayParameters(80, 50);
}
/* Acquire the display */
InbvDisplayState = INBV_DISPLAY_STATE_OWNED;
}
BOOLEAN STDCALL
VOID
NTAPI
InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned)
{
/* Set the new display state */
InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED:
INBV_DISPLAY_STATE_LOST;
}
BOOLEAN
NTAPI
InbvCheckDisplayOwnership(VOID)
{
return InbvDisplayState != 2;
/* Return if we own it or not */
return InbvDisplayState != INBV_DISPLAY_STATE_LOST;
}
BOOLEAN STDCALL
INBV_DISPLAY_STATE
NTAPI
InbvGetDisplayState(VOID)
{
/* Return the actual state */
return InbvDisplayState;
}
BOOLEAN
NTAPI
InbvDisplayString(IN PCHAR String)
{
if (BootVidDriverInstalled && InbvDisplayState == 0)
{
InbvAcquireLock();
VidDisplayString(String);
InbvReleaseLock();
/* Make sure we own the display */
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
{
/* If we're not allowed, return success anyway */
if (!InbvDisplayDebugStrings) return TRUE;
/* Call Headless (We don't support headless for now)
HeadlessDispatch(DISPLAY_STRING);
*/
/* Check if a filter is installed */
if (InbvDisplayFilter) InbvDisplayFilter(&String);
return TRUE;
}
/* Acquire the lock */
InbvAcquireLock();
return FALSE;
/* Make sure we're installed and display the string */
if (InbvBootDriverInstalled) VidDisplayString(String);
/* Call Headless (We don't support headless for now)
HeadlessDispatch(DISPLAY_STRING); */
/* Release the lock */
InbvReleaseLock();
/* All done */
return TRUE;
}
/* We don't own it, fail */
return FALSE;
}
BOOLEAN STDCALL
BOOLEAN
NTAPI
InbvEnableDisplayString(IN BOOLEAN Enable)
{
return FALSE;
BOOLEAN OldSetting;
/* Get the old setting */
OldSetting = InbvDisplayDebugStrings;
/* Update it */
InbvDisplayDebugStrings = Enable;
/* Return the old setting */
return OldSetting;
}
VOID STDCALL
InbvInstallDisplayStringFilter(IN PVOID Unknown)
VOID
NTAPI
InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
{
/* Save the filter */
InbvDisplayFilter = Filter;
}
BOOLEAN STDCALL
BOOLEAN
NTAPI
InbvIsBootDriverInstalled(VOID)
{
return BootVidDriverInstalled;
/* Return driver state */
return InbvBootDriverInstalled;
}
VOID STDCALL
InbvNotifyDisplayOwnershipLost(
IN PVOID Callback)
VOID
NTAPI
InbvNotifyDisplayOwnershipLost(IN INBV_RESET_DISPLAY_PARAMETERS Callback)
{
if (BootVidDriverInstalled)
{
InbvAcquireLock();
if (InbvDisplayState != 2)
VidCleanUp();
else if (InbvResetDisplayParameters != NULL)
InbvResetDisplayParameters(80, 50);
InbvResetDisplayParameters = Callback;
InbvDisplayState = 2;
InbvReleaseLock();
}
else
{
InbvResetDisplayParameters = Callback;
InbvDisplayState = 2;
}
/* Check if we're installed */
if (InbvBootDriverInstalled)
{
/* Acquire the lock and cleanup if we own the screen */
InbvAcquireLock();
if (InbvDisplayState != INBV_DISPLAY_STATE_LOST) VidCleanUp();
/* Set the reset callback and display state */
InbvResetDisplayParameters = Callback;
InbvDisplayState = INBV_DISPLAY_STATE_LOST;
/* Release the lock */
InbvReleaseLock();
}
else
{
/* Set the reset callback and display state */
InbvResetDisplayParameters = Callback;
InbvDisplayState = INBV_DISPLAY_STATE_LOST;
}
}
BOOLEAN STDCALL
BOOLEAN
NTAPI
InbvResetDisplay(VOID)
{
if (BootVidDriverInstalled && InbvDisplayState == 0)
{
VidResetDisplay();
return TRUE;
}
return FALSE;
/* Check if we're installed and we own it */
if ((InbvBootDriverInstalled) &&
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
{
/* Do the reset */
VidResetDisplay(TRUE);
return TRUE;
}
/* Nothing to reset */
return FALSE;
}
VOID STDCALL
InbvSetScrollRegion(
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height)
VOID
NTAPI
InbvSetScrollRegion(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height)
{
/* Just call bootvid */
VidSetScrollRegion(Left, Top, Width, Height);
}
VOID STDCALL
InbvSetTextColor(
IN ULONG Color)
VOID
NTAPI
InbvSetTextColor(IN ULONG Color)
{
/* FIXME: Headless */
/* Update the text color */
VidSetTextColor(Color);
}
VOID STDCALL
InbvSolidColorFill(
IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Color)
VOID
NTAPI
InbvSolidColorFill(IN ULONG Left,
IN ULONG Top,
IN ULONG Width,
IN ULONG Height,
IN ULONG Color)
{
if (BootVidDriverInstalled && InbvDisplayState == 0)
{
VidSolidColorFill(Left, Top, Width, Height, Color);
}
/* Make sure we own it */
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
{
/* Acquire the lock */
InbvAcquireLock();
/* Check if we're installed */
if (InbvBootDriverInstalled)
{
/* Call bootvid */
VidSolidColorFill(Left, Top, Width, Height, Color);
}
/* FIXME: Headless */
/* Release the lock */
InbvReleaseLock();
}
}
BOOLEAN NTAPI
BootVidResetDisplayParameters(ULONG SizeX, ULONG SizeY)
VOID
NTAPI
InbvUpdateProgressBar(IN ULONG Progress)
{
BootVidFinalizeBootLogo();
return TRUE;
ULONG FillCount, Left = 0;
/* Make sure the progress bar is enabled, that we own and are installed */
if ((ShowProgressBar) &&
(InbvBootDriverInstalled) &&
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
{
/* Calculate the fill count */
FillCount = InbvProgressState.Bias * Progress + InbvProgressState.Floor;
FillCount *= 18;
FillCount /= 10000;
/* Start fill loop */
while (FillCount)
{
/* Acquire the lock */
InbvAcquireLock();
/* Fill the progress bar */
VidSolidColorFill(Left + ProgressBarLeft,
ProgressBarTop,
Left + ProgressBarLeft + 7,
ProgressBarTop + 7,
11);
/* Release the lock */
InbvReleaseLock();
/* Update the X position */
Left += 9;
FillCount--;
}
}
}
VOID NTAPI
InbvDisplayInitialize2(BOOLEAN NoGuiBoot)
VOID
NTAPI
InbvBufferToScreenBlt(IN PUCHAR Buffer,
IN ULONG X,
IN ULONG Y,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
VidInitialize(!NoGuiBoot);
/* Check if we're installed and we own it */
if ((InbvBootDriverInstalled) &&
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
{
/* Do the blit */
VidBufferToScreenBlt(Buffer, X, Y, Width, Height, Delta);
}
}
VOID NTAPI
InbvDisplayBootLogo(IN BOOLEAN SosEnabled)
VOID
NTAPI
InbvBitBlt(IN PUCHAR Buffer,
IN ULONG X,
IN ULONG Y)
{
InbvEnableBootDriver(TRUE);
/* Check if we're installed and we own it */
if ((InbvBootDriverInstalled) &&
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
{
/* Acquire the lock */
InbvAcquireLock();
if (BootVidDriverInstalled)
{
InbvResetDisplayParameters = BootVidResetDisplayParameters;
if (!SosEnabled) BootVidDisplayBootLogo(BootVidBase);
}
/* Do the blit */
VidBitBlt(Buffer, X, Y);
/* Release the lock */
InbvReleaseLock();
}
}
VOID NTAPI
InbvUpdateProgressBar(
IN ULONG Progress)
VOID
NTAPI
InbvScreenToBufferBlt(IN PUCHAR Buffer,
IN ULONG X,
IN ULONG Y,
IN ULONG Width,
IN ULONG Height,
IN ULONG Delta)
{
if (BootVidDriverInstalled)
{
BootVidUpdateProgress(Progress);
}
/* Check if we're installed and we own it */
if ((InbvBootDriverInstalled) &&
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
{
/* Do the blit */
VidScreenToBufferBlt(Buffer, X, Y, Width, Height, Delta);
}
}
VOID NTAPI
InbvFinalizeBootLogo(VOID)
VOID
NTAPI
InbvSetProgressBarCoordinates(IN ULONG Left,
IN ULONG Top)
{
if (BootVidDriverInstalled)
{
/* Notify the hal we have released the display. */
/* InbvReleaseDisplayOwnership(); */
BootVidFinalizeBootLogo();
InbvEnableBootDriver(FALSE);
}
/* Update the coordinates */
ProgressBarLeft = Left;
ProgressBarTop = Top;
/* Enable the progress bar */
ShowProgressBar = TRUE;
}
NTSTATUS STDCALL
NtDisplayString(
IN PUNICODE_STRING DisplayString)
VOID
NTAPI
InbvSetProgressBarSubset(IN ULONG Floor,
IN ULONG Ceiling)
{
OEM_STRING OemString;
/* Sanity checks */
ASSERT(Floor < Ceiling);
ASSERT(Ceiling <= 100);
RtlUnicodeStringToOemString(&OemString, DisplayString, TRUE);
InbvDisplayString(OemString.Buffer);
RtlFreeOemString(&OemString);
return STATUS_SUCCESS;
/* Update the progress bar state */
InbvProgressState.Floor = Floor * 100;
InbvProgressState.Ceiling = Ceiling * 100;
InbvProgressState.Bias = (Ceiling * 100) - Floor;
}
PUCHAR
NTAPI
InbvGetResourceAddress(IN ULONG ResourceNumber)
{
/* Validate the resource number */
if (ResourceNumber > ResourceCount) return NULL;
/* Return the address */
return ResourceList[ResourceNumber--];
}
NTSTATUS
NTAPI
NtDisplayString(IN PUNICODE_STRING DisplayString)
{
OEM_STRING OemString;
/* Convert the string to OEM and display it */
RtlUnicodeStringToOemString(&OemString, DisplayString, TRUE);
InbvDisplayString(OemString.Buffer);
RtlFreeOemString(&OemString);
/* Return success */
return STATUS_SUCCESS;
}
+22 -17
View File
@@ -1,26 +1,31 @@
#ifndef NTOSKRNL_INBV_H
#define NTOSKRNL_INBV_H
/* INCLUDES ******************************************************************/
typedef struct _InbvProgressState
{
ULONG Floor;
ULONG Ceiling;
ULONG Bias;
} INBV_PROGRESS_STATE;
/* DEFINES *******************************************************************/
VOID
NTAPI
InbvUpdateProgressBar(
IN ULONG Progress
);
/* FUNCTIONS *****************************************************************/
BOOLEAN
NTAPI
InbvDriverInitialize(
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Count
);
VOID NTAPI INIT_FUNCTION
InbvDisplayInitialize(VOID);
VOID NTAPI
InbvDisplayInitialize2(BOOLEAN NoGuiBoot);
VOID NTAPI
InbvDisplayBootLogo(IN BOOLEAN SosEnabled);
VOID NTAPI
InbvUpdateProgressBar(ULONG Progress);
VOID NTAPI
InbvFinalizeBootLogo(VOID);
VOID
NTAPI
InbvEnableBootDriver(
IN BOOLEAN Enable
);
#endif /* NTOSKRNL_INBV_H */
+1 -2
View File
@@ -41,7 +41,6 @@ ARC_DISK_INFORMATION BldrArcDiskInfo; // 0x9F34
CHAR BldrArcNames[32][256]; // 0x9F3C
ARC_DISK_SIGNATURE BldrDiskInfo[32]; // 0xBF3C
// 0xC23C
ULONG Guard = 0xCACA1234;
/* FUNCTIONS *****************************************************************/
@@ -342,7 +341,7 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
MmSystemRangeStart = (PVOID)KeRosLoaderBlock->KernelBase;
/* Convert every driver address to virtual memory */
for (i = 2; i < KeRosLoaderBlock->ModsCount; i++)
for (i = 3; i < KeRosLoaderBlock->ModsCount; i++)
{
/* Subtract the base Address in Physical Memory */
KeRosLoaderBlock->ModsAddr[i].ModStart -= 0x200000;
+1
View File
@@ -20,6 +20,7 @@
<library>rossym</library>
<library>string</library>
<library>kdcom</library>
<library>bootvid</library>
<library>wdmguid</library>
<directory name="include">
<pch>ntoskrnl.h</pch>