[haiku-commits] haiku: hrev43461 - in src/system: kernel/messaging runtime_loader boot/loader

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 10 Dec 2011 21:03:32 +0100 (CET)

hrev43461 adds 4 changesets to branch 'master'
old head: a188dae8be1051aea88459b4c4eb1e3f98b6cff1
new head: 5585262bb1db89f5fccc05f8db09299ef4b4b855

----------------------------------------------------------------------------

a173514: Revert hrev43459.
  
  This reverts commit c8a48d783c78e1e39c06a102e877d954923f6038.

8eff10a: Revert hrev43458.
  
  This reverts commit 80e6a84bf008b3479413d37737f1889bd2a02905.

33f0ed7: Revert hrev43457.
  
  This reverts commit 82929f8a76b4a5f185f9f39cbec3eb42ace7fc06.

5585262: Revert hrev43455 and instead just align the size.
  
  While this isn't really correct, it works for the use case it is
  intended and doesn't open the can of worms we get when trying to do
  memalign() across platforms (due to build tools use of KMessage).

                                            [ Michael Lotz <mmlr@xxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 3 insertions(+), 26 deletions(-)
src/system/boot/loader/heap.cpp          |   10 ----------
src/system/kernel/messaging/KMessage.cpp |    9 +++------
src/system/runtime_loader/heap.cpp       |   10 ----------

############################################################################

Commit:      a173514ad17cfabf540ceaa07d15cea41eb91f79
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a173514
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sat Dec 10 19:46:58 2011 UTC

Revert hrev43459.

This reverts commit c8a48d783c78e1e39c06a102e877d954923f6038.

----------------------------------------------------------------------------

diff --git a/src/system/boot/loader/heap.cpp b/src/system/boot/loader/heap.cpp
index 5721af0..970ce7f 100644
--- a/src/system/boot/loader/heap.cpp
+++ b/src/system/boot/loader/heap.cpp
@@ -8,7 +8,6 @@
 #include <boot/platform.h>
 #include <util/kernel_cpp.h>
 
-#include <malloc.h>
 #ifdef HEAP_TEST
 #      include <stdio.h>
 #endif
@@ -330,15 +329,6 @@ malloc(size_t size)
 }
 
 
-void *
-memalign(size_t alignment, size_t size)
-{
-       // pseudo alignment by just upping the size
-       size = (size + alignment - 1) & ~(alignment - 1);
-       return malloc(size);
-}
-
-
 void*
 realloc(void* oldBuffer, size_t newSize)
 {

############################################################################

Commit:      8eff10a8bfd597cbbf61301e605694e7230e91c7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8eff10a
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sat Dec 10 19:47:23 2011 UTC

Revert hrev43458.

This reverts commit 80e6a84bf008b3479413d37737f1889bd2a02905.

----------------------------------------------------------------------------

diff --git a/src/system/runtime_loader/heap.cpp 
b/src/system/runtime_loader/heap.cpp
index bb6e880..61a815d 100644
--- a/src/system/runtime_loader/heap.cpp
+++ b/src/system/runtime_loader/heap.cpp
@@ -323,7 +323,7 @@ void *
 memalign(size_t alignment, size_t size)
 {
        // pseudo alignment by just upping the size
-       size = (size + alignment - 1) & ~(alignment - 1);
+       size = (size + alignment - 1) & ~alignment;
        return malloc(size);
 }
 

############################################################################

Commit:      33f0ed7a03b771eddca8687e97554a4831416cea
URL:         http://cgit.haiku-os.org/haiku/commit/?id=33f0ed7
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sat Dec 10 19:47:44 2011 UTC

Revert hrev43457.

This reverts commit 82929f8a76b4a5f185f9f39cbec3eb42ace7fc06.

----------------------------------------------------------------------------

diff --git a/src/system/runtime_loader/heap.cpp 
b/src/system/runtime_loader/heap.cpp
index 61a815d..03346a9 100644
--- a/src/system/runtime_loader/heap.cpp
+++ b/src/system/runtime_loader/heap.cpp
@@ -9,7 +9,6 @@
 #include <syscalls.h>
 #include <util/kernel_cpp.h>
 
-#include <malloc.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -319,15 +318,6 @@ restart:
 }
 
 
-void *
-memalign(size_t alignment, size_t size)
-{
-       // pseudo alignment by just upping the size
-       size = (size + alignment - 1) & ~alignment;
-       return malloc(size);
-}
-
-
 void
 free(void *allocated)
 {

############################################################################

Revision:    hrev43461
Commit:      5585262bb1db89f5fccc05f8db09299ef4b4b855
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5585262
Author:      Michael Lotz <mmlr@xxxxxxxx>
Date:        Sat Dec 10 19:58:27 2011 UTC

Revert hrev43455 and instead just align the size.

While this isn't really correct, it works for the use case it is
intended and doesn't open the can of worms we get when trying to do
memalign() across platforms (due to build tools use of KMessage).

----------------------------------------------------------------------------

diff --git a/src/system/kernel/messaging/KMessage.cpp 
b/src/system/kernel/messaging/KMessage.cpp
index d4dbf03..8f48d3d 100644
--- a/src/system/kernel/messaging/KMessage.cpp
+++ b/src/system/kernel/messaging/KMessage.cpp
@@ -6,8 +6,6 @@
 
 #include <util/KMessage.h>
 
-#include <malloc.h>
-       // for memalign()
 #include <stdlib.h>
 #include <string.h>
 
@@ -610,8 +608,7 @@ KMessage::ReceiveFrom(port_id fromPort, bigtime_t timeout,
                return error;
 
        // allocate a buffer
-       uint8* buffer = (uint8*)memalign(kMessageBufferAlignment,
-               messageInfo->size);
+       uint8* buffer = (uint8*)malloc(_Align(messageInfo->size));
        if (!buffer)
                return B_NO_MEMORY;
 
@@ -830,7 +827,7 @@ KMessage::_InitFromBuffer(bool sizeFromBuffer)
                        fBufferCapacity = size;
                }
 
-               void* buffer = memalign(kMessageBufferAlignment, 
fBufferCapacity);
+               void* buffer = malloc(_Align(fBufferCapacity));
                if (buffer == NULL)
                        return B_NO_MEMORY;
 
@@ -964,7 +961,7 @@ KMessage::_AllocateSpace(int32 size, bool alignAddress, 
bool alignSize,
        // reallocate if necessary
        if (fBuffer == &fHeader) {
                int32 newCapacity = _CapacityFor(newSize);
-               void* newBuffer = memalign(kMessageBufferAlignment, 
newCapacity);
+               void* newBuffer = malloc(_Align(newCapacity));
                if (!newBuffer)
                        return B_NO_MEMORY;
                fBuffer = newBuffer;


Other related posts:

  • » [haiku-commits] haiku: hrev43461 - in src/system: kernel/messaging runtime_loader boot/loader - mmlr