[haiku-commits] r35823 - haiku/trunk/src/system/boot/platform/bios_ia32

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 12 Mar 2010 13:57:35 +0100 (CET)

Author: bonefish
Date: 2010-03-12 13:57:35 +0100 (Fri, 12 Mar 2010)
New Revision: 35823
Changeset: http://dev.haiku-os.org/changeset/35823/haiku

Modified:
   haiku/trunk/src/system/boot/platform/bios_ia32/debug.cpp
Log:
Postpone clearing the debug syslog buffer signature to the time when going
to start the kernel with the option disabled.


Modified: haiku/trunk/src/system/boot/platform/bios_ia32/debug.cpp
===================================================================
--- haiku/trunk/src/system/boot/platform/bios_ia32/debug.cpp    2010-03-12 
12:46:24 UTC (rev 35822)
+++ haiku/trunk/src/system/boot/platform/bios_ia32/debug.cpp    2010-03-12 
12:57:35 UTC (rev 35823)
@@ -98,9 +98,6 @@
        size_t signatureLength = strlen(kDebugSyslogSignature);
        bool recover = memcmp(buffer, kDebugSyslogSignature, signatureLength) 
== 0;
 
-       // clear the signature
-       memset(buffer, 0, signatureLength);
-
        size -= signatureLength;
        buffer = (uint8*)buffer + ROUNDUP(signatureLength, sizeof(void*));
 
@@ -115,16 +112,25 @@
 void
 debug_cleanup(void)
 {
-       if (gKernelArgs.keep_debug_output_buffer && sDebugSyslogBuffer != NULL) 
{
-               // copy the output gathered so far into the ring buffer
-               ring_buffer_clear(sDebugSyslogBuffer);
-               ring_buffer_write(sDebugSyslogBuffer, (uint8*)sBuffer, 
sBufferPosition);
+       if (sDebugSyslogBuffer != NULL) {
+               size_t signatureLength = strlen(kDebugSyslogSignature);
+               void* buffer
+                       = (void*)ROUNDDOWN((addr_t)sDebugSyslogBuffer, 
B_PAGE_SIZE);
 
-               // set the buffer signature, so we'll accept it as valid after 
reboot
-               size_t signatureLength = strlen(kDebugSyslogSignature);
-               memcpy((void*)ROUNDDOWN((addr_t)sDebugSyslogBuffer, 
B_PAGE_SIZE),
-                       kDebugSyslogSignature, signatureLength);
-       } else {
+               if (gKernelArgs.keep_debug_output_buffer) {
+                       // copy the output gathered so far into the ring buffer
+                       ring_buffer_clear(sDebugSyslogBuffer);
+                       ring_buffer_write(sDebugSyslogBuffer, (uint8*)sBuffer, 
sBufferPosition);
+
+                       memcpy(buffer, kDebugSyslogSignature, signatureLength);
+               } else {
+                       // clear the signature
+                       memset(buffer, 0, signatureLength);
+               }
+       } else
+               gKernelArgs.keep_debug_output_buffer = false;
+
+       if (!gKernelArgs.keep_debug_output_buffer) {
                gKernelArgs.debug_output = kernel_args_malloc(sBufferPosition);
                if (gKernelArgs.debug_output != NULL) {
                        memcpy(gKernelArgs.debug_output, sBuffer, 
sBufferPosition);


Other related posts:

  • » [haiku-commits] r35823 - haiku/trunk/src/system/boot/platform/bios_ia32 - ingo_weinhold