Author: sserapion
Date: Sun Dec 14 20:13:20 2008
New Revision: 38094
URL: http://svn.reactos.org/svn/reactos?rev=38094&view=rev
Log:
Start making heap 64bit friendly.
Modified:
branches/ros-amd64-bringup/reactos/lib/rtl/heap.c
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/heap.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/r…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/heap.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/heap.c [iso-8859-1] Sun Dec 14 20:13:20 2008
@@ -68,29 +68,39 @@
typedef struct tagARENA_INUSE
{
- DWORD size; /* Block size; must be the first field */
- DWORD magic : 23; /* Magic number */
- DWORD has_user_data : 1; /* There is user data associated with this block */
- DWORD unused_bytes : 8; /* Number of bytes in the block not used by user data (max value is HEAP_MIN_DATA_SIZE+HEAP_MIN_SHRINK_SIZE) */
+ SIZE_T size; /* Block size; must be the first field */
+ SIZE_T magic : 23; /* Magic number */
+ SIZE_T has_user_data : 1; /* There is user data associated with this block */
+ SIZE_T unused_bytes : 8; /* Number of bytes in the block not used by user data (max value is HEAP_MIN_DATA_SIZE+HEAP_MIN_SHRINK_SIZE) */
} ARENA_INUSE;
typedef struct tagARENA_FREE
{
- DWORD size; /* Block size; must be the first field */
- DWORD magic; /* Magic number */
+ SIZE_T size; /* Block size; must be the first field */
+ SIZE_T magic; /* Magic number */
struct list entry; /* Entry in free list */
} ARENA_FREE;
#define ARENA_FLAG_FREE 0x00000001 /* flags OR'ed with arena size */
#define ARENA_FLAG_PREV_FREE 0x00000002
-#define ARENA_SIZE_MASK (~3)
#define ARENA_INUSE_MAGIC 0x455355 /* Value for arena 'magic' field */
#define ARENA_FREE_MAGIC 0x45455246 /* Value for arena 'magic' field */
+#ifndef _WIN64
+#define ARENA_SIZE_MASK (~3L)
+#else
+#define ARENA_SIZE_MASK (~7L)
+#endif
+
#define ARENA_INUSE_FILLER 0x55
#define ARENA_FREE_FILLER 0xaa
+#ifndef _WIN64
#define ALIGNMENT 8 /* everything is aligned on 8 byte boundaries */
+#else
+#define ALIGNMENT 16
+#endif
+
#define ROUND_SIZE(size) (((size) + ALIGNMENT - 1) & ~(ALIGNMENT-1))
#define QUIET 1 /* Suppress messages */
@@ -118,12 +128,12 @@
typedef struct tagSUBHEAP
{
- DWORD size; /* Size of the whole sub-heap */
- DWORD commitSize; /* Committed size of the sub-heap */
- DWORD headerSize; /* Size of the heap header */
+ SIZE_T size; /* Size of the whole sub-heap */
+ SIZE_T commitSize; /* Committed size of the sub-heap */
+ SIZE_T headerSize; /* Size of the heap header */
struct tagSUBHEAP *next; /* Next sub-heap */
struct tagHEAP *heap; /* Main heap structure */
- DWORD magic; /* Magic number */
+ SIZE_T magic; /* Magic number */
} SUBHEAP;
#define SUBHEAP_MAGIC ((DWORD)('S' | ('U'<<8) | ('B'<<16) | ('H'<<24)))
Author: tkreuzer
Date: Sun Dec 14 17:18:59 2008
New Revision: 38087
URL: http://svn.reactos.org/svn/reactos?rev=38087&view=rev
Log:
- Replace a 'for' with a 'do .. while '
- Make sure OutputDebugStringA terminates with a newline
Fixes winetest debug output. I wonder how it worked before. Dedicated to Stefan100.
Modified:
trunk/reactos/dll/win32/kernel32/debug/output.c
Modified: trunk/reactos/dll/win32/kernel32/debug/output.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/debug/o…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] Sun Dec 14 17:18:59 2008
@@ -317,7 +317,7 @@
#if 0
__try
#else
- do
+ do
#endif
{
/* size of the current output block */
@@ -326,17 +326,10 @@
/* size of the remainder of the string */
SIZE_T nOutputStringLen;
- for
- (
- /* output the whole string */
- nOutputStringLen = strlen(_OutputString);
-
- /* repeat until the string has been fully output */
- nOutputStringLen > 0;
-
- /* move to the next block */
- _OutputString += nRoundLen, nOutputStringLen -= nRoundLen
- )
+ /* output the whole string */
+ nOutputStringLen = strlen(_OutputString);
+
+ do
{
/* we're connected to the debug monitor:
write the current block to the shared buffer */
@@ -375,13 +368,25 @@
CHAR a_cBuffer[512];
/* write a maximum of 511 bytes */
- if(nOutputStringLen > (sizeof(a_cBuffer) - 1))
- nRoundLen = sizeof(a_cBuffer) - 1;
+ if(nOutputStringLen > (sizeof(a_cBuffer) - 2))
+ nRoundLen = sizeof(a_cBuffer) - 2;
else
nRoundLen = nOutputStringLen;
/* copy the current block */
memcpy(a_cBuffer, _OutputString, nRoundLen);
+
+ /* Have we reached the end of the string? */
+ if (nRoundLen == nOutputStringLen)
+ {
+ /* Make sure we terminate with a line break */
+ if (a_cBuffer[nRoundLen - 1] != '\n')
+ {
+ a_cBuffer[nRoundLen] = '\n';
+ nRoundLen++;
+ nOutputStringLen++;
+ }
+ }
/* null-terminate the current block */
a_cBuffer[nRoundLen] = 0;
@@ -389,7 +394,14 @@
/* send the current block to the kernel debugger */
DbgPrint("%s", a_cBuffer);
}
+
+ /* move to the next block */
+ _OutputString += nRoundLen;
+ nOutputStringLen -= nRoundLen;
}
+ /* repeat until the string has been fully output */
+ while (nOutputStringLen > 0);
+
}
#if 0
/* ignore access violations and let other exceptions fall through */
Author: tkreuzer
Date: Sun Dec 14 16:52:51 2008
New Revision: 38086
URL: http://svn.reactos.org/svn/reactos?rev=38086&view=rev
Log:
[FORMATTING]
Fix indentation, no code change
Modified:
trunk/reactos/dll/win32/kernel32/debug/output.c
Modified: trunk/reactos/dll/win32/kernel32/debug/output.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/debug/o…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/debug/output.c [iso-8859-1] Sun Dec 14 16:52:51 2008
@@ -317,9 +317,9 @@
#if 0
__try
#else
- do
-#endif
- {
+ do
+#endif
+ {
/* size of the current output block */
SIZE_T nRoundLen;
@@ -337,60 +337,60 @@
/* move to the next block */
_OutputString += nRoundLen, nOutputStringLen -= nRoundLen
)
- {
- /* we're connected to the debug monitor: write the current block to the
- shared buffer */
- if(hDBMonDataReady)
{
- /* wait a maximum of 10 seconds for the debug monitor to finish processing
- the shared buffer */
- if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0)
+ /* we're connected to the debug monitor:
+ write the current block to the shared buffer */
+ if(hDBMonDataReady)
{
- /* timeout or failure: give up */
- break;
+ /* wait a maximum of 10 seconds for the debug monitor
+ to finish processing the shared buffer */
+ if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0)
+ {
+ /* timeout or failure: give up */
+ break;
+ }
+
+ /* write the process id into the buffer */
+ pDBMonBuffer->ProcessId = GetCurrentProcessId();
+
+ /* write only as many bytes as they fit in the buffer */
+ if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1))
+ nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1;
+ else
+ nRoundLen = nOutputStringLen;
+
+ /* copy the current block into the buffer */
+ memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen);
+
+ /* null-terminate the current block */
+ pDBMonBuffer->Buffer[nRoundLen] = 0;
+
+ /* signal that the data contains meaningful data and can be read */
+ SetEvent(hDBMonDataReady);
}
-
- /* write the process id into the buffer */
- pDBMonBuffer->ProcessId = GetCurrentProcessId();
-
- /* write only as many bytes as they fit in the buffer */
- if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1))
- nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1;
+ /* else, send the current block to the kernel debugger */
else
- nRoundLen = nOutputStringLen;
-
- /* copy the current block into the buffer */
- memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen);
-
- /* null-terminate the current block */
- pDBMonBuffer->Buffer[nRoundLen] = 0;
-
- /* signal that the data contains meaningful data and can be read */
- SetEvent(hDBMonDataReady);
+ {
+ /* output in blocks of 512 characters */
+ CHAR a_cBuffer[512];
+
+ /* write a maximum of 511 bytes */
+ if(nOutputStringLen > (sizeof(a_cBuffer) - 1))
+ nRoundLen = sizeof(a_cBuffer) - 1;
+ else
+ nRoundLen = nOutputStringLen;
+
+ /* copy the current block */
+ memcpy(a_cBuffer, _OutputString, nRoundLen);
+
+ /* null-terminate the current block */
+ a_cBuffer[nRoundLen] = 0;
+
+ /* send the current block to the kernel debugger */
+ DbgPrint("%s", a_cBuffer);
+ }
}
- /* else, send the current block to the kernel debugger */
- else
- {
- /* output in blocks of 512 characters */
- CHAR a_cBuffer[512];
-
- /* write a maximum of 511 bytes */
- if(nOutputStringLen > (sizeof(a_cBuffer) - 1))
- nRoundLen = sizeof(a_cBuffer) - 1;
- else
- nRoundLen = nOutputStringLen;
-
- /* copy the current block */
- memcpy(a_cBuffer, _OutputString, nRoundLen);
-
- /* null-terminate the current block */
- a_cBuffer[nRoundLen] = 0;
-
- /* send the current block to the kernel debugger */
- DbgPrint("%s", a_cBuffer);
- }
- }
- }
+ }
#if 0
/* ignore access violations and let other exceptions fall through */
__except