[haiku-commits] haiku: hrev45704 - in src/system: kernel/vm libroot/os libroot libroot/posix/malloc runtime_loader

  • From: pdziepak@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 22 May 2013 20:00:54 +0200 (CEST)

hrev45704 adds 2 changesets to branch 'master'
old head: 325f7bb4ec436d8b39b6352877c60b48d4daf2b4
new head: 6c9c8a037c529b109881dc96dfbd1a0e130efa20
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=6c9c8a0+%5E325f7bb

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

07e1875: libroot: explicitly check ABI version
  
  As Axel suggested use simple, explicit checks for legacy ABI version
  instead of obscure "compatibility mode".

6c9c8a0: vm: fix area insertion logic
  
   * When looking for a place for new area the size of the area to be
     inserted instead of the next area size was used to check whether
     we are already past the upper bound.
   * There was an attempt to insert area even if we were past the
     upper bound.

                                    [ Pawel Dziepak <pdziepak@xxxxxxxxxxx> ]

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

7 files changed, 15 insertions(+), 13 deletions(-)
headers/private/libroot/libroot_private.h         | 2 +-
src/system/kernel/vm/VMUserAddressSpace.cpp       | 6 +++---
src/system/libroot/libroot_init.c                 | 5 ++---
src/system/libroot/os/area.c                      | 6 +++---
src/system/libroot/os/thread.c                    | 2 +-
src/system/libroot/posix/malloc/arch-specific.cpp | 4 ++--
src/system/runtime_loader/export.cpp              | 3 +++

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

Commit:      07e1875ea21bd0a05e949cce0d4e4558b6684ee0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=07e1875
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Wed May 15 23:51:37 2013 UTC

libroot: explicitly check ABI version

As Axel suggested use simple, explicit checks for legacy ABI version
instead of obscure "compatibility mode".

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

diff --git a/headers/private/libroot/libroot_private.h 
b/headers/private/libroot/libroot_private.h
index a419872..85bc14d 100644
--- a/headers/private/libroot/libroot_private.h
+++ b/headers/private/libroot/libroot_private.h
@@ -18,7 +18,7 @@ struct real_time_data;
 extern "C" {
 #endif
 
-extern int __gCompatibilityMode;
+extern int __gABIVersion;
 
 extern char _single_threaded;
        /* This determines if a process runs single threaded or not */
diff --git a/src/system/libroot/libroot_init.c 
b/src/system/libroot/libroot_init.c
index 0915842..867cbd2 100644
--- a/src/system/libroot/libroot_init.c
+++ b/src/system/libroot/libroot_init.c
@@ -31,7 +31,7 @@ char *__progname = NULL;
 int __libc_argc;
 char **__libc_argv;
 
-int __gCompatibilityMode;
+int __gABIVersion;
 
 char _single_threaded = true;
        // determines if I/O locking needed; needed for BeOS compatibility
@@ -50,8 +50,7 @@ initialize_before(image_id imageID)
 {
        char *programPath = __gRuntimeLoader->program_args->args[0];
        __gCommPageAddress = __gRuntimeLoader->commpage_address;
-       __gCompatibilityMode
-               = __gRuntimeLoader->abi_version < B_HAIKU_ABI_GCC_2_HAIKU;
+       __gABIVersion = __gRuntimeLoader->abi_version;
 
        if (programPath) {
                if ((__progname = strrchr(programPath, '/')) == NULL)
diff --git a/src/system/libroot/os/area.c b/src/system/libroot/os/area.c
index 6af67ec..f620d23 100644
--- a/src/system/libroot/os/area.c
+++ b/src/system/libroot/os/area.c
@@ -15,7 +15,7 @@ area_id
 create_area(const char *name, void **address, uint32 addressSpec, size_t size,
        uint32 lock, uint32 protection)
 {
-       if (__gCompatibilityMode == 1)
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
                protection |= B_EXECUTE_AREA;
        return _kern_create_area(name, address, addressSpec, size, lock, 
protection);
 }
@@ -25,7 +25,7 @@ area_id
 clone_area(const char *name, void **address, uint32 addressSpec,
        uint32 protection, area_id sourceArea)
 {
-       if (__gCompatibilityMode == 1)
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
                protection |= B_EXECUTE_AREA;
        return _kern_clone_area(name, address, addressSpec, protection, 
sourceArea);
 }
@@ -62,7 +62,7 @@ resize_area(area_id id, size_t newSize)
 status_t
 set_area_protection(area_id id, uint32 protection)
 {
-       if (__gCompatibilityMode == 1)
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
                protection |= B_EXECUTE_AREA;
        return _kern_set_area_protection(id, protection);
 }
diff --git a/src/system/libroot/os/thread.c b/src/system/libroot/os/thread.c
index 39e7dc2..4172145 100644
--- a/src/system/libroot/os/thread.c
+++ b/src/system/libroot/os/thread.c
@@ -77,7 +77,7 @@ _thread_do_exit_work(void)
 void
 __set_stack_protection(void)
 {
-       if (__gCompatibilityMode == 1) {
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) {
                area_info info;
                ssize_t cookie = 0;
 
diff --git a/src/system/libroot/posix/malloc/arch-specific.cpp 
b/src/system/libroot/posix/malloc/arch-specific.cpp
index 25c17ec..0f16100 100644
--- a/src/system/libroot/posix/malloc/arch-specific.cpp
+++ b/src/system/libroot/posix/malloc/arch-specific.cpp
@@ -106,7 +106,7 @@ __init_heap(void)
                sHeapBase = NULL;
 
        uint32 protection = B_READ_AREA | B_WRITE_AREA;
-       if (__gCompatibilityMode == 1)
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
                protection |= B_EXECUTE_AREA;
        sHeapArea = create_area("heap", (void **)&sHeapBase,
                status == B_OK ? B_EXACT_ADDRESS : B_RANDOMIZED_BASE_ADDRESS,
@@ -171,7 +171,7 @@ hoardSbrk(long size)
 
        // choose correct protection flags
        uint32 protection = B_READ_AREA | B_WRITE_AREA;
-       if (__gCompatibilityMode == 1)
+       if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
                protection |= B_EXECUTE_AREA;
 
        hoardLock(sHeapLock);
diff --git a/src/system/runtime_loader/export.cpp 
b/src/system/runtime_loader/export.cpp
index 8adeec6..f8c0b06 100644
--- a/src/system/runtime_loader/export.cpp
+++ b/src/system/runtime_loader/export.cpp
@@ -74,6 +74,9 @@ rldexport_init(void)
 }
 
 
+/*!    Is called for all images, and sets the minimum ABI version found to the
+       gRuntimeLoader.abi_version field.
+*/
 void
 set_abi_version(int abi_version)
 {

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

Revision:    hrev45704
Commit:      6c9c8a037c529b109881dc96dfbd1a0e130efa20
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6c9c8a0
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Wed May 22 12:18:50 2013 UTC

vm: fix area insertion logic

 * When looking for a place for new area the size of the area to be
   inserted instead of the next area size was used to check whether
   we are already past the upper bound.
 * There was an attempt to insert area even if we were past the
   upper bound.

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

diff --git a/src/system/kernel/vm/VMUserAddressSpace.cpp 
b/src/system/kernel/vm/VMUserAddressSpace.cpp
index ac989f5..dd10892 100644
--- a/src/system/kernel/vm/VMUserAddressSpace.cpp
+++ b/src/system/kernel/vm/VMUserAddressSpace.cpp
@@ -588,7 +588,7 @@ second_chance:
                        }
 
                        // keep walking
-                       while (next != NULL && next->Base() + size - 1 <= end) {
+                       while (next != NULL && next->Base() + next->Size() - 1 
<= end) {
                                addr_t alignedBase = ROUNDUP(last->Base() + 
last->Size(),
                                        alignment);
                                addr_t nextBase = min_c(end, next->Base() - 1);
@@ -615,8 +615,8 @@ second_chance:
 
                        addr_t alignedBase = ROUNDUP(last->Base() + 
last->Size(),
                                alignment);
-                       if (is_valid_spot(last->Base() + (last->Size() - 1), 
alignedBase,
-                                       size, end)) {
+                       if (next == NULL && is_valid_spot(last->Base() + 
(last->Size() - 1),
+                                       alignedBase, size, end)) {
 
                                if (is_randomized(addressSpec)) {
                                        alignedBase = 
_RandomizeAddress(alignedBase, end - size + 1,


Other related posts:

  • » [haiku-commits] haiku: hrev45704 - in src/system: kernel/vm libroot/os libroot libroot/posix/malloc runtime_loader - pdziepak