Further fixes
authorDavid Welch <welch@cwcom.net>
Sun, 25 Mar 2001 18:56:13 +0000 (18:56 +0000)
committerDavid Welch <welch@cwcom.net>
Sun, 25 Mar 2001 18:56:13 +0000 (18:56 +0000)
svn path=/trunk/; revision=1730

reactos/.gdbinit
reactos/apps/tests/gditest/gditest.c
reactos/drivers/dd/vga/miniport/initvga.c
reactos/ntoskrnl/Makefile
reactos/ntoskrnl/kd/dlog.c
reactos/ntoskrnl/ke/i386/v86m.c
reactos/ntoskrnl/ke/i386/v86m_sup.S
reactos/subsys/win32k/objects/text.c

index 8d90d34..7b39e47 100644 (file)
@@ -2,5 +2,5 @@ file ntoskrnl/ntoskrnl.nostrip.exe
 #add-symbol-file lib/ntdll/ntdll.dll 0x77f61000
 #add-symbol-file apps/exp/exp.exe 0x401000
 #add-symbol-file subsys/csrss/csrss.exe 0x401000
-add-symbol-file subsys/smss/smss.exe 0x401000
+#add-symbol-file subsys/smss/smss.exe 0x401000
 break exp.c:254
index d52a61d..0505bf7 100644 (file)
@@ -55,3 +55,5 @@ int main (void)
        return 0;
 }
 
+
+
index 7e98de9..3135f45 100644 (file)
@@ -121,10 +121,14 @@ VOID  VGAResetDevice(OUT PSTATUS_BLOCK  StatusBlock)
   OBJECT_ATTRIBUTES Attr;
   UNICODE_STRING Name;
   NTSTATUS Status;
+  VIDEO_X86_BIOS_ARGUMENTS vxba;
+  VP_STATUS vps;
   
   CHECKPOINT;
   Event = 0;
-  setMode( Mode3 );
+  //  setMode( Mode3 );
+  vxba.Eax = 0x0003;
+  vps = VideoPortInt10(NULL, &vxba);
   RtlInitUnicodeString( &Name, L"\\TextConsoleRefreshEvent" );
   InitializeObjectAttributes( &Attr, &Name, 0, 0, 0 );
   Status = NtOpenEvent( &Event, STANDARD_RIGHTS_ALL, &Attr );
index f207172..5d1d0f8 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.25 2001/03/18 19:35:12 dwelch Exp $
+# $Id: Makefile,v 1.26 2001/03/25 18:56:12 dwelch Exp $
 #
 # ReactOS Operating System
 #
@@ -17,9 +17,10 @@ OBJECTS_PATH = objects
 
 ASFLAGS = -Iinclude
 CFLAGS = -Iinclude -D__NTOSKRNL__ -DDBG -g -Wall -Werror 
+# -DDBGPRINT_FILE_LOG
 #         -W -Wpointer-arith -Wconversion -Wstrict-prototypes -Wundef \
 #       -Wmissing-prototypes -Wshadow\
-#CFLAGS += -DDBGPRINT_FILE_LOG
+#CFLAGS = -DDBGPRINT_FILE_LOG
 
 include $(PATH_TO_TOP)/rules.mak
 
index 388b4f9..7b565f0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dlog.c,v 1.1 2001/02/16 18:32:20 dwelch Exp $
+/* $Id: dlog.c,v 1.2 2001/03/25 18:56:12 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -25,6 +25,7 @@
 static CHAR DebugLog[DEBUGLOG_SIZE];
 static ULONG DebugLogStart;
 static ULONG DebugLogEnd;
+static ULONG DebugLogCount;
 static KSPIN_LOCK DebugLogLock;
 static ULONG DebugLogOverflow;
 static HANDLE DebugLogThreadHandle;
@@ -42,9 +43,10 @@ VOID
 DebugLogInit(VOID)
 {
   KeInitializeSpinLock(&DebugLogLock);
-  DebugLogStart = -1;
+  DebugLogStart = 0;
   DebugLogEnd = 0;
   DebugLogOverflow = 0;
+  DebugLogCount = 0;
   KeInitializeSemaphore(&DebugLogSem, 0, 255);
 }
 
@@ -53,7 +55,7 @@ DebugLogThreadMain(PVOID Context)
 {
   KIRQL oldIrql;
   IO_STATUS_BLOCK Iosb;
-  CHAR Buffer[256];
+  static CHAR Buffer[256];
   ULONG WLen;
 
   for (;;)
@@ -64,7 +66,7 @@ DebugLogThreadMain(PVOID Context)
                            FALSE,
                            NULL);
       KeAcquireSpinLock(&DebugLogLock, &oldIrql);
-      while (DebugLogStart != -1)
+      while (DebugLogCount > 0)
        {
          if (DebugLogStart > DebugLogEnd)
            {
@@ -72,10 +74,7 @@ DebugLogThreadMain(PVOID Context)
              memcpy(Buffer, &DebugLog[DebugLogStart], WLen);
              DebugLogStart = 
                (DebugLogStart + WLen) % DEBUGLOG_SIZE;
-             if (DebugLogStart == DebugLogEnd)
-               {
-                 DebugLogStart = -1;
-               }
+             DebugLogCount = DebugLogCount - WLen;
              KeReleaseSpinLock(&DebugLogLock, oldIrql);
              NtWriteFile(DebugLogFile,
                          NULL,
@@ -93,10 +92,7 @@ DebugLogThreadMain(PVOID Context)
              memcpy(Buffer, &DebugLog[DebugLogStart], WLen);
              DebugLogStart = 
                (DebugLogStart + WLen) % DEBUGLOG_SIZE;
-             if (DebugLogStart == DebugLogEnd)
-               {
-                 DebugLogStart = -1;
-               }
+             DebugLogCount = DebugLogCount - WLen;
              KeReleaseSpinLock(&DebugLogLock, oldIrql);
              NtWriteFile(DebugLogFile,
                          NULL,
@@ -168,34 +164,40 @@ DebugLogInit2(VOID)
 
    KeAcquireSpinLock(&DebugLogLock, &oldIrql);
 
-   if (DebugLogEnd == DebugLogStart)
+   if (DebugLogCount == DEBUGLOG_SIZE)
      {
        DebugLogOverflow++;
        KeReleaseSpinLock(&DebugLogLock, oldIrql);
-       KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+       if (oldIrql < DISPATCH_LEVEL)
+        {
+          KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+        }
        return;
      }
-   if (DebugLogStart == -1)
-     {
-       DebugLogStart = DebugLogEnd;
-     }
 
    while ((*String) != 0)
      {
        DebugLog[DebugLogEnd] = *String;
        String++;
-       if (((DebugLogEnd + 1) % DEBUGLOG_SIZE) == DebugLogStart)
+       DebugLogCount++;
+       if (DebugLogCount == DEBUGLOG_SIZE)
         {         
           DebugLogOverflow++;
           KeReleaseSpinLock(&DebugLogLock, oldIrql);
-          KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+          if (oldIrql < DISPATCH_LEVEL)
+            {
+              KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+            }
           return;
         }
       DebugLogEnd = (DebugLogEnd + 1) % DEBUGLOG_SIZE;
      }
 
    KeReleaseSpinLock(&DebugLogLock, oldIrql);
-   KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+   if (oldIrql < DISPATCH_LEVEL)
+     {
+       KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
+     }
  }
 
  #else /* not DBGPRINT_FILE_LOG */
index d71836d..8f08148 100644 (file)
@@ -32,7 +32,7 @@
 #include <internal/i386/segment.h>
 #include <string.h>
 
-#define NDEBUG
+//#define NDEBUG
 #include <internal/debug.h>
 
 /* GLOBALS *******************************************************************/
@@ -51,8 +51,8 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf)
   ip = (PUCHAR)((Tf->Cs & 0xFFFF) * 16 + (Tf->Eip & 0xFFFF));
   sp = (PUSHORT)((Tf->Ss & 0xFFFF) * 16 + (Tf->Esp & 0xFFFF));
    
-  DPRINT("KeV86GPF handling %x at %x:%x ss:sp %x:%x\n",
-        ip[0], Tf->Cs, Tf->Eip, Tf->Ss, Tf->Esp);
+  DPRINT("KeV86GPF handling %x at %x:%x ss:sp %x:%x Flags %x\n",
+        ip[0], Tf->Cs, Tf->Eip, Tf->Ss, Tf->Esp, VTf->regs->Flags);
  
   switch (ip[0])
     {
index bf30692..dcfa7a3 100644 (file)
@@ -71,26 +71,26 @@ _Ki386RetToV86Mode:
         * Since we are going to fiddle with the stack pointer this must be
         * a critical section for this processor
         */
-
+       
        /*
-        * The stack used for handling exceptions from v86 mode in this thread
-        * will be the current stack adjusted so we don't overwrite the 
-        * existing stack frames
+        * Save the old initial stack
         */
-       movl    $_KiTss, %esi
-       movl    %esp, KTSS_ESP0(%esi)
+       movl    _CurrentThread, %esi    
+       movl    KTHREAD_INITIAL_STACK(%esi), %edi
+       pushl   %edi
 
        /*
         * We also need to set the stack in the kthread structure
         */
-       movl    _CurrentThread, %esi
-       movl    KTHREAD_INITIAL_STACK(%esi), %edi
        movl    %esp, KTHREAD_INITIAL_STACK(%esi)
-
+       
        /*
-        * Save the old initial stack
+        * The stack used for handling exceptions from v86 mode in this thread
+        * will be the current stack adjusted so we don't overwrite the 
+        * existing stack frames
         */
-       pushl   %edi
+       movl    $_KiTss, %esi
+       movl    %esp, KTSS_ESP0(%esi)
        
        /*
         * Create the stack frame for an iret to v86 mode
index dc357ed..54c5a7b 100644 (file)
@@ -366,17 +366,17 @@ W32kTextOut(HDC  hDC,
 {
     DC                 *dc      = DC_HandleToPtr(hDC);
     SURFOBJ            *SurfObj = AccessUserObject(dc->Surface);
-    PUNICODE_STRING    UString;
-    PANSI_STRING       AString;
+    UNICODE_STRING     UString;
+    ANSI_STRING        AString;
 
-    RtlCreateUnicodeString(UString, (PWSTR)String);
-    RtlUnicodeStringToAnsiString(AString, UString, TRUE);
+    RtlCreateUnicodeString(&UString, (PWSTR)String);
+    RtlUnicodeStringToAnsiString(&AString, &UString, TRUE);
 
     // For now we're just going to use an internal font
-    grWriteCellString(SurfObj, XStart, YStart, AString->Buffer, 0xffffff);
+    grWriteCellString(SurfObj, XStart, YStart, AString.Buffer, 0xffffff);
 
-    RtlFreeAnsiString(AString);
-    RtlFreeUnicodeString(UString);
+    RtlFreeAnsiString(&AString);
+    RtlFreeUnicodeString(&UString);
 }
 
 UINT