- 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:
Cameron Gutman 2012-02-12 21:16:34 +00:00
parent 65beefbcd8
commit 8b553a4ba7
3 changed files with 224 additions and 158 deletions

View file

@ -115,8 +115,8 @@ Cabinet=reactos.cab
DefaultPath = \ReactOS
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /FIRSTCHANCE"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
;DbgOsLoadOptions = "/SOS /DEBUGPORT=SCREEN"
;DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
[NLS]
AnsiCodepage = c_1252.nls

View file

@ -232,12 +232,22 @@ ScrCreate(PDEVICE_OBJECT DeviceObject,
DeviceExtension = DeviceObject->DeviceExtension;
if (!InbvCheckDisplayOwnership())
{
ScrAcquireOwnership(DeviceExtension);
/* get pointer to video memory */
BaseAddress.QuadPart = VIDMEM_BASE;
DeviceExtension->VideoMemory =
(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->CursorVisible = TRUE;
@ -271,7 +281,7 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
int rows, columns;
int processed = DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT;
if (0 && InbvCheckDisplayOwnership())
if (InbvCheckDisplayOwnership())
{
/* Display is in graphics mode, we're not allowed to touch it */
Status = STATUS_SUCCESS;
@ -416,6 +426,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int columns = DeviceExtension->Columns;
unsigned int offset;
if (!InbvCheckDisplayOwnership())
{
/* read cursor position from crtc */
_disable();
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
@ -423,6 +435,11 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
offset += (READ_PORT_UCHAR (CRTC_DATA) << 8);
_enable();
}
else
{
offset = 0;
}
pcsbi->dwSize.X = columns;
pcsbi->dwSize.Y = rows;
@ -454,12 +471,15 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
offset = (pcsbi->dwCursorPosition.Y * DeviceExtension->Columns) +
pcsbi->dwCursorPosition.X;
if (!InbvCheckDisplayOwnership())
{
_disable();
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
WRITE_PORT_UCHAR (CRTC_DATA, offset);
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
WRITE_PORT_UCHAR (CRTC_DATA, offset>>8);
_enable();
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
@ -486,6 +506,9 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
DeviceExtension->CursorSize = pcci->dwSize;
DeviceExtension->CursorVisible = pcci->bVisible;
if (!InbvCheckDisplayOwnership())
{
height = DeviceExtension->ScanLines;
data = (pcci->bVisible) ? 0x00 : 0x20;
@ -505,6 +528,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
WRITE_PORT_UCHAR (CRTC_DATA, value | (height - 1));
_enable();
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
@ -540,6 +564,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2) + 1;
@ -548,6 +574,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
{
vidmem[offset + (dwCount * 2)] = (char) Buf->wAttribute;
}
}
Buf->dwTransfered = Buf->nLength;
@ -564,6 +591,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2) + 1;
@ -574,6 +603,11 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
}
Buf->dwTransfered = dwCount;
}
else
{
Buf->dwTransfered = 0;
}
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
Status = STATUS_SUCCESS;
@ -588,6 +622,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
vidmem = DeviceExtension->VideoMemory;
offset = (pCoord->Y * DeviceExtension->Columns * 2) +
(pCoord->X * 2) + 1;
@ -596,6 +632,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
{
vidmem[offset + (dwCount * 2)] = *pAttr;
}
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
}
@ -614,6 +652,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2);
@ -623,6 +663,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
{
vidmem[offset + (dwCount * 2)] = (char) Buf->cCharacter;
}
}
Buf->dwTransfered = Buf->nLength;
@ -639,6 +680,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2);
@ -649,6 +692,11 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
}
Buf->dwTransfered = dwCount;
}
else
{
Buf->dwTransfered = 0;
}
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
Status = STATUS_SUCCESS;
@ -663,6 +711,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
int offset;
ULONG dwCount;
if (!InbvCheckDisplayOwnership())
{
pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
pChar = (CHAR *)(pCoord + 1);
vidmem = DeviceExtension->VideoMemory;
@ -673,6 +723,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
{
vidmem[offset + (dwCount * 2)] = *pChar;
}
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
@ -685,6 +736,8 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
PUCHAR Src, Dest;
UINT32 SrcDelta, DestDelta, i, Offset;
if (!InbvCheckDisplayOwnership())
{
ConsoleDraw = (PCONSOLE_DRAW) MmGetSystemAddressForMdl(Irp->MdlAddress);
Src = (PUCHAR) (ConsoleDraw + 1);
SrcDelta = ConsoleDraw->SizeX * 2;
@ -708,6 +761,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
WRITE_PORT_UCHAR (CRTC_DATA, Offset >> 8);
_enable();
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
@ -718,8 +772,11 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
{
UINT32 CodePage = (UINT32)*(PULONG)Irp->AssociatedIrp.SystemBuffer;
if (!InbvCheckDisplayOwnership())
{
// Upload a font for the codepage if needed
ScrLoadFontTable(CodePage);
}
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;

View file

@ -485,6 +485,15 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
KdpDmesgFreeBytes = KdpDmesgBufferSize;
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 */
KeInitializeSpinLock(&KdpDmesgLogSpinLock);