mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[BLUE]
- Fix code designed to avoid touching the hardware if it is already owned [KDIO] - Take ownership of the display if we're debugging to screen [TXTSETUP.SIF] - Add an example entry of DbgOsLoadOptions for debugging 1st stage to screen - 1st stage setup can now be debugged completely to screen with a modified txtsetup.sif (comment 1st DbgOsLoadOptions and uncomment 2nd) svn path=/trunk/; revision=55570
This commit is contained in:
parent
65beefbcd8
commit
8b553a4ba7
3 changed files with 224 additions and 158 deletions
|
@ -115,8 +115,8 @@ Cabinet=reactos.cab
|
||||||
DefaultPath = \ReactOS
|
DefaultPath = \ReactOS
|
||||||
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
|
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
|
||||||
DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /FIRSTCHANCE"
|
DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /FIRSTCHANCE"
|
||||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
|
;DbgOsLoadOptions = "/SOS /DEBUGPORT=SCREEN"
|
||||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
|
;DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
|
||||||
|
|
||||||
[NLS]
|
[NLS]
|
||||||
AnsiCodepage = c_1252.nls
|
AnsiCodepage = c_1252.nls
|
||||||
|
|
|
@ -224,7 +224,7 @@ DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
|
||||||
static DRIVER_DISPATCH ScrCreate;
|
static DRIVER_DISPATCH ScrCreate;
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
ScrCreate(PDEVICE_OBJECT DeviceObject,
|
ScrCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
PHYSICAL_ADDRESS BaseAddress;
|
PHYSICAL_ADDRESS BaseAddress;
|
||||||
|
@ -232,12 +232,22 @@ ScrCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
DeviceExtension = DeviceObject->DeviceExtension;
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
ScrAcquireOwnership(DeviceExtension);
|
if (!InbvCheckDisplayOwnership())
|
||||||
|
{
|
||||||
|
ScrAcquireOwnership(DeviceExtension);
|
||||||
|
|
||||||
/* get pointer to video memory */
|
/* get pointer to video memory */
|
||||||
BaseAddress.QuadPart = VIDMEM_BASE;
|
BaseAddress.QuadPart = VIDMEM_BASE;
|
||||||
DeviceExtension->VideoMemory =
|
DeviceExtension->VideoMemory =
|
||||||
(PUCHAR)MmMapIoSpace (BaseAddress, DeviceExtension->Rows * DeviceExtension->Columns * 2, MmNonCached);
|
(PUCHAR)MmMapIoSpace (BaseAddress, DeviceExtension->Rows * DeviceExtension->Columns * 2, MmNonCached);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* store dummy values here */
|
||||||
|
DeviceExtension->Columns = 1;
|
||||||
|
DeviceExtension->Rows = 1;
|
||||||
|
DeviceExtension->ScanLines = 1;
|
||||||
|
}
|
||||||
|
|
||||||
DeviceExtension->CursorSize = 5; /* FIXME: value correct?? */
|
DeviceExtension->CursorSize = 5; /* FIXME: value correct?? */
|
||||||
DeviceExtension->CursorVisible = TRUE;
|
DeviceExtension->CursorVisible = TRUE;
|
||||||
|
@ -258,7 +268,7 @@ ScrCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
static DRIVER_DISPATCH ScrWrite;
|
static DRIVER_DISPATCH ScrWrite;
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
ScrWrite(PDEVICE_OBJECT DeviceObject,
|
ScrWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
|
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
|
||||||
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
|
@ -271,16 +281,16 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
int rows, columns;
|
int rows, columns;
|
||||||
int processed = DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT;
|
int processed = DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT;
|
||||||
|
|
||||||
if (0 && InbvCheckDisplayOwnership())
|
if (InbvCheckDisplayOwnership())
|
||||||
{
|
{
|
||||||
/* Display is in graphics mode, we're not allowed to touch it */
|
/* Display is in graphics mode, we're not allowed to touch it */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
rows = DeviceExtension->Rows;
|
rows = DeviceExtension->Rows;
|
||||||
|
@ -297,86 +307,86 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
cursorx = offset % columns;
|
cursorx = offset % columns;
|
||||||
if( processed == 0 )
|
if( processed == 0 )
|
||||||
{
|
{
|
||||||
/* raw output mode */
|
/* raw output mode */
|
||||||
memcpy( &vidmem[(cursorx * 2) + (cursory * columns * 2)], pch, stk->Parameters.Write.Length );
|
memcpy( &vidmem[(cursorx * 2) + (cursory * columns * 2)], pch, stk->Parameters.Write.Length );
|
||||||
offset += (stk->Parameters.Write.Length / 2);
|
offset += (stk->Parameters.Write.Length / 2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (i = 0; i < stk->Parameters.Write.Length; i++, pch++)
|
for (i = 0; i < stk->Parameters.Write.Length; i++, pch++)
|
||||||
{
|
{
|
||||||
switch (*pch)
|
switch (*pch)
|
||||||
{
|
{
|
||||||
case '\b':
|
case '\b':
|
||||||
if (cursorx > 0)
|
if (cursorx > 0)
|
||||||
{
|
{
|
||||||
cursorx--;
|
cursorx--;
|
||||||
}
|
}
|
||||||
else if (cursory > 0)
|
else if (cursory > 0)
|
||||||
{
|
{
|
||||||
cursorx = columns - 1;
|
cursorx = columns - 1;
|
||||||
cursory--;
|
cursory--;
|
||||||
}
|
}
|
||||||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
||||||
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
cursory++;
|
cursory++;
|
||||||
cursorx = 0;
|
cursorx = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\r':
|
case '\r':
|
||||||
cursorx = 0;
|
cursorx = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\t':
|
case '\t':
|
||||||
offset = TAB_WIDTH - (cursorx % TAB_WIDTH);
|
offset = TAB_WIDTH - (cursorx % TAB_WIDTH);
|
||||||
for (j = 0; j < offset; j++)
|
for (j = 0; j < offset; j++)
|
||||||
{
|
{
|
||||||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
||||||
cursorx++;
|
cursorx++;
|
||||||
|
|
||||||
if (cursorx >= columns)
|
if (cursorx >= columns)
|
||||||
{
|
{
|
||||||
cursory++;
|
cursory++;
|
||||||
cursorx = 0;
|
cursorx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = *pch;
|
vidmem[(cursorx * 2) + (cursory * columns * 2)] = *pch;
|
||||||
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
||||||
cursorx++;
|
cursorx++;
|
||||||
if (cursorx >= columns)
|
if (cursorx >= columns)
|
||||||
{
|
{
|
||||||
cursory++;
|
cursory++;
|
||||||
cursorx = 0;
|
cursorx = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cursory >= rows)
|
if (cursory >= rows)
|
||||||
{
|
{
|
||||||
unsigned short *LinePtr;
|
unsigned short *LinePtr;
|
||||||
|
|
||||||
memcpy (vidmem,
|
memcpy (vidmem,
|
||||||
&vidmem[columns * 2],
|
&vidmem[columns * 2],
|
||||||
columns * (rows - 1) * 2);
|
columns * (rows - 1) * 2);
|
||||||
|
|
||||||
LinePtr = (unsigned short *) &vidmem[columns * (rows - 1) * 2];
|
LinePtr = (unsigned short *) &vidmem[columns * (rows - 1) * 2];
|
||||||
|
|
||||||
for (j = 0; j < columns; j++)
|
for (j = 0; j < columns; j++)
|
||||||
{
|
{
|
||||||
LinePtr[j] = DeviceExtension->CharAttribute << 8;
|
LinePtr[j] = DeviceExtension->CharAttribute << 8;
|
||||||
}
|
}
|
||||||
cursory = rows - 1;
|
cursory = rows - 1;
|
||||||
for (j = 0; j < columns; j++)
|
for (j = 0; j < columns; j++)
|
||||||
{
|
{
|
||||||
vidmem[(j * 2) + (cursory * columns * 2)] = ' ';
|
vidmem[(j * 2) + (cursory * columns * 2)] = ' ';
|
||||||
vidmem[(j * 2) + (cursory * columns * 2) + 1] = (char)DeviceExtension->CharAttribute;
|
vidmem[(j * 2) + (cursory * columns * 2) + 1] = (char)DeviceExtension->CharAttribute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the cursor position */
|
/* Set the cursor position */
|
||||||
offset = (cursory * columns) + cursorx;
|
offset = (cursory * columns) + cursorx;
|
||||||
|
@ -400,7 +410,7 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
static DRIVER_DISPATCH ScrIoControl;
|
static DRIVER_DISPATCH ScrIoControl;
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
|
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
|
@ -416,13 +426,20 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int columns = DeviceExtension->Columns;
|
int columns = DeviceExtension->Columns;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
|
||||||
/* read cursor position from crtc */
|
if (!InbvCheckDisplayOwnership())
|
||||||
_disable();
|
{
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
/* read cursor position from crtc */
|
||||||
offset = READ_PORT_UCHAR (CRTC_DATA);
|
_disable();
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
||||||
offset += (READ_PORT_UCHAR (CRTC_DATA) << 8);
|
offset = READ_PORT_UCHAR (CRTC_DATA);
|
||||||
_enable();
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
||||||
|
offset += (READ_PORT_UCHAR (CRTC_DATA) << 8);
|
||||||
|
_enable();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pcsbi->dwSize.X = columns;
|
pcsbi->dwSize.X = columns;
|
||||||
pcsbi->dwSize.Y = rows;
|
pcsbi->dwSize.Y = rows;
|
||||||
|
@ -454,12 +471,15 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
offset = (pcsbi->dwCursorPosition.Y * DeviceExtension->Columns) +
|
offset = (pcsbi->dwCursorPosition.Y * DeviceExtension->Columns) +
|
||||||
pcsbi->dwCursorPosition.X;
|
pcsbi->dwCursorPosition.X;
|
||||||
|
|
||||||
_disable();
|
if (!InbvCheckDisplayOwnership())
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
{
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, offset);
|
_disable();
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, offset>>8);
|
WRITE_PORT_UCHAR (CRTC_DATA, offset);
|
||||||
_enable();
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
||||||
|
WRITE_PORT_UCHAR (CRTC_DATA, offset>>8);
|
||||||
|
_enable();
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -486,25 +506,29 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
DeviceExtension->CursorSize = pcci->dwSize;
|
DeviceExtension->CursorSize = pcci->dwSize;
|
||||||
DeviceExtension->CursorVisible = pcci->bVisible;
|
DeviceExtension->CursorVisible = pcci->bVisible;
|
||||||
height = DeviceExtension->ScanLines;
|
|
||||||
data = (pcci->bVisible) ? 0x00 : 0x20;
|
|
||||||
|
|
||||||
size = (pcci->dwSize * height) / 100;
|
if (!InbvCheckDisplayOwnership())
|
||||||
if (size < 1)
|
{
|
||||||
|
height = DeviceExtension->ScanLines;
|
||||||
|
data = (pcci->bVisible) ? 0x00 : 0x20;
|
||||||
|
|
||||||
|
size = (pcci->dwSize * height) / 100;
|
||||||
|
if (size < 1)
|
||||||
{
|
{
|
||||||
size = 1;
|
size = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data |= (UCHAR)(height - size);
|
data |= (UCHAR)(height - size);
|
||||||
|
|
||||||
_disable();
|
_disable();
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORSTART);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORSTART);
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, data);
|
WRITE_PORT_UCHAR (CRTC_DATA, data);
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSOREND);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSOREND);
|
||||||
value = READ_PORT_UCHAR (CRTC_DATA) & 0xE0;
|
value = READ_PORT_UCHAR (CRTC_DATA) & 0xE0;
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, value | (height - 1));
|
WRITE_PORT_UCHAR (CRTC_DATA, value | (height - 1));
|
||||||
|
|
||||||
_enable();
|
_enable();
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -540,14 +564,17 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
if (!InbvCheckDisplayOwnership())
|
||||||
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
{
|
||||||
(Buf->dwCoord.X * 2) + 1;
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
||||||
|
(Buf->dwCoord.X * 2) + 1;
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < Buf->nLength; dwCount++)
|
for (dwCount = 0; dwCount < Buf->nLength; dwCount++)
|
||||||
{
|
{
|
||||||
vidmem[offset + (dwCount * 2)] = (char) Buf->wAttribute;
|
vidmem[offset + (dwCount * 2)] = (char) Buf->wAttribute;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Buf->dwTransfered = Buf->nLength;
|
Buf->dwTransfered = Buf->nLength;
|
||||||
|
|
||||||
|
@ -564,16 +591,23 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
if (!InbvCheckDisplayOwnership())
|
||||||
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
{
|
||||||
(Buf->dwCoord.X * 2) + 1;
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
||||||
|
(Buf->dwCoord.X * 2) + 1;
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < stk->Parameters.DeviceIoControl.OutputBufferLength; dwCount++, pAttr++)
|
for (dwCount = 0; dwCount < stk->Parameters.DeviceIoControl.OutputBufferLength; dwCount++, pAttr++)
|
||||||
{
|
{
|
||||||
*((char *) pAttr) = vidmem[offset + (dwCount * 2)];
|
*((char *) pAttr) = vidmem[offset + (dwCount * 2)];
|
||||||
}
|
}
|
||||||
|
|
||||||
Buf->dwTransfered = dwCount;
|
Buf->dwTransfered = dwCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buf->dwTransfered = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
|
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -588,14 +622,18 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
if (!InbvCheckDisplayOwnership())
|
||||||
offset = (pCoord->Y * DeviceExtension->Columns * 2) +
|
{
|
||||||
(pCoord->X * 2) + 1;
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (pCoord->Y * DeviceExtension->Columns * 2) +
|
||||||
|
(pCoord->X * 2) + 1;
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < (stk->Parameters.DeviceIoControl.OutputBufferLength - sizeof( COORD )); dwCount++, pAttr++)
|
for (dwCount = 0; dwCount < (stk->Parameters.DeviceIoControl.OutputBufferLength - sizeof( COORD )); dwCount++, pAttr++)
|
||||||
{
|
{
|
||||||
vidmem[offset + (dwCount * 2)] = *pAttr;
|
vidmem[offset + (dwCount * 2)] = *pAttr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -614,15 +652,18 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
if (!InbvCheckDisplayOwnership())
|
||||||
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
{
|
||||||
(Buf->dwCoord.X * 2);
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
||||||
|
(Buf->dwCoord.X * 2);
|
||||||
|
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < Buf->nLength; dwCount++)
|
for (dwCount = 0; dwCount < Buf->nLength; dwCount++)
|
||||||
{
|
{
|
||||||
vidmem[offset + (dwCount * 2)] = (char) Buf->cCharacter;
|
vidmem[offset + (dwCount * 2)] = (char) Buf->cCharacter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Buf->dwTransfered = Buf->nLength;
|
Buf->dwTransfered = Buf->nLength;
|
||||||
|
|
||||||
|
@ -639,16 +680,23 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
if (!InbvCheckDisplayOwnership())
|
||||||
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
{
|
||||||
(Buf->dwCoord.X * 2);
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
|
||||||
|
(Buf->dwCoord.X * 2);
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < stk->Parameters.DeviceIoControl.OutputBufferLength; dwCount++, pChar++)
|
for (dwCount = 0; dwCount < stk->Parameters.DeviceIoControl.OutputBufferLength; dwCount++, pChar++)
|
||||||
{
|
{
|
||||||
*pChar = vidmem[offset + (dwCount * 2)];
|
*pChar = vidmem[offset + (dwCount * 2)];
|
||||||
}
|
}
|
||||||
|
|
||||||
Buf->dwTransfered = dwCount;
|
Buf->dwTransfered = dwCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buf->dwTransfered = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
|
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -663,16 +711,19 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
int offset;
|
int offset;
|
||||||
ULONG dwCount;
|
ULONG dwCount;
|
||||||
|
|
||||||
pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
|
if (!InbvCheckDisplayOwnership())
|
||||||
pChar = (CHAR *)(pCoord + 1);
|
{
|
||||||
vidmem = DeviceExtension->VideoMemory;
|
pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||||
offset = (pCoord->Y * DeviceExtension->Columns * 2) +
|
pChar = (CHAR *)(pCoord + 1);
|
||||||
(pCoord->X * 2);
|
vidmem = DeviceExtension->VideoMemory;
|
||||||
|
offset = (pCoord->Y * DeviceExtension->Columns * 2) +
|
||||||
|
(pCoord->X * 2);
|
||||||
|
|
||||||
for (dwCount = 0; dwCount < (stk->Parameters.DeviceIoControl.OutputBufferLength - sizeof( COORD )); dwCount++, pChar++)
|
for (dwCount = 0; dwCount < (stk->Parameters.DeviceIoControl.OutputBufferLength - sizeof( COORD )); dwCount++, pChar++)
|
||||||
{
|
{
|
||||||
vidmem[offset + (dwCount * 2)] = *pChar;
|
vidmem[offset + (dwCount * 2)] = *pChar;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -685,29 +736,32 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
PUCHAR Src, Dest;
|
PUCHAR Src, Dest;
|
||||||
UINT32 SrcDelta, DestDelta, i, Offset;
|
UINT32 SrcDelta, DestDelta, i, Offset;
|
||||||
|
|
||||||
ConsoleDraw = (PCONSOLE_DRAW) MmGetSystemAddressForMdl(Irp->MdlAddress);
|
if (!InbvCheckDisplayOwnership())
|
||||||
Src = (PUCHAR) (ConsoleDraw + 1);
|
{
|
||||||
SrcDelta = ConsoleDraw->SizeX * 2;
|
ConsoleDraw = (PCONSOLE_DRAW) MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||||
Dest = DeviceExtension->VideoMemory +
|
Src = (PUCHAR) (ConsoleDraw + 1);
|
||||||
(ConsoleDraw->Y * DeviceExtension->Columns + ConsoleDraw->X) * 2;
|
SrcDelta = ConsoleDraw->SizeX * 2;
|
||||||
DestDelta = DeviceExtension->Columns * 2;
|
Dest = DeviceExtension->VideoMemory +
|
||||||
|
(ConsoleDraw->Y * DeviceExtension->Columns + ConsoleDraw->X) * 2;
|
||||||
|
DestDelta = DeviceExtension->Columns * 2;
|
||||||
|
|
||||||
for (i = 0; i < ConsoleDraw->SizeY; i++)
|
for (i = 0; i < ConsoleDraw->SizeY; i++)
|
||||||
{
|
{
|
||||||
RtlCopyMemory(Dest, Src, SrcDelta);
|
RtlCopyMemory(Dest, Src, SrcDelta);
|
||||||
Src += SrcDelta;
|
Src += SrcDelta;
|
||||||
Dest += DestDelta;
|
Dest += DestDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = (ConsoleDraw->CursorY * DeviceExtension->Columns) +
|
Offset = (ConsoleDraw->CursorY * DeviceExtension->Columns) +
|
||||||
ConsoleDraw->CursorX;
|
ConsoleDraw->CursorX;
|
||||||
|
|
||||||
_disable();
|
_disable();
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, Offset);
|
WRITE_PORT_UCHAR (CRTC_DATA, Offset);
|
||||||
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
|
||||||
WRITE_PORT_UCHAR (CRTC_DATA, Offset >> 8);
|
WRITE_PORT_UCHAR (CRTC_DATA, Offset >> 8);
|
||||||
_enable();
|
_enable();
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -718,8 +772,11 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
UINT32 CodePage = (UINT32)*(PULONG)Irp->AssociatedIrp.SystemBuffer;
|
UINT32 CodePage = (UINT32)*(PULONG)Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
// Upload a font for the codepage if needed
|
if (!InbvCheckDisplayOwnership())
|
||||||
ScrLoadFontTable(CodePage);
|
{
|
||||||
|
// Upload a font for the codepage if needed
|
||||||
|
ScrLoadFontTable(CodePage);
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -739,7 +796,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
||||||
static DRIVER_DISPATCH ScrDispatch;
|
static DRIVER_DISPATCH ScrDispatch;
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
ScrDispatch(PDEVICE_OBJECT DeviceObject,
|
ScrDispatch(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
|
@ -485,6 +485,15 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
|
||||||
KdpDmesgFreeBytes = KdpDmesgBufferSize;
|
KdpDmesgFreeBytes = KdpDmesgBufferSize;
|
||||||
KdbDmesgTotalWritten = 0;
|
KdbDmesgTotalWritten = 0;
|
||||||
|
|
||||||
|
/* Take control of the display */
|
||||||
|
InbvAcquireDisplayOwnership();
|
||||||
|
InbvResetDisplay();
|
||||||
|
InbvSolidColorFill(0, 0, 639, 479, 6);
|
||||||
|
InbvSetTextColor(15);
|
||||||
|
InbvSetScrollRegion(0, 0, 639, 479);
|
||||||
|
InbvInstallDisplayStringFilter(NULL);
|
||||||
|
InbvEnableDisplayString(TRUE);
|
||||||
|
|
||||||
/* Initialize spinlock */
|
/* Initialize spinlock */
|
||||||
KeInitializeSpinLock(&KdpDmesgLogSpinLock);
|
KeInitializeSpinLock(&KdpDmesgLogSpinLock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue